From 5233996e9bd676ce763a12e58c7955c7ca8f26c5 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 5 Dec 2025 06:39:23 +0000 Subject: (임수민) 실사 결과 첨부파일 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendor-investigation/service.ts | 3 +++ lib/vendor-investigation/validations.ts | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/vendor-investigation/service.ts b/lib/vendor-investigation/service.ts index cf37ad06..5e53d0dd 100644 --- a/lib/vendor-investigation/service.ts +++ b/lib/vendor-investigation/service.ts @@ -339,6 +339,9 @@ export async function updateVendorInvestigationResultAction(formData: FormData) processedEntries.investigationNotes = textEntries.investigationNotes } + // attachments는 별도로 업로드되므로 빈 배열로 설정 + processedEntries.attachments = [] + // 3) Zod로 파싱/검증 const parsed = updateVendorInvestigationResultSchema.parse(processedEntries) diff --git a/lib/vendor-investigation/validations.ts b/lib/vendor-investigation/validations.ts index 84361ef9..29fb46cb 100644 --- a/lib/vendor-investigation/validations.ts +++ b/lib/vendor-investigation/validations.ts @@ -140,7 +140,8 @@ export const updateVendorInvestigationResultSchema = z.object({ .max(100, "평가 점수는 100점 이하여야 합니다."), evaluationResult: z.enum(["APPROVED", "SUPPLEMENT", "SUPPLEMENT_REINSPECT", "SUPPLEMENT_DOCUMENT", "REJECTED", "RESULT_SENT"]), investigationNotes: z.string().max(1000, "QM 의견은 1000자 이내로 입력해주세요.").optional(), - attachments: z.array(z.any()).min(1, "최소 1개의 첨부파일이 필요합니다."), + // attachments는 별도의 API로 업로드되므로 이 스키마에서는 optional + attachments: z.array(z.any()).optional(), }).superRefine((data, ctx) => { // 날짜 검증: 실제 실사일이 실사의뢰일보다 과거가 되지 않도록 검증 if (data.requestedAt && data.completedAt) { @@ -198,7 +199,7 @@ export const updateVendorInvestigationSchema = z.object({ .optional(), evaluationResult: z.enum(["APPROVED", "SUPPLEMENT", "SUPPLEMENT_REINSPECT", "SUPPLEMENT_DOCUMENT", "REJECTED", "RESULT_SENT"]).optional(), investigationNotes: z.string().max(1000, "QM 의견은 1000자 이내로 입력해주세요.").optional(), - attachments: z.any().optional(), // File 업로드를 위한 필드 + attachments: z.array(z.any()).min(1, "최소 1개의 첨부파일이 필요합니다."), // File 업로드 필수 }).superRefine((data, ctx) => { // 날짜 검증: 실사의뢰일(requestedAt)이 있는 경우 다른 날짜들이 실사의뢰일보다 과거가 되지 않도록 검증 if (data.requestedAt) { -- cgit v1.2.3