21 lines
478 B
JavaScript
21 lines
478 B
JavaScript
const Ajv = require("ajv");
|
|
const ajv = new Ajv();
|
|
|
|
// --- Schemas ---
|
|
|
|
const AuthUserSchema = {
|
|
type: 'object',
|
|
properties: {
|
|
email: { type: 'string', format: 'email' },
|
|
password: { type: 'string', minLength: 3, maxLength: 30 },
|
|
},
|
|
required: ['email', 'password'],
|
|
additionalProperties: false
|
|
};
|
|
|
|
const validateAuthUserData = ajv.compile(AuthUserSchema);
|
|
|
|
|
|
// --- Exports ---
|
|
|
|
module.exports = { validateAuthUserData, validateAuthNodeData }; |