diff --git a/server/src/routes/boatRoutes.routes.ts b/server/src/routes/boatRoutes.routes.ts index a6902d1b1bafbb93df9f28cb8af8b5b9b27f8532..e5d1f2e42d1806acf4f0ad6b937c07781fe17ef8 100644 --- a/server/src/routes/boatRoutes.routes.ts +++ b/server/src/routes/boatRoutes.routes.ts @@ -25,7 +25,7 @@ boatsRouter.post( body("name").not().isEmpty(), body("boattype").not().isEmpty(), body("status").not().isEmpty() && body("status").isIn([1, 0]), - body("tags").not().isEmpty() && body("tags").isArray(), + body("tags").if(body("tags").exists()).isArray(), //optional tags field handleValidationResult, validateToken, boatControllers.createBoat @@ -37,7 +37,7 @@ boatsRouter.patch( body("name").if(body("name").exists()).not().isEmpty(), body("boattype").if(body("boattype").exists()).not().isEmpty(), body("status").if(body("status").exists()).not().isEmpty().isIn([1, 0]), - body("tags").if(body("tags").exists()).not().isEmpty().isArray(), + body("tags").if(body("tags").exists()).isArray(), handleValidationResult, validateToken, boatControllers.updateBoatById