From 01cb0885a8e2fb745327a276aa1be38f44091fd3 Mon Sep 17 00:00:00 2001 From: Andrea Gueugnaut Date: Wed, 22 Jan 2025 17:30:45 +0100 Subject: [PATCH] feat(server): validate housing update inputs --- server/src/routers/protected.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/routers/protected.ts b/server/src/routers/protected.ts index a2de2f0fc..6114c9d09 100644 --- a/server/src/routers/protected.ts +++ b/server/src/routers/protected.ts @@ -74,7 +74,15 @@ router.post( validator.validate, housingController.updateList ); -router.put('/housing/:id', housingController.updateNext); +router.put( + '/housing/:id', + hasRole([UserRoles.Usual, UserRoles.Admin]), + validatorNext.validate({ + params: object({ id: schemas.id }), + body: schemas.housingUpdatePayload + }), + housingController.updateNext +); router.post( '/housing/:housingId', [param('housingId').isUUID(), ...housingController.updateValidators],