refactor(items): move workflows into use cases

This commit is contained in:
2026-06-04 22:11:40 +02:00
parent 2b908b24f6
commit 0af25417ab
9 changed files with 312 additions and 208 deletions
+33
View File
@@ -0,0 +1,33 @@
import { z } from "zod"
export const createItemSchema = z.object({
name: z.string().min(1, {
error: "Name is required",
}),
categoryId: z.string().min(1, {
error: "Category is required",
}),
stock: z.coerce.number().int().nonnegative().min(0, {
error: "Stock is required",
}),
})
export type CreateItemFormType = z.input<typeof createItemSchema>
export type CreateItemData = z.output<typeof createItemSchema>
export const updateItemSchema = createItemSchema.extend({
id: z.string().min(1, {
error: "Item is required",
}),
})
export type UpdateItemFormType = z.input<typeof updateItemSchema>
export type UpdateItemData = z.output<typeof updateItemSchema>
export const getItemByIdSchema = z.object({
id: z.string().min(1, {
error: "Item is required",
}),
})
export type GetItemByIdFormType = z.infer<typeof getItemByIdSchema>