코드 검토 및 문서 반영

This commit is contained in:
2026-07-02 22:13:38 +09:00
parent 2d9b8d0624
commit 854a3e2bfb
9 changed files with 115 additions and 97 deletions
+8 -5
View File
@@ -3,7 +3,7 @@ import { z } from "zod";
import { db } from "@/lib/db";
import { logger } from "@/lib/logger";
import { ApiError } from "@/lib/errors";
import { REQUEST_STATUSES } from "@/lib/constants";
import { PAID_ACCOUNT_TYPE_VALUES, REQUEST_STATUSES } from "@/lib/constants";
import type { Prisma } from "@/lib/generated/prisma/client";
import {
calculateExtendedAvailableDate,
@@ -158,22 +158,25 @@ export async function approveExtensionRequest(
}
export async function createExtensionRequest(
maestroID: number,
accountType: number
maestroID: number
): Promise<{ maestroExtensionID: number; requestedDateTime: string; status: number }> {
const maestro = await db.maestro.findUnique({
where: { MaestroID: maestroID },
select: { MaestroID: true },
select: { AccountType: true },
});
if (!maestro) {
throw new ApiError("마에스트로를 찾을 수 없습니다.", 404);
}
if (!(PAID_ACCOUNT_TYPE_VALUES as readonly number[]).includes(maestro.AccountType)) {
throw new ApiError("유료 요금제 계정만 연장 신청이 가능합니다.", 400);
}
const request = await db.maestro_extension.create({
data: {
MaestroID: maestroID,
AccountType: accountType,
AccountType: maestro.AccountType,
RequestedDateTime: new Date(),
Status: REQUEST_STATUSES.REQUESTED,
},