erp_be/src/modules/masters/document-series/document-series.validation.js

23 lines
812 B
JavaScript

const Joi = require('joi');
const { masterCode, listQuerySchema, exportQuerySchema } = require('../_shared/masters.validation');
const createSchema = Joi.object({
code: masterCode({ max: 30 }),
prefix: masterCode({ max: 30 }),
current_number: Joi.number().integer().optional(),
padding: Joi.number().integer().optional(),
description: Joi.string().allow('').optional(),
is_active: Joi.boolean().optional(),
});
const updateSchema = Joi.object({
code: masterCode({ max: 30 }),
prefix: masterCode({ max: 30 }),
current_number: Joi.number().integer().optional(),
padding: Joi.number().integer().optional(),
description: Joi.string().allow('').optional(),
is_active: Joi.boolean().optional(),
}).min(1);
module.exports = { createSchema, updateSchema, listQuerySchema, exportQuerySchema };