diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-28 17:23:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-28 17:23:13 +0000 |
| commit | 4bad21ef79fdda5f016e2012ba673d6ee6abb5fc (patch) | |
| tree | 4a02504cc1e983d7bacdc01442df44f35865b37d /lib/vendor-investigation/validations.ts | |
| parent | 36dd60ca6fce7712b35e6d7c1b9602710f442ada (diff) | |
(대표님) lib 파트 개발 0528
Diffstat (limited to 'lib/vendor-investigation/validations.ts')
| -rw-r--r-- | lib/vendor-investigation/validations.ts | 28 |
1 files changed, 23 insertions, 5 deletions
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<typeof updateVendorInvestigationSchema> +export type UpdateVendorInvestigationSchema = z.infer<typeof updateVendorInvestigationSchema>
\ No newline at end of file |
