From 1bc2b35ec02653de67552e940ba96190d26c6b0d Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 23 Oct 2024 16:08:26 +0100 Subject: [PATCH] lookup beat saver map hash inside the versions not the _id --- projects/backend/src/service/beatsaver.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/backend/src/service/beatsaver.service.ts b/projects/backend/src/service/beatsaver.service.ts index 2ef9267..de7cbbf 100644 --- a/projects/backend/src/service/beatsaver.service.ts +++ b/projects/backend/src/service/beatsaver.service.ts @@ -6,11 +6,12 @@ export default class BeatSaverService { * Gets a map by its hash, updates if necessary, or inserts if not found. * * @param hash the hash of the map - * @returns the beatsaver map or undefined if not found + * @returns the beatsaver map, or undefined if not found */ public static async getMap(hash: string): Promise { - // Try to find the existing map by its hash - let map = await BeatSaverMapModel.findById(hash); + let map = await BeatSaverMapModel.findOne({ + "versions.hash": hash.toUpperCase(), + }); if (map) { const toObject = map.toObject() as BeatSaverMap;