lookup beat saver map hash inside the versions not the _id
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 39s

This commit is contained in:
Lee 2024-10-23 16:08:26 +01:00
parent ed4bcc93e1
commit 1bc2b35ec0

@ -6,11 +6,12 @@ export default class BeatSaverService {
* Gets a map by its hash, updates if necessary, or inserts if not found. * Gets a map by its hash, updates if necessary, or inserts if not found.
* *
* @param hash the hash of the map * @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<BeatSaverMap | undefined> { public static async getMap(hash: string): Promise<BeatSaverMap | undefined> {
// Try to find the existing map by its hash let map = await BeatSaverMapModel.findOne({
let map = await BeatSaverMapModel.findById(hash); "versions.hash": hash.toUpperCase(),
});
if (map) { if (map) {
const toObject = map.toObject() as BeatSaverMap; const toObject = map.toObject() as BeatSaverMap;