add cover to shared items
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -120,14 +120,15 @@ router.route("/:id/share")
|
||||
.post(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||
let album_id = req.params.id
|
||||
process.stdout.write("router/album POST albums share " + album_id + "\n");
|
||||
database.albums.byId(album_id, undefined, (result) => {
|
||||
if (result != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||
database.albums.byId(album_id, undefined, (album) => {
|
||||
if (album != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||
database.share.exists(album_id, result => {
|
||||
if (result == null) {
|
||||
let item = {
|
||||
user_id: req.user._id,
|
||||
object_id: new ObjectId(album_id),
|
||||
type: "album"
|
||||
type: "album",
|
||||
cover: album.covers.cover32
|
||||
}
|
||||
database.share.add(item, (result) => {
|
||||
res.json(result).status(200).end();
|
||||
|
||||
@@ -122,14 +122,15 @@ router.route("/:id/share")
|
||||
.post(passport.authenticate("jwt", { session: false }), (req, res) => {
|
||||
let box_id = req.params.id
|
||||
process.stdout.write("router/box POST box share " + box_id + "\n");
|
||||
database.boxes.byId(box_id, undefined, (result) => {
|
||||
if (result != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||
database.boxes.byId(box_id, undefined, (box) => {
|
||||
if (box != undefined && req.user.roles.indexOf("admin") > -1) {
|
||||
database.share.exists(box_id, result => {
|
||||
if (result == null) {
|
||||
let item = {
|
||||
user_id: req.user._id,
|
||||
object_id: new ObjectId(box_id),
|
||||
type: "box"
|
||||
type: "box",
|
||||
cover: box.covers.cover32
|
||||
}
|
||||
database.share.add(item, (result) => {
|
||||
res.json(result).status(200).end();
|
||||
|
||||
Reference in New Issue
Block a user