diff options
Diffstat (limited to 'lib/tech-vendors/validations.ts')
| -rw-r--r-- | lib/tech-vendors/validations.ts | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/lib/tech-vendors/validations.ts b/lib/tech-vendors/validations.ts index fa0d9ae3..0c850c1f 100644 --- a/lib/tech-vendors/validations.ts +++ b/lib/tech-vendors/validations.ts @@ -168,7 +168,7 @@ export const createTechVendorSchema = z .min(1, "국가 선택은 필수입니다.") .max(100, "Max length 100"), phone: z.string().max(50, "Max length 50").optional(), - website: z.string().url("유효하지 않은 URL입니다. https:// 혹은 http:// 로 시작하는 주소를 입력해주세요.").max(255).optional(), + website: z.string().max(255).optional(), files: z.any().optional(), status: z.enum(techVendors.status.enumValues).default("ACTIVE"), @@ -233,6 +233,7 @@ export const createTechVendorContactSchema = z.object({ contactPosition: z.string().max(100, "Max length 100"), contactEmail: z.string().email(), contactPhone: z.string().max(50, "Max length 50").optional(), + country: z.string().max(100, "Max length 100").optional(), isPrimary: z.boolean(), }); @@ -244,6 +245,7 @@ export const updateTechVendorContactSchema = z.object({ contactPosition: z.string().max(100, "Max length 100").optional(), contactEmail: z.string().email().optional(), contactPhone: z.string().max(50, "Max length 50").optional(), + country: z.string().max(100, "Max length 100").optional(), isPrimary: z.boolean().optional(), }); @@ -260,10 +262,56 @@ export const updateTechVendorItemSchema = z.object({ itemCode: z.string().max(100, "Max length 100"), }); +export const searchParamsRfqHistoryCache = createSearchParamsCache({ + // 공통 플래그 + flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault( + [] + ), + + // 페이징 + page: parseAsInteger.withDefault(1), + perPage: parseAsInteger.withDefault(10), + + // 정렬 (RFQ 히스토리에 맞춰) + sort: getSortingStateParser<{ + id: number; + rfqCode: string | null; + description: string | null; + projectCode: string | null; + projectName: string | null; + projectType: string | null; // 프로젝트 타입 추가 + status: string; + totalAmount: string | null; + currency: string | null; + dueDate: Date | null; + createdAt: Date; + quotationCode: string | null; + submittedAt: Date | null; + }>().withDefault([ + { id: "createdAt", desc: true }, + ]), + + // 고급 필터 + filters: getFiltersStateParser().withDefault([]), + joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), + + // 검색 키워드 + search: parseAsString.withDefault(""), + + // RFQ 히스토리 특화 필드 + rfqCode: parseAsString.withDefault(""), + description: parseAsString.withDefault(""), + projectCode: parseAsString.withDefault(""), + projectName: parseAsString.withDefault(""), + projectType: parseAsStringEnum(["SHIP", "TOP", "HULL"]), // 프로젝트 타입 필터 추가 + status: parseAsStringEnum(["DRAFT", "PUBLISHED", "EVALUATION", "AWARDED"]), +}); + // 타입 내보내기 export type GetTechVendorsSchema = Awaited<ReturnType<typeof searchParamsCache.parse>> export type GetTechVendorContactsSchema = Awaited<ReturnType<typeof searchParamsContactCache.parse>> export type GetTechVendorItemsSchema = Awaited<ReturnType<typeof searchParamsItemCache.parse>> +export type GetTechVendorRfqHistorySchema = Awaited<ReturnType<typeof searchParamsRfqHistoryCache.parse>> export type UpdateTechVendorSchema = z.infer<typeof updateTechVendorSchema> export type CreateTechVendorSchema = z.infer<typeof createTechVendorSchema> |
