[rooms] boosts stub

This commit is contained in:
Devin Zuczek
2026-10-13 00:48:09 -04:00
parent e06eba6929
commit 6f9348222a
3 changed files with 32 additions and 0 deletions
+5
View File
@@ -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".
+20
View File
@@ -150,6 +150,7 @@ import {
RoomBanEnvelope,
RoomBanHistoryEnvelope,
RoomBansRemovedEnvelope,
RoomBoostCount,
RoomDto,
RoomEnvelope,
RoomExperience,
@@ -1922,6 +1923,25 @@ const app = new Hono<App>()
}
)
// 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(
@@ -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.