// ======================== // Notification Validation // ======================== const Joi = require("joi"); // ======================== // Insert Notification Schema // ======================== const insertNotificationSchema = Joi.object({ error_code_id: Joi.number().required().messages({ "any.required": "error_code_id is required", "number.base": "error_code_id must be a number", }), message_error_issue: Joi.string().max(255).optional(), is_send: Joi.boolean().required().messages({ "any.required": "is_send is required", "boolean.base": "is_send must be a boolean", }), is_delivered: Joi.boolean().required().messages({ "any.required": "is_delivered is required", "boolean.base": "is_delivered must be a boolean", }), is_read: Joi.boolean().required().messages({ "any.required": "is_read is required", "boolean.base": "is_read must be a boolean", }), is_active: Joi.boolean().required().messages({ "any.required": "is_active is required", "boolean.base": "is_active must be a boolean", }), }); // ======================== // Update Notification Schema // ======================== const updateNotificationSchema = Joi.object({ is_send: Joi.boolean().optional().messages({ "boolean.base": "is_send must be a boolean", }), is_delivered: Joi.boolean().optional().messages({ "boolean.base": "is_delivered must be a boolean", }), is_read: Joi.boolean().optional().messages({ "boolean.base": "is_read must be a boolean", }), is_active: Joi.boolean().optional().messages({ "boolean.base": "is_active must be a boolean", }), }); module.exports = { insertNotificationSchema, updateNotificationSchema, };