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 let album_id = req.params.id
if (req.user.roles.indexOf("admin") > -1) { if (req.user.roles.indexOf("admin") > -1) {
let item = { let item = {
object_id: new ObjectId(album_id) object_id: new ObjectId(album_id),
type: "album"
} }
database.share.delete(item, () => { database.share.delete(item, () => {
res.status(200).end(); res.status(200).end();

View File

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

View File

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