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

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)
}
}