Update bcryptjs to version 3.0.3 and add smoke-tracker router to the server configuration.

This commit is contained in:
Primakov Alexandr Alexandrovich
2025-11-17 13:25:20 +03:00
parent 4c166a8d33
commit f6f9163c3f
15 changed files with 1230 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
const requiredValidate =
(...fields) =>
(req, res, next) => {
const errors = []
fields.forEach((field) => {
if (!req.body[field]) {
errors.push(field)
}
})
if (errors.length) {
throw new Error(`Не все поля заполнены: ${errors.join(', ')}`)
} else {
next()
}
}
module.exports.requiredValidate = requiredValidate