clean up more
This commit is contained in:
+2
-1
@@ -120,8 +120,9 @@ app.post('/box/item/:itemId/:boxIdTarget', async (request, response) => {
|
|||||||
//the way I am doing this cannot be the best way...fix me later
|
//the way I am doing this cannot be the best way...fix me later
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//get item in source box
|
//find source box
|
||||||
const box = await Box.find({ "item._id": itemID });
|
const box = await Box.find({ "item._id": itemID });
|
||||||
|
//get item in source box
|
||||||
const item = await Box.find({ "item._id": itemID }, { item: { $elemMatch: { _id: itemID } } });
|
const item = await Box.find({ "item._id": itemID }, { item: { $elemMatch: { _id: itemID } } });
|
||||||
//remove item from source box
|
//remove item from source box
|
||||||
await Box.updateOne({ _id: box[0]._id }, { $pull: { item: { _id: itemID } } });
|
await Box.updateOne({ _id: box[0]._id }, { $pull: { item: { _id: itemID } } });
|
||||||
|
|||||||
Reference in New Issue
Block a user