diff --git a/server/src/controllers/boat.controllers.ts b/server/src/controllers/boat.controllers.ts index 1390153c6860bb4fbe1e29c15653d96a123d95f4..01063672bffc30c3da7e79a53d4f221332b15505 100644 --- a/server/src/controllers/boat.controllers.ts +++ b/server/src/controllers/boat.controllers.ts @@ -51,7 +51,6 @@ const createBoat = async (req: Request, res: Response) => { //if there is a sport, which isn't in the database, we return an array with the names of the missing sports if (check === false) { - console.log("list", listIfNotFound); return res.status(404).json({ success: false, error: "The SportIDs: " + listIfNotFound + " cannotBeFound", @@ -265,7 +264,6 @@ const updateBoatById = async (req: Request, res: Response) => { //if the updated-to-be sportid(sportids) doesn't exist if (check === false) { - console.log("list", listIfNotFound); return res .status(404) .json({ success: false, error: listIfNotFound + " sportIdNotFound" }); @@ -295,7 +293,8 @@ const updateBoatById = async (req: Request, res: Response) => { }); //we need this special case res, because sports is not an attribute assigned to Boat table, and if only sports provided as request body error happens - if (updatedBoat === undefined) { + // check if in the requested body only values for sports were provided + if (Object.keys(input).length === 1 && !(input.sports === undefined)) { //return after updating return res.status(200).json({ success: true, @@ -314,7 +313,6 @@ const updateBoatById = async (req: Request, res: Response) => { //case where in request body attributes from Boat provided + sports which is an attribute in Sport table and connection between Boat and Sport is saved in BoatHasSport table const boatDataAfterUpdate = updatedBoat[1][0]; - console.log("boatDataAfterUpdate ", boatDataAfterUpdate); return res.status(200).json({ success: true, result: {