From fbb3853a7b43c09f371b71a375c549da538adfa1 Mon Sep 17 00:00:00 2001 From: elit04 <elit04@fu-berlin.de> Date: Mon, 24 Jan 2022 14:49:04 -0500 Subject: [PATCH] error response codes --- server/src/controllers/boat.controllers.ts | 4 ++-- server/src/controllers/boatType.controllers.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/controllers/boat.controllers.ts b/server/src/controllers/boat.controllers.ts index e5b8504..17a578a 100644 --- a/server/src/controllers/boat.controllers.ts +++ b/server/src/controllers/boat.controllers.ts @@ -250,7 +250,7 @@ const updateBoatById = async (req: Request, res: Response) => { if (!(checkBoatName === null)) { return res - .status(404) + .status(409) .json({ success: false, error: "boatNameAlreadyExists" }); } } @@ -337,7 +337,7 @@ const updateBoatById = async (req: Request, res: Response) => { if (check === false) { return res .status(404) - .json({ success: false, error: listIfNotFound + " sportIdNotFound" }); + .json({ success: false, sports: listIfNotFound }); } //if sports Array is with valid id's, assign them to boat; create entry (boatid, each id of given sportIds) inf BoatHasSport table for (let i = 0; i < listIfFound.length; i++) { diff --git a/server/src/controllers/boatType.controllers.ts b/server/src/controllers/boatType.controllers.ts index 953ef22..ab34aab 100644 --- a/server/src/controllers/boatType.controllers.ts +++ b/server/src/controllers/boatType.controllers.ts @@ -20,7 +20,7 @@ const createBoatTypeController = async (req: Request, res: Response) => { if (findIfBoatTypeExists) { return res - .status(404) + .status(409) .json({ success: false, error: "boatTypeAlreadyExists" }); } @@ -153,7 +153,7 @@ const updateBoatTypeById = async (req: Request, res: Response) => { }); if (!(checkIfNameExists === null)) { return res - .status(404) + .status(409) .json({ success: false, error: "boatTypeAlreadyExists" }); } } -- GitLab