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