refactor: download project file

This commit is contained in:
Carlos Valente
2024-05-10 20:14:56 +02:00
committed by Carlos Valente
parent 6f80de58ca
commit 00f04fb78c
8 changed files with 263 additions and 81 deletions
@@ -104,3 +104,19 @@ export const validateProjectRename = [
next();
},
];
/**
* @description Validates a download request which can include an optional project name.
*/
export const validateDownloadProject = [
body('fileName').isString().optional(),
(req: Request, res: Response, next: NextFunction) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(422).json({ errors: errors.array() });
}
next();
},
];