From 6f9348222aa6e9532ed33e68df841bf88f9f3428 Mon Sep 17 00:00:00 2001 From: Devin Zuczek Date: Tue, 13 Oct 2026 00:48:09 -0400 Subject: [PATCH] [rooms] boosts stub --- apps/rooms/src/openapi.ts | 5 +++++ apps/rooms/src/rooms.app.ts | 20 ++++++++++++++++++++ apps/rooms/src/test/integration/api.test.ts | 7 +++++++ 3 files changed, 32 insertions(+) diff --git a/apps/rooms/src/openapi.ts b/apps/rooms/src/openapi.ts index 29133a4..6891ade 100644 --- a/apps/rooms/src/openapi.ts +++ b/apps/rooms/src/openapi.ts @@ -430,6 +430,11 @@ export const ExperienceRequest = z.object({ */ export const DormRoomId = z.int().describe('The caller’s dorm RoomId') +/** `GET /rooms/{roomId}/boosts/{playerId}/count` — a bare integer, no envelope. */ +export const RoomBoostCount = z + .int() + .describe('Boosts the player has put on the room. Nothing grants boosts here, so always 0') + /** * A room lookup result: the room, or `{}` when nothing matched. The by-id/by-name * lookups answer an empty object rather than a 404 — the client reads that as "no room". diff --git a/apps/rooms/src/rooms.app.ts b/apps/rooms/src/rooms.app.ts index fa28a31..331f84a 100644 --- a/apps/rooms/src/rooms.app.ts +++ b/apps/rooms/src/rooms.app.ts @@ -150,6 +150,7 @@ import { RoomBanEnvelope, RoomBanHistoryEnvelope, RoomBansRemovedEnvelope, + RoomBoostCount, RoomDto, RoomEnvelope, RoomExperience, @@ -1922,6 +1923,25 @@ const app = new Hono() } ) + // How many boosts a player has put on a room. Boosts are not implemented — nothing + // grants or spends them, and the room DTO's `BoostCount` is a constant 0 for the same + // reason — so this is a stub that answers a bare integer 0 for any room and player, + // known or not, rather than leaving the client's request to 404. + .get( + '/rooms/:roomId{[0-9]+}/boosts/:playerId{[0-9]+}/count', + describeRoute({ + tags: ['Interaction'], + summary: 'A player’s boost count on a room', + description: [ + 'Stub: boosts are not implemented, so this answers a bare `0` for every room and', + 'player, whether or not either exists. No envelope — the body is the integer.', + ].join(' '), + parameters: [roomIdParam, playerIdParam], + responses: { 200: json(RoomBoostCount, 'The boost count, always 0') }, + }), + (c) => c.json(0) + ) + // The current player's interaction state with a room (cheered/favorited/last // visited), read from the `interaction` table. Auth-gated. .get( diff --git a/apps/rooms/src/test/integration/api.test.ts b/apps/rooms/src/test/integration/api.test.ts index 0428d4a..a78fdac 100644 --- a/apps/rooms/src/test/integration/api.test.ts +++ b/apps/rooms/src/test/integration/api.test.ts @@ -184,6 +184,13 @@ describe('rooms endpoints', () => { expect(body).not.toHaveProperty('FriendlyName') }) + // A stub: boosts aren't implemented, so the count is a bare 0 for any room and player. + it('GET /rooms/:id/boosts/:playerId/count answers a bare 0', async () => { + const res = await SELF.fetch(`${ORIGIN}/rooms/112/boosts/205/count`) + expect(res.status).toBe(200) + expect(await res.json()).toBe(0) + }) + // Pinned whole: these are the numbers the client's publish UI counts against, and // `error: null` / `error_id` is a different envelope from the room mutations' — a // "cleanup" that unified the two would break the client silently.