1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import {
createSearchParamsCache,
parseAsArrayOf,
parseAsInteger,
parseAsString,
parseAsStringEnum,
} from "nuqs/server";
import * as z from "zod";
import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers";
import { incoterms } from "@/db/schema/procurementRFQ";
export const SearchParamsCache = createSearchParamsCache({
// UI 모드나 플래그 관련
flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault([]),
// 페이징
page: parseAsInteger.withDefault(1),
perPage: parseAsInteger.withDefault(10),
// 정렬 (createdAt 기준 내림차순)
sort: getSortingStateParser<typeof incoterms>().withDefault([
{ id: "createdAt", desc: true }]),
filters: getFiltersStateParser().withDefault([]),
joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"),
search: parseAsString.withDefault(""),
});
export type GetIncotermsSchema = Awaited<ReturnType<typeof SearchParamsCache.parse>>;
|