[api] fix progression stub

This commit is contained in:
Devin Zuczek
2026-09-25 10:32:42 -04:00
parent f72d29e088
commit 5178f18c79
2 changed files with 19 additions and 15 deletions
+15 -11
View File
@@ -16,6 +16,7 @@ import { NotificationType } from '../../../notify/src/notification-types'
import { authedId, parseFormIds, queryIds, unauthorized } from '../http' import { authedId, parseFormIds, queryIds, unauthorized } from '../http'
import { import {
AUTHED, AUTHED,
BareInteger,
BulkIdsRequest, BulkIdsRequest,
CheerPlayerRequest, CheerPlayerRequest,
CheerPlayerResponse, CheerPlayerResponse,
@@ -520,23 +521,26 @@ export const progressionRoutes = new Hono<App>({ strict: false })
} }
) )
// The progression events running right now — the limited-time XP events the client shows // The progression event running right now — the limited-time XP event the client shows
// a banner and a progress track for. // a banner and a progress track for.
// //
// STUB: an empty list, which the client reads as "no event on" and skips the event UI // STUB: a bare `-1`, the reference server's "no active event" value (the id of the
// entirely. That is the honest answer (nothing here runs events) and the safe one: a // active event, or -1 when there is none). The client reads it as "no event on" and
// fabricated event would draw a track that never fills. No auth — whether an event is // skips the event UI entirely. That is the honest answer (nothing here runs events) and
// running is the same fact for everybody, and the client asks while loading. // the safe one: a fabricated event would draw a track that never fills. No auth —
// whether an event is running is the same fact for everybody, and the client asks while
// loading.
.get( .get(
'/api/progressionEvents/active', '/api/progressionEvents/active',
describeRoute({ describeRoute({
tags: ['Progression'], tags: ['Progression'],
summary: 'Progression events currently running (stub)', summary: 'Progression event currently running (stub)',
description: description:
'The limited-time XP events in progress. Always an empty list — nothing on this ' + 'The limited-time XP event in progress, as a bare event id. Always `-1` — the ' +
'server runs one — which the client reads as “no event” and skips the event UI, ' + '“no active event” value; nothing on this server runs one — which the client reads ' +
'where a 404 would stall the load. No auth: it is the same answer for every player.', 'as “no event” and skips the event UI, where a 404 would stall the load. No auth: ' +
responses: { 200: json(JsonArray, 'Empty — no event is running') }, 'it is the same answer for every player.',
responses: { 200: json(BareInteger, 'A bare `-1` — no event is running') },
}), }),
(c) => c.json([]) (c) => c.json(-1)
) )
+4 -4
View File
@@ -2055,12 +2055,12 @@ describe('public endpoints', () => {
expect(res.status).toBe(400) expect(res.status).toBe(400)
}) })
test('GET /api/progressionEvents/active is an empty list (no auth)', async () => { test('GET /api/progressionEvents/active is a bare -1 (no auth)', async () => {
// The client reads an empty list as "no event running" and skips the event UI; a 404 // -1 is the reference server's "no active event" value; the client reads it as "no event
// would stall its load instead. // running" and skips the event UI. A 404 would stall its load instead.
const res = await exports.default.fetch(`${ORIGIN}/api/progressionEvents/active`) const res = await exports.default.fetch(`${ORIGIN}/api/progressionEvents/active`)
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(await res.json()).toEqual([]) expect(await res.json()).toBe(-1)
}) })
test('GET /api/rooms/v1/filters returns an object with filter arrays', async () => { test('GET /api/rooms/v1/filters returns an object with filter arrays', async () => {