This commit is contained in:
parent
87acb829fe
commit
dc358e21dc
@ -42,6 +42,15 @@ router.route("/newest/:count")
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.route("/filter/:term")
|
||||||
|
.get(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||||
|
process.stdout.write("router/album GET filter by term " + req.params.term + "\n");
|
||||||
|
database.albums.filter(req.params.term, result => {
|
||||||
|
process.stdout.write("router/album GET filter by term " + req.params.term + " DB result\n");
|
||||||
|
res.json(result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
router.route("/:id")
|
router.route("/:id")
|
||||||
.get(checkGuest, (req, res) => {
|
.get(checkGuest, (req, res) => {
|
||||||
process.stdout.write("router/album GET album by id " + req.params.id + "\n");
|
process.stdout.write("router/album GET album by id " + req.params.id + "\n");
|
||||||
@ -61,15 +70,6 @@ router.route("/:id")
|
|||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
router.route("/filter/:term")
|
|
||||||
.get(passport.authenticate("jwt", { session: false }), (req, res) => {
|
|
||||||
process.stdout.write("router/album GET filter by term " + req.params.term + "\n");
|
|
||||||
database.albums.filter(req.params.term, result => {
|
|
||||||
process.stdout.write("router/album GET filter by term " + req.params.term + " DB result\n");
|
|
||||||
res.json(result);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
router.route("/:id/cover")
|
router.route("/:id/cover")
|
||||||
.put(passport.authenticate("jwt", { session: false }), (req, res) => {
|
.put(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||||
if (req.files) {
|
if (req.files) {
|
||||||
@ -116,4 +116,20 @@ router.route("/:id/move")
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.route("/:id/share")
|
||||||
|
.post(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||||
|
database.albums.byId(req.body.source, undefined, (result) => {
|
||||||
|
if (result != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||||
|
process.write("Add shared abum");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.delete(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||||
|
database.albums.byId(req.body.source, undefined, (result) => {
|
||||||
|
if (result != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||||
|
process.write("Delete shared abum");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
Loading…
Reference in New Issue
Block a user