clean up match code, remove old endpoints

This commit is contained in:
Devin Zuczek
2026-07-24 14:19:08 -04:00
parent cfc29cb175
commit 5ed9e765a5
7 changed files with 239 additions and 450 deletions
+3 -4
View File
@@ -28,14 +28,13 @@ export async function parseFormIds(c: Context<App>): Promise<number[]> {
.filter((n) => !Number.isNaN(n))
}
/** Read integer ids from repeated/comma-separated `id` query params. The 2023
* client passes these to the bulk GET endpoints (e.g. `?id=1&id=2`). */
/** Read integer ids from repeated `id` query params. The 2023 client passes these to
* the bulk GET endpoints as one value per id (`?id=1&id=2`), never comma-separated. */
export function queryIds(c: Context<App>): number[] {
return (
c.req
.queries('id')
?.flatMap((v) => v.split(','))
.map((s) => Number.parseInt(s.trim(), 10))
?.map((s) => Number.parseInt(s.trim(), 10))
.filter((n) => !Number.isNaN(n)) ?? []
)
}
+1 -1
View File
@@ -43,7 +43,7 @@ function defaultReputation(id: number) {
* may itself be a comma-separated list, so `?id=1,2&id=3` is three ids.
*/
const BULK_ID_QUERY = [
intQuery('id', 'Repeatable; each value may be a comma-separated list of account ids'),
intQuery('id', 'Repeated once per account id (`?id=1&id=2`); not comma-separated'),
]
/** The `Ids` form body the bulk POST forms take. */
+1 -1
View File
@@ -258,7 +258,7 @@ describe('public endpoints', () => {
}),
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual({ success: true, error: '' })
expect(await res.json()).toEqual([])
})
test('POST /api/playerReputation/v2/bulk returns a reputation per id', async () => {