체험 계정도 연장 승인되도록 수정

This commit is contained in:
2026-09-06 11:46:33 +09:00
parent 00d7659812
commit 56e4c0c29b
4 changed files with 20 additions and 17 deletions
+17 -9
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 { ACTIVATE_STATUSES, PAID_ACCOUNT_TYPE_VALUES, REQUEST_STATUSES } from "@/lib/constants";
import { ACTIVATE_STATUSES, REQUEST_STATUSES } from "@/lib/constants";
import type { Prisma } from "@/lib/generated/prisma/client";
import {
calculateExtendedAvailableDate,
@@ -145,8 +145,14 @@ export async function approveExtensionRequest(
},
});
if (request!.maestro.ActivateStatus !== ACTIVATE_STATUSES.ACTIVE) {
throw new ApiError("활성화된 계정만 연장 승인이 가능합니다.", 409);
if (
request!.maestro.ActivateStatus !== ACTIVATE_STATUSES.ACTIVE &&
request!.maestro.ActivateStatus !== ACTIVATE_STATUSES.TRIAL
) {
throw new ApiError(
"활성화 또는 체험 계정만 연장 승인이 가능합니다.",
409
);
}
const availableActivateDateTime = calculateExtendedAvailableDate(
@@ -200,12 +206,14 @@ export async function createExtensionRequest(
throw new ApiError("마에스트로를 찾을 수 없습니다.", 404);
}
if (!(PAID_ACCOUNT_TYPE_VALUES as readonly number[]).includes(maestro.AccountType)) {
throw new ApiError("유료 요금제 계정만 연장 신청이 가능합니다.", 400);
}
if (maestro.ActivateStatus !== ACTIVATE_STATUSES.ACTIVE) {
throw new ApiError("활성화된 계정만 연장 신청이 가능합니다.", 400);
if (
maestro.ActivateStatus !== ACTIVATE_STATUSES.ACTIVE &&
maestro.ActivateStatus !== ACTIVATE_STATUSES.TRIAL
) {
throw new ApiError(
"활성화 또는 체험 계정만 연장 신청이 가능합니다.",
400
);
}
const request = await tx.maestro_extension.create({