Sharing #1
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user