style: 统一全仓代码格式
This commit is contained in:
1 parent
d811478d0f
commit
8033cabff9
30 files changed
+1183
-187
No files matched your search
@@ -17,7 +17,8 @@ export class BookingItemDto {
|
||||
}
|
||||
|
||||
export class CreateBookingDto {
|
||||
@IsIn(["package", "private_chef", "inquiry"]) requestType!: "package" | "private_chef" | "inquiry";
|
||||
@IsIn(["package", "private_chef", "inquiry"]) requestType!:
|
||||
"package" | "private_chef" | "inquiry";
|
||||
@IsString() customerName!: string;
|
||||
@IsOptional() @IsString() phone?: string;
|
||||
@IsOptional() @IsString() wechatId?: string;
|
||||
|
||||
+10
-6
@@ -31,18 +31,22 @@ export class ApiExceptionFilter implements ExceptionFilter {
|
||||
const request = context.getRequest<FastifyRequest>();
|
||||
const status = exception instanceof HttpException ? exception.getStatus() : 500;
|
||||
if (!(exception instanceof HttpException)) console.error("api unhandled error", exception);
|
||||
const detail = exception instanceof HttpException
|
||||
? exception.getResponse()
|
||||
: process.env.NODE_ENV === "development" && exception instanceof Error
|
||||
? exception.message
|
||||
: "服务器内部错误";
|
||||
const detail =
|
||||
exception instanceof HttpException
|
||||
? exception.getResponse()
|
||||
: process.env.NODE_ENV === "development" && exception instanceof Error
|
||||
? exception.message
|
||||
: "服务器内部错误";
|
||||
response.status(status).send({
|
||||
data: null,
|
||||
error: {
|
||||
code: `HTTP_${status}`,
|
||||
message: typeof detail === "string" ? detail : "请求失败",
|
||||
},
|
||||
requestId: (request as FastifyRequest & { requestId?: string }).requestId ?? request.headers["x-request-id"] ?? null,
|
||||
requestId:
|
||||
(request as FastifyRequest & { requestId?: string }).requestId ??
|
||||
request.headers["x-request-id"] ??
|
||||
null,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,10 @@ export class WechatAuthService {
|
||||
try {
|
||||
response = await fetch(`https://api.weixin.qq.com/sns/jscode2session?${query.toString()}`);
|
||||
} catch (error) {
|
||||
console.error("wechat session request failed", error instanceof Error ? error.message : error);
|
||||
console.error(
|
||||
"wechat session request failed",
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
throw new ServiceUnavailableException("微信登录服务暂时不可用");
|
||||
}
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in new issue
Block a user