From 4bad21ef79fdda5f016e2012ba673d6ee6abb5fc Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 28 May 2025 17:23:13 +0000 Subject: (대표님) lib 파트 개발 0528 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendor-investigation/validations.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'lib/vendor-investigation/validations.ts') diff --git a/lib/vendor-investigation/validations.ts b/lib/vendor-investigation/validations.ts index bfe2e988..d04f100f 100644 --- a/lib/vendor-investigation/validations.ts +++ b/lib/vendor-investigation/validations.ts @@ -70,10 +70,28 @@ export const updateVendorInvestigationSchema = z.object({ evaluationType: z.enum(["SITE_AUDIT", "QM_SELF_AUDIT"]).optional(), investigationAddress: z.string().optional(), investigationMethod: z.string().max(100, "실사 방법은 100자 이내로 입력해주세요.").optional(), - forecastedAt: z.date().optional(), - requestedAt: z.date().optional(), - confirmedAt: z.date().optional(), - completedAt: z.date().optional(), + + // 날짜 필드들을 string에서 Date로 변환하도록 수정 + forecastedAt: z.union([ + z.date(), + z.string().transform((str) => str ? new Date(str) : undefined) + ]).optional(), + + requestedAt: z.union([ + z.date(), + z.string().transform((str) => str ? new Date(str) : undefined) + ]).optional(), + + confirmedAt: z.union([ + z.date(), + z.string().transform((str) => str ? new Date(str) : undefined) + ]).optional(), + + completedAt: z.union([ + z.date(), + z.string().transform((str) => str ? new Date(str) : undefined) + ]).optional(), + evaluationScore: z.number() .int("평가 점수는 정수여야 합니다.") .min(0, "평가 점수는 0점 이상이어야 합니다.") @@ -84,4 +102,4 @@ export const updateVendorInvestigationSchema = z.object({ attachments: z.any().optional(), // File 업로드를 위한 필드 }) -export type UpdateVendorInvestigationSchema = z.infer +export type UpdateVendorInvestigationSchema = z.infer \ No newline at end of file -- cgit v1.2.3