From c72d0897f7b37843109c86f61d97eba05ba3ca0d Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 13 Jun 2025 07:08:01 +0000 Subject: (대표님) 20250613 16시 08분 b-rfq, document 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/b-rfq/validations.ts | 69 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'lib/b-rfq/validations.ts') diff --git a/lib/b-rfq/validations.ts b/lib/b-rfq/validations.ts index df8dc6e6..df95b1d2 100644 --- a/lib/b-rfq/validations.ts +++ b/lib/b-rfq/validations.ts @@ -97,4 +97,71 @@ export const searchParamsRFQDashboardCache = createSearchParamsCache({ updatedBy: z.number(), }) - export type CreateRfqInput = z.infer \ No newline at end of file + export type CreateRfqInput = z.infer + + + + export type RfqAttachment = { + id: number + attachmentType: string + serialNo: string + rfqId: number + fileName: string + originalFileName: string + filePath: string + fileSize: number | null + fileType: string | null + description: string | null + createdBy: number + createdAt: Date + createdByName?: string + responseStats?: { + totalVendors: number + respondedCount: number + pendingCount: number + waivedCount: number + responseRate: number + } + } + + // RFQ Attachments용 검색 파라미터 캐시 + export const searchParamsRfqAttachmentsCache = createSearchParamsCache({ + flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault([]), + page: parseAsInteger.withDefault(1), + perPage: parseAsInteger.withDefault(10), + sort: getSortingStateParser().withDefault([ + { id: "createdAt", desc: true }, + ]), + // 기본 필터 + attachmentType: parseAsArrayOf(z.string()).withDefault([]), + fileType: parseAsArrayOf(z.string()).withDefault([]), + search: parseAsString.withDefault(""), + // advanced filter + filters: getFiltersStateParser().withDefault([]), + joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), + }) + + // 스키마 타입들 + export type GetRfqAttachmentsSchema = Awaited> + + + // 첨부파일 레코드 타입 +export const attachmentRecordSchema = z.object({ + rfqId: z.number().positive(), + attachmentType: z.enum(["구매", "설계"]), + // serialNo: z.string().min(1), + description: z.string().optional(), + fileName: z.string(), + originalFileName: z.string(), + filePath: z.string(), + fileSize: z.number(), + fileType: z.string(), +}) + +export type AttachmentRecord = z.infer + +export const deleteAttachmentsSchema = z.object({ + ids: z.array(z.number()).min(1, "삭제할 첨부파일을 선택해주세요."), +}) + +export type DeleteAttachmentsInput = z.infer -- cgit v1.2.3