mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-25 13:26:22 +03:00
16 lines
343 B
JavaScript
16 lines
343 B
JavaScript
|
const Ajv = require("ajv");
|
||
|
const ajv = new Ajv();
|
||
|
const note_schema = {
|
||
|
type: "object",
|
||
|
properties: {
|
||
|
name: { type: "string", maxLength: 64 },
|
||
|
text: { type: "string", maxLength: 5000 },
|
||
|
},
|
||
|
required: ["name", "text"],
|
||
|
additionalProperties: false,
|
||
|
};
|
||
|
|
||
|
module.exports = (data) => {
|
||
|
return ajv.validate(note_schema, data);
|
||
|
};
|