feat: Several project files user folder (Steps 3-5) (#664)

* feat: steps 3-5 for several project files user folder

* feat: common types, better listing function

* feat: error response type
This commit is contained in:
Ary
2023-12-28 09:23:51 -03:00
committed by GitHub
parent d1e201ebb5
commit dc4ba4012c
6 changed files with 106 additions and 3 deletions
@@ -152,3 +152,17 @@ export const validatePatchProjectFile = [
next();
},
];
/**
* @description Validates the filename for loading a project file.
*/
export const validateLoadProjectFile = [
body('filename').exists().withMessage('Filename is required').isString().withMessage('Filename must be a string'),
(req, res, next) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(422).json({ errors: errors.array() });
}
next();
},
];