78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const navSubItemsSchema = z.object({
|
|
id: z.string().uuid(),
|
|
title: z.string(),
|
|
url: z.string(),
|
|
slug: z.string(),
|
|
icon: z.string(),
|
|
is_active: z.boolean().default(false),
|
|
order_seq: z.number().int(),
|
|
nav_item_id: z.string().uuid(),
|
|
created_at: z.date(),
|
|
updated_at: z.date(),
|
|
created_by: z.string().uuid().nullable(),
|
|
updated_by: z.string().uuid().nullable(),
|
|
});
|
|
|
|
export type NavSubItems = z.infer<typeof navSubItemsSchema>;
|
|
|
|
export const navItemsSchema = z.object({
|
|
id: z.string().uuid(),
|
|
title: z.string(),
|
|
url: z.string(),
|
|
slug: z.string(),
|
|
icon: z.string(),
|
|
is_active: z.boolean().default(false),
|
|
order_seq: z.number().int(),
|
|
created_at: z.date(),
|
|
updated_at: z.date(),
|
|
created_by: z.string().uuid().nullable(),
|
|
updated_by: z.string().uuid().nullable(),
|
|
sub_items: z.array(navSubItemsSchema),
|
|
});
|
|
|
|
export type NavItems = z.infer<typeof navItemsSchema>;
|
|
|
|
export const navItemsGetSchema = z.array(navItemsSchema);
|
|
|
|
export type NavItemsGet = z.infer<typeof navItemsGetSchema>;
|
|
|
|
export const navItemsInsertSchema = navItemsSchema.pick({
|
|
title: true,
|
|
url: true,
|
|
slug: true,
|
|
icon: true,
|
|
is_active: true,
|
|
order_seq: true,
|
|
sub_items: true,
|
|
});
|
|
|
|
export type NavItemsInsert = z.infer<typeof navItemsInsertSchema>;
|
|
|
|
export const navItemsUpdateSchema = navItemsSchema.pick({
|
|
title: true,
|
|
url: true,
|
|
slug: true,
|
|
icon: true,
|
|
is_active: true,
|
|
order_seq: true,
|
|
sub_items: true,
|
|
});
|
|
|
|
export type NavItemsUpdate = z.infer<typeof navItemsUpdateSchema>;
|
|
|
|
export const navItemsDeleteSchema = z.object({
|
|
id: z.string().uuid(),
|
|
});
|
|
|
|
export type NavItemsDelete = z.infer<typeof navItemsDeleteSchema>;
|
|
|
|
export interface NavItemsResponse {
|
|
success: boolean;
|
|
message?: string;
|
|
error?: string;
|
|
errors?: Record<string, string>;
|
|
data?: NavItems | NavItemsGet;
|
|
}
|