From 1fa40933e1d7dedf94fc2c374738596e20e8a04d Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Wed, 1 Jun 2022 17:51:08 +0100 Subject: [PATCH] style: lint code --- .../scripts/patches/patch-stale-folder-references.ts | 2 +- .../api/v1/games/_game/_playtype/charts/router.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/src/scripts/patches/patch-stale-folder-references.ts b/server/src/scripts/patches/patch-stale-folder-references.ts index aa5c7ddb8..2daeef21f 100644 --- a/server/src/scripts/patches/patch-stale-folder-references.ts +++ b/server/src/scripts/patches/patch-stale-folder-references.ts @@ -15,7 +15,7 @@ if (require.main === module) { .map((e) => e.preferences.stats) .flat() .filter((e) => e.mode === "folder") - .map((e) => (e as ShowcaseStatFolder).folderID) as Array; + .map((e) => (e as ShowcaseStatFolder).folderID) as unknown as Array; const pertinentFolders = await db.folders.find( { diff --git a/server/src/server/router/api/v1/games/_game/_playtype/charts/router.ts b/server/src/server/router/api/v1/games/_game/_playtype/charts/router.ts index 346dbfb8f..96dd3d92c 100644 --- a/server/src/server/router/api/v1/games/_game/_playtype/charts/router.ts +++ b/server/src/server/router/api/v1/games/_game/_playtype/charts/router.ts @@ -40,14 +40,19 @@ router.get("/", async (req, res) => { if (userID === null) { return res.status(401).json({ success: false, - description: `You must be authorised as a user to use the requesterHasPlayed option.` + description: `You must be authorised as a user to use the requesterHasPlayed option.`, }); } - const playedSongs = (await db["personal-bests"].find({userID, game, playtype}, {projection: {songID: 1}})).map(e => e.songID) + const playedSongs = ( + await db["personal-bests"].find( + { userID, game, playtype }, + { projection: { songID: 1 } } + ) + ).map((e) => e.songID); if (songIDs) { - songIDs = songIDs.filter(e => playedSongs.includes(e)) + songIDs = songIDs.filter((e) => playedSongs.includes(e)); } else { songIDs = playedSongs; } @@ -59,6 +64,7 @@ router.get("/", async (req, res) => { let charts = await FindChartsOnPopularity( game, playtype, + // if empty, we want the set of all songs. Otherwise, constrict input. songIDs, skip,