From 4aea43a8bb0162ce3bf706489a4a5351c718901c Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Fri, 17 Feb 2023 22:36:34 +0100 Subject: [PATCH] fix callback function --- router/album.js | 2 +- router/box.js | 2 +- services/database/share.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/router/album.js b/router/album.js index 76e5f53..bc66154 100644 --- a/router/album.js +++ b/router/album.js @@ -126,7 +126,7 @@ router.route("/:id/share") if (result == null) { let item = { user_id: req.user._id, - object_id: new ObjectId(album_id), + object_id: album._id, type: "album", cover: album.covers.cover32 } diff --git a/router/box.js b/router/box.js index b23707c..6be5401 100644 --- a/router/box.js +++ b/router/box.js @@ -128,7 +128,7 @@ router.route("/:id/share") if (result == null) { let item = { user_id: req.user._id, - object_id: new ObjectId(box_id), + object_id: box._id, type: "box", cover: box.covers.cover32 } diff --git a/services/database/share.js b/services/database/share.js index 4af7beb..c86d31f 100644 --- a/services/database/share.js +++ b/services/database/share.js @@ -56,7 +56,7 @@ exports.exists = function (object_id, callback) { dbo.collection("shares") .findOne({ object_id: ObjectId(object_id) }) .then(result => { - cp(callback, result); + cb(callback, result); }); } @@ -75,7 +75,7 @@ exports.add = function (item, callback) { ]) .toArray((err, result) => { if (err) throw err; - cp(callback, result[0]); + cb(callback, result[0]); }) } });