summaryrefslogtreecommitdiff
path: root/lib/items-ship/validations.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-14 06:12:13 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-14 06:12:13 +0000
commitd0d2eaa2de58a0c33e9a21604b126961403cd69e (patch)
treef66cd3c8d3a123ff04f800b4b868c573fab2da95 /lib/items-ship/validations.ts
parent21d8148fc5b1234cd4523e66ccaa8971ad104560 (diff)
(최겸) 기술영업 조선, 해양Top, 해양 Hull 아이템 리스트 개발(CRUD, excel import/export/template)
Diffstat (limited to 'lib/items-ship/validations.ts')
-rw-r--r--lib/items-ship/validations.ts88
1 files changed, 0 insertions, 88 deletions
diff --git a/lib/items-ship/validations.ts b/lib/items-ship/validations.ts
deleted file mode 100644
index cb297f99..00000000
--- a/lib/items-ship/validations.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import {
- createSearchParamsCache,
- parseAsArrayOf,
- parseAsInteger,
- parseAsString,
- parseAsStringEnum,
-} from "nuqs/server"
-import * as z from "zod"
-
-import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers"
-import { Item } from "@/db/schema/items";
-
-export const searchParamsCache = createSearchParamsCache({
- flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault(
- []
- ),
- page: parseAsInteger.withDefault(1),
- perPage: parseAsInteger.withDefault(10),
- sort: getSortingStateParser<Item>().withDefault([
- { id: "createdAt", desc: true },
- ]),
- itemCode: parseAsString.withDefault(""),
- itemName: parseAsString.withDefault(""),
- description: parseAsString.withDefault(""),
-
- // advanced filter
- filters: getFiltersStateParser().withDefault([]),
- joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"),
- search: parseAsString.withDefault(""),
-
-})
-
-export const createItemSchema = z.object({
- itemCode: z.string(),
- itemName: z.string(),
- description: z.string(),
-})
-
-export const updateItemSchema = z.object({
- itemCode: z.string(),
- itemName: z.string().optional(),
- description: z.string().optional(),
-})
-
-// 조선 아이템 업데이트 스키마
-export const updateShipbuildingItemSchema = z.object({
- itemCode: z.string(),
- itemName: z.string().optional(),
- description: z.string().optional(),
- workType: z.string().optional(),
- shipTypes: z.string().optional(),
-})
-
-
-export type GetItemsSchema = Awaited<ReturnType<typeof searchParamsCache.parse>>
-export type CreateItemSchema = z.infer<typeof createItemSchema>
-export type UpdateItemSchema = z.infer<typeof updateItemSchema>
-export type UpdateShipbuildingItemSchema = z.infer<typeof updateShipbuildingItemSchema>
-
-// 조선 아이템 스키마
-export const createShipbuildingItemSchema = z.object({
- itemCode: z.string(),
- itemName: z.string(),
- description: z.string(),
- workType: z.string(),
- shipTypes: z.string(),
-})
-
-
-export type CreateShipbuildingItemSchema = z.infer<typeof createShipbuildingItemSchema>
-
-// 기본 아이템 생성 데이터 타입
-export interface ItemCreateData {
- itemCode: string
- itemName: string
- description: string | null
-}
-
-
-// 조선 아이템 생성 데이터 타입
-export interface ShipbuildingItemCreateData extends ItemCreateData {
- workType: string | null
- shipTypes: string | null
-}
-
-// 아이템 타입에 따른 생성 데이터 타입
-export type TypedItemCreateData = ShipbuildingItemCreateData
-