diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-14 05:28:01 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-14 05:28:01 +0000 |
| commit | 675b4e3d8ffcb57a041db285417d81e61284d900 (patch) | |
| tree | 254f3d6a6c0ce39ae8fba35618f3810e08945f19 /lib/rfq-last/vendor-response/validations.ts | |
| parent | 39f12cb19f29cbc5568057e154e6adf4789ae736 (diff) | |
(대표님) RFQ-last, tbe-last, 기본계약 템플릿 내 견적,입찰,계약 추가, env.dev NAS_PATH 수정
Diffstat (limited to 'lib/rfq-last/vendor-response/validations.ts')
| -rw-r--r-- | lib/rfq-last/vendor-response/validations.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/rfq-last/vendor-response/validations.ts b/lib/rfq-last/vendor-response/validations.ts new file mode 100644 index 00000000..033154c2 --- /dev/null +++ b/lib/rfq-last/vendor-response/validations.ts @@ -0,0 +1,42 @@ +import { createSearchParamsCache, + parseAsArrayOf, + parseAsInteger, + parseAsString, + parseAsStringEnum,parseAsBoolean +} from "nuqs/server" +import * as z from "zod" + +import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers" +import { RfqsLastView } from "@/db/schema"; + + + +export const searchParamsVendorRfqCache = createSearchParamsCache({ + flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault([]), + page: parseAsInteger.withDefault(1), + perPage: parseAsInteger.withDefault(10), + sort: getSortingStateParser<RfqsLastView>().withDefault([ + { id: "updatedAt", desc: true }, + ]), + + // 고급 필터 + filters: getFiltersStateParser().withDefault([]), + joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), + + search: parseAsString.withDefault(""), + from: parseAsString.withDefault(""), + to: parseAsString.withDefault(""), +}); + +export type GetQuotationsLastSchema = Awaited<ReturnType<typeof searchParamsVendorRfqCache.parse>>; + +// 참여 여부 업데이트 스키마 +export const updateParticipationSchema = z.object({ + rfqId: z.number(), + rfqLastDetailsId: z.number(), + participationStatus: z.enum(["참여", "불참"]), + nonParticipationReason: z.string().optional(), +}) + + +export type UpdateParticipationSchema = z.infer<typeof updateParticipationSchema>; |
