전체 코드, 구조 검토 - P2 코드 수정 진행

This commit is contained in:
2026-07-04 15:59:50 +09:00
parent 2231ac4bfe
commit 0a9aee58e0
9 changed files with 83 additions and 25 deletions
+4 -1
View File
@@ -48,7 +48,10 @@ export function withApiHandler<P = Record<string, never>>(
error: String(error),
duration: Date.now() - t0,
});
throw error;
return NextResponse.json(
{ message: "Internal server error" },
{ status: 500 }
);
}
};
}
+2 -2
View File
@@ -22,7 +22,7 @@ const extensionRequestSearchSchema = z.object({
q: z.string().trim().catch(""),
status: z
.union([z.literal("all"), z.coerce.number().int().min(0)])
.optional()
.default(REQUEST_STATUSES.REQUESTED)
.catch(REQUEST_STATUSES.REQUESTED),
});
@@ -53,7 +53,7 @@ export type ExtensionRequestListResult = {
totalCount: number;
totalPages: number;
q: string;
status?: number | "all";
status: number | "all";
};
export async function getExtensionRequests(
+15 -14
View File
@@ -207,20 +207,21 @@ export async function updateMaestro(
}
if (payload.availableActivateDateTime !== undefined) {
const newDate = new Date(payload.availableActivateDateTime);
if (!isNaN(newDate.getTime())) {
const prevMin = Math.floor(
maestro.AvailableActivateDateTime.getTime() / 60000
);
const newMin = Math.floor(newDate.getTime() / 60000);
if (prevMin !== newMin) {
updates.AvailableActivateDateTime = newDate;
const prevStr = formatDate(maestro.AvailableActivateDateTime);
const newStr = formatDate(newDate);
logs.push({
type: "update_maestro_available_date",
remark: `${prevStr} -> ${newStr}`,
});
}
if (isNaN(newDate.getTime())) {
throw new ApiError("유효하지 않은 날짜 형식입니다.", 400);
}
const prevMin = Math.floor(
maestro.AvailableActivateDateTime.getTime() / 60000
);
const newMin = Math.floor(newDate.getTime() / 60000);
if (prevMin !== newMin) {
updates.AvailableActivateDateTime = newDate;
const prevStr = formatDate(maestro.AvailableActivateDateTime);
const newStr = formatDate(newDate);
logs.push({
type: "update_maestro_available_date",
remark: `${prevStr} -> ${newStr}`,
});
}
}
if (
+2 -2
View File
@@ -25,7 +25,7 @@ const upgradeRequestSearchSchema = z.object({
q: z.string().trim().catch(""),
status: z
.union([z.literal("all"), z.coerce.number().int().min(0)])
.optional()
.default(REQUEST_STATUSES.REQUESTED)
.catch(REQUEST_STATUSES.REQUESTED),
});
@@ -57,7 +57,7 @@ export type UpgradeRequestListResult = {
totalCount: number;
totalPages: number;
q: string;
status?: number | "all";
status: number | "all";
};
export async function getUpgradeRequests(