Sharing #1

Merged
artem merged 3 commits from dev into main 2023-02-17 00:05:50 +01:00
3 changed files with 4 additions and 5 deletions
Showing only changes of commit f984acea9b - Show all commits

View File

@ -143,7 +143,8 @@ router.route("/:id/share")
let album_id = req.params.id
if (req.user.roles.indexOf("admin") > -1) {
let item = {
object_id: new ObjectId(album_id)
object_id: new ObjectId(album_id),
type: "album"
}
database.share.delete(item, () => {
res.status(200).end();

View File

@ -145,7 +145,8 @@ router.route("/:id/share")
let box_id = req.params.id
if (req.user.roles.indexOf("admin") > -1) {
let item = {
object_id: new ObjectId(box_id)
object_id: new ObjectId(box_id),
type: "box"
}
database.share.delete(item, () => {
res.status(200).end();

View File

@ -22,21 +22,18 @@ exports.byId = function (id, callback) {
if (result) {
switch (result.type) {
case "album":
console.log(result.type);
database.albums.byId(result.object_id, undefined, (album) => {
result.object = album;
cb(callback, result);
});
break;
case "box":
console.log(result.type);
database.boxes.byId(result.object_id, undefined, (box) => {
result.object = box;
cb(callback, result);
});
break;
default:
console.log(result.type);
cb(callback, result);
}
} else {