This commit is contained in:
AntoXa PRO 2023-09-20 13:35:31 +03:00
parent 46031a5fd2
commit c12338410f
2 changed files with 1 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "axp-server",
"version": "1.4.13",
"version": "1.4.14",
"description": "My helper library",
"author": "AntoXa PRO <info@antoxa.pro>",
"homepage": "https://antoxahub.ru/antoxa/axp-server",

View File

@ -94,16 +94,3 @@ export const zodMiddle =
next(httpError)
}
}
export const validFormMiddle =
(model: IFormModel<any>) =>
(req: Request, {}: Response, next: NextFunction) => {
if (model.isValid()) {
req.body = model.obj
next()
} else {
const httpError = new HttpError({ statusCode: 400 })
httpError.errors = model.errors
next(httpError)
}
}