diff options
Diffstat (limited to 'lib/b-rfq/validations.ts')
| -rw-r--r-- | lib/b-rfq/validations.ts | 69 |
1 files changed, 68 insertions, 1 deletions
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<typeof createRfqServerSchema>
\ No newline at end of file + export type CreateRfqInput = z.infer<typeof createRfqServerSchema> + + + + 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<RfqAttachment>().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<ReturnType<typeof searchParamsRfqAttachmentsCache.parse>> + + + // 첨부파일 레코드 타입 +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<typeof attachmentRecordSchema> + +export const deleteAttachmentsSchema = z.object({ + ids: z.array(z.number()).min(1, "삭제할 첨부파일을 선택해주세요."), +}) + +export type DeleteAttachmentsInput = z.infer<typeof deleteAttachmentsSchema> |
