diff --git a/router/album.js b/router/album.js index e47ea18..036ea28 100644 --- a/router/album.js +++ b/router/album.js @@ -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(); diff --git a/router/box.js b/router/box.js index 7e71b00..c9d17b3 100644 --- a/router/box.js +++ b/router/box.js @@ -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(); diff --git a/services/database/share.js b/services/database/share.js index e6569a9..86fe374 100644 --- a/services/database/share.js +++ b/services/database/share.js @@ -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 {