fix: validation in sparepart and device

This commit is contained in:
2026-06-26 16:10:54 +07:00
parent 5112090a35
commit e5a77f2f93
5 changed files with 70 additions and 97 deletions

View File

@@ -19,6 +19,9 @@ const insertDeviceSchema = Joi.object({
listen_channel: Joi.string().max(100).required(),
listen_channel_reminder: Joi.string().max(100).allow('', null),
reminder_at: Joi.date().iso().allow('', null),
reminder_at_monthly: Joi.date().iso().allow('', null),
start_date: Joi.date().iso().allow('', null),
end_date: Joi.date().iso().allow('', null),
});
const updateDeviceSchema = Joi.object({
@@ -35,6 +38,9 @@ const updateDeviceSchema = Joi.object({
listen_channel: Joi.string().max(100),
listen_channel_reminder: Joi.string().max(100).allow('', null),
reminder_at: Joi.date().iso().allow('', null),
reminder_at_monthly: Joi.date().iso().allow('', null),
start_date: Joi.date().iso().allow('', null),
end_date: Joi.date().iso().allow('', null),
}).min(1);