👌 IMPROVE: GET /admin/functions/:slug
This commit is contained in:
		| @@ -63,10 +63,10 @@ exports.getFunctions = (req, res, next) => { | ||||
|         }); | ||||
| } | ||||
|  | ||||
| exports.getFunctionById = (req, res, next) => { | ||||
|     const { id } = req.params; | ||||
| exports.getFunctionBySlug = (req, res, next) => { | ||||
|     const { slug } = req.params; | ||||
|     Functions.findOne({  | ||||
|         where: { id }, | ||||
|         where: { slug }, | ||||
|         include: [ | ||||
|             { model: Categories, attributes: ["name", "color"] } | ||||
|         ] | ||||
|   | ||||
| @@ -95,10 +95,12 @@ AdminRouter.route('/functions') | ||||
|             }) | ||||
|     ], adminController.postFunction); | ||||
|  | ||||
| AdminRouter.route('/functions/:id') | ||||
| AdminRouter.route('/functions/:slug') | ||||
|  | ||||
|     // Récupère les informations d'une fonction | ||||
|     .get(isAuth, isAdmin, adminController.getFunctionById) | ||||
|     .get(isAuth, isAdmin, adminController.getFunctionBySlug); | ||||
|  | ||||
| AdminRouter.route('/functions/:id') | ||||
|  | ||||
|     // Modifie information basique d'une fonction | ||||
|     .put(isAuth, isAdmin,  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user