summaryrefslogtreecommitdiff
path: root/lib/items/validations.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-26 04:25:47 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-26 04:25:47 +0000
commit1c1c1019b6af72771358d387a2ae70ca965cd9f9 (patch)
tree6b1204684e7b52cf7d40de37b9c58decc4fac38b /lib/items/validations.ts
parent0547ab2fe1701d84753d0e078bba718a79b07a0c (diff)
(김준회) 아이템 리스트를 자재그룹으로 변경하고 PLM 인터페이스 처리
Diffstat (limited to 'lib/items/validations.ts')
-rw-r--r--lib/items/validations.ts30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/items/validations.ts b/lib/items/validations.ts
index d299959c..14fc27b1 100644
--- a/lib/items/validations.ts
+++ b/lib/items/validations.ts
@@ -22,6 +22,14 @@ export const searchParamsCache = createSearchParamsCache({
itemCode: parseAsString.withDefault(""),
itemName: parseAsString.withDefault(""),
description: parseAsString.withDefault(""),
+ parentItemCode: parseAsString.withDefault(""),
+ itemLevel: parseAsInteger.withDefault(5),
+ deleteFlag: parseAsString.withDefault(""),
+ unitOfMeasure: parseAsString.withDefault(""),
+ steelType: parseAsString.withDefault(""),
+ gradeMaterial: parseAsString.withDefault(""),
+ changeDate: parseAsString.withDefault(""),
+ baseUnitOfMeasure: parseAsString.withDefault(""),
// advanced filter
filters: getFiltersStateParser().withDefault([]),
@@ -31,15 +39,31 @@ export const searchParamsCache = createSearchParamsCache({
})
export const createItemSchema = z.object({
- itemCode: z.string(),
- itemName: z.string(),
- description: z.string(),
+ itemCode: z.string().min(1, "아이템 코드는 필수입니다"),
+ itemName: z.string().min(1, "아이템명은 필수입니다"),
+ description: z.string().nullable().optional(),
+ parentItemCode: z.string().max(18).nullable().optional(),
+ itemLevel: z.number().int().min(1).max(5).nullable().optional(),
+ deleteFlag: z.string().max(1).nullable().optional(),
+ unitOfMeasure: z.string().max(3).nullable().optional(),
+ steelType: z.string().max(2).nullable().optional(),
+ gradeMaterial: z.string().max(50).nullable().optional(),
+ changeDate: z.string().max(8).nullable().optional(),
+ baseUnitOfMeasure: z.string().max(3).nullable().optional(),
})
export const updateItemSchema = z.object({
itemCode: z.string().optional(),
itemName: z.string().optional(),
description: z.string().optional(),
+ parentItemCode: z.string().max(18).nullable().optional(),
+ itemLevel: z.number().int().min(1).max(5).nullable().optional(),
+ deleteFlag: z.string().max(1).nullable().optional(),
+ unitOfMeasure: z.string().max(3).nullable().optional(),
+ steelType: z.string().max(2).nullable().optional(),
+ gradeMaterial: z.string().max(50).nullable().optional(),
+ changeDate: z.string().max(8).nullable().optional(),
+ baseUnitOfMeasure: z.string().max(3).nullable().optional(),
})
export type GetItemsSchema = Awaited<ReturnType<typeof searchParamsCache.parse>>