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

color attribute forgotten

parent 25123cff
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,7 @@ const showAllSports = async (req: Request, res: Response) => {
return res.status(200).send({
success: true,
result: allSports.map((Sport) => {
return { id: Sport.id, name: Sport.name };
return { id: Sport.id, name: Sport.name, color: Sport.color };
}),
});
} catch (error) {
......@@ -97,6 +97,7 @@ const deleteSportById = async (req: Request, res: Response) => {
},
});
//then destroy entry in Sport table
const sportToDelete = await Sport.destroy({
where: {
id: givenId,
......@@ -241,6 +242,7 @@ const showSportByBoatId = async (req: Request, res: Response) => {
}
};
// is this controller needed?
const showSportBySportId = async (req: Request, res: Response) => {
try {
if (!(res.locals.user.role === "coordinator")) {
......
......@@ -17,7 +17,7 @@ sportRouter.get(
sportRouter.post(
"/api/sport/",
body("name").not().isEmpty(),
body("color").if(body("color").exists()).not().isEmpty(), //optional tags field
body("color").if(body("color").exists()).not().isEmpty(), //optional color field
handleValidationResult,
validateToken,
sportControllers.createSportController
......
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