//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)){
if (updatedBoat===undefined){
//return after updating
returnres.status(200).json({
success:true,
result:{
id:givenId,
name:findBoatInfo.name,
boattype:findBoatInfo.boattype,
status:findBoatInfo.status,
tags:findBoatInfo.tags,
minP:findBoatInfo.minP,
maxP:findBoatInfo.maxP,
name:foundBoat.name,
boattype:foundBoat.boattype,
status:foundBoat.status,
tags:foundBoat.tags,
minP:foundBoat.minP,
maxP:foundBoat.maxP,
sports:listOfNames,
},
});
}
//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