refactor(categories): move mutations into use cases
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const createCategorySchema = z.object({
|
||||
name: z
|
||||
.string()
|
||||
.min(3, {
|
||||
error: "Name is required and must be at least 3 characters long",
|
||||
})
|
||||
.nonempty("Name is required and must be at least 3 characters long"),
|
||||
})
|
||||
|
||||
export type CreateCategoryFormType = z.infer<typeof createCategorySchema>
|
||||
|
||||
export const updateCategorySchema = createCategorySchema.extend({
|
||||
id: z.string().nonempty("ID is required"),
|
||||
})
|
||||
|
||||
export type UpdateCategoryFormType = z.infer<typeof updateCategorySchema>
|
||||
Reference in New Issue
Block a user