added dummy share api
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij 2023-02-15 12:57:00 +01:00
parent 87acb829fe
commit dc358e21dc

View File

@ -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")
.get(checkGuest, (req, res) => {
process.stdout.write("router/album GET album by id " + req.params.id + "\n");
@ -61,15 +70,6 @@ router.route("/:id")
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")
.put(passport.authenticate("jwt", { session: false }), (req, res) => {
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;