Skip to content
Snippets Groups Projects
Commit fbb3853a authored by elit04's avatar elit04
Browse files

error response codes

parent bb13fb92
No related branches found
No related tags found
No related merge requests found
...@@ -250,7 +250,7 @@ const updateBoatById = async (req: Request, res: Response) => { ...@@ -250,7 +250,7 @@ const updateBoatById = async (req: Request, res: Response) => {
if (!(checkBoatName === null)) { if (!(checkBoatName === null)) {
return res return res
.status(404) .status(409)
.json({ success: false, error: "boatNameAlreadyExists" }); .json({ success: false, error: "boatNameAlreadyExists" });
} }
} }
...@@ -337,7 +337,7 @@ const updateBoatById = async (req: Request, res: Response) => { ...@@ -337,7 +337,7 @@ const updateBoatById = async (req: Request, res: Response) => {
if (check === false) { if (check === false) {
return res return res
.status(404) .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 //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++) { for (let i = 0; i < listIfFound.length; i++) {
......
...@@ -20,7 +20,7 @@ const createBoatTypeController = async (req: Request, res: Response) => { ...@@ -20,7 +20,7 @@ const createBoatTypeController = async (req: Request, res: Response) => {
if (findIfBoatTypeExists) { if (findIfBoatTypeExists) {
return res return res
.status(404) .status(409)
.json({ success: false, error: "boatTypeAlreadyExists" }); .json({ success: false, error: "boatTypeAlreadyExists" });
} }
...@@ -153,7 +153,7 @@ const updateBoatTypeById = async (req: Request, res: Response) => { ...@@ -153,7 +153,7 @@ const updateBoatTypeById = async (req: Request, res: Response) => {
}); });
if (!(checkIfNameExists === null)) { if (!(checkIfNameExists === null)) {
return res return res
.status(404) .status(409)
.json({ success: false, error: "boatTypeAlreadyExists" }); .json({ success: false, error: "boatTypeAlreadyExists" });
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment