Template-API's : create tamplate and also add the get all template and get single templates
This commit is contained in:
@@ -1,6 +1,84 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const create_template = z.object({});
|
||||
// Template Options that we need to use for validation.
|
||||
|
||||
// Ingredient Option
|
||||
const ingredientOptionSchema = z.object({
|
||||
ingrImg: z.string().url().or(z.string()),
|
||||
ingrTitle: z.string().min(1),
|
||||
ingrDes: z.string().min(1),
|
||||
});
|
||||
|
||||
// Instruction Option
|
||||
const instructionOptionSchema = z.object({
|
||||
hint: z.string().min(1),
|
||||
detail: z.string().min(1),
|
||||
});
|
||||
|
||||
// FAQ Option
|
||||
const faqOptionSchema = z.object({
|
||||
index: z.number(),
|
||||
text: z.string().min(1),
|
||||
});
|
||||
|
||||
// Tips Option
|
||||
const tipsOptionSchema = z.object({
|
||||
index: z.number(),
|
||||
text: z.string().min(1),
|
||||
});
|
||||
|
||||
// Price Option
|
||||
const priceOptionSchema = z.object({
|
||||
quantity: z.string().min(1),
|
||||
price: z.string().min(1),
|
||||
});
|
||||
|
||||
|
||||
// Create the main template schema validation
|
||||
const create_template = z.object({
|
||||
language: z.string().min(1),
|
||||
deliveryCharge: z.string().min(1),
|
||||
banner: z.object({
|
||||
isVisible: z.boolean(),
|
||||
bannerTitle: z.string().min(1),
|
||||
bannerDesc: z.string().min(1),
|
||||
bannerImage: z.string(),
|
||||
}),
|
||||
address: z.object({
|
||||
isVisible: z.boolean(),
|
||||
phoneNumber: z.string().min(1),
|
||||
shopLocation: z.string().min(1),
|
||||
shopEmail: z.string().email(),
|
||||
}),
|
||||
ingredient: z.object({
|
||||
isVisible: z.boolean(),
|
||||
options: z.array(ingredientOptionSchema).min(1),
|
||||
}),
|
||||
instruction: z.object({
|
||||
isVisible: z.boolean(),
|
||||
instBanner: z.string(),
|
||||
options: z.array(instructionOptionSchema).min(1),
|
||||
}),
|
||||
faq: z.object({
|
||||
isVisible: z.boolean(),
|
||||
options: z.array(faqOptionSchema).min(1),
|
||||
}),
|
||||
tips: z.object({
|
||||
isVisible: z.boolean(),
|
||||
tipsBanner: z.string(),
|
||||
options: z.array(tipsOptionSchema).min(1),
|
||||
}),
|
||||
priceCombo: z.object({
|
||||
isVisible: z.boolean(),
|
||||
options: z.array(priceOptionSchema).min(1),
|
||||
}),
|
||||
product: z.object({
|
||||
isVisible: z.boolean(),
|
||||
price: z.string().min(1),
|
||||
discount: z.number().min(0),
|
||||
productName: z.string().min(1),
|
||||
}),
|
||||
});
|
||||
const update_template = z.object({});
|
||||
|
||||
export const template_validations = {
|
||||
|
||||
Reference in New Issue
Block a user