Skip to content

Commit

Permalink
fix: added a find-step to check what is trying to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Aug 29, 2024
1 parent ff16362 commit 1ad4f50
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/api/manager/inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ export async function getAudioMapping(id: ObjectId): Promise<IResponse> {

export async function deleteInventorySourceItem(id: string): Promise<void> {
const db = await getDatabase();
// Information sent to db:
console.log('DB', { _id: { $eq: new ObjectId(id) } });

await db
const document = await db
.collection('inventory')
.deleteOne({ _id: { $eq: new ObjectId(id) } });
.findOne({ _id: new ObjectId(id) });
console.log('DB dokument', document);
if (!document) {
console.log('Document not found');
}

await db.collection('inventory').deleteOne({ _id: new ObjectId(id) });
Log().info('Deleted source', id);
}

0 comments on commit 1ad4f50

Please sign in to comment.