summaryrefslogtreecommitdiff
path: root/lib/items/validations.ts
diff options
context:
space:
mode:
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>>