mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-25 23:18:51 -07:00
[rooms] boosts stub
This commit is contained in:
@@ -430,6 +430,11 @@ export const ExperienceRequest = z.object({
|
|||||||
*/
|
*/
|
||||||
export const DormRoomId = z.int().describe('The caller’s dorm RoomId')
|
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
|
* 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".
|
* lookups answer an empty object rather than a 404 — the client reads that as "no room".
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ import {
|
|||||||
RoomBanEnvelope,
|
RoomBanEnvelope,
|
||||||
RoomBanHistoryEnvelope,
|
RoomBanHistoryEnvelope,
|
||||||
RoomBansRemovedEnvelope,
|
RoomBansRemovedEnvelope,
|
||||||
|
RoomBoostCount,
|
||||||
RoomDto,
|
RoomDto,
|
||||||
RoomEnvelope,
|
RoomEnvelope,
|
||||||
RoomExperience,
|
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
|
// The current player's interaction state with a room (cheered/favorited/last
|
||||||
// visited), read from the `interaction` table. Auth-gated.
|
// visited), read from the `interaction` table. Auth-gated.
|
||||||
.get(
|
.get(
|
||||||
|
|||||||
@@ -184,6 +184,13 @@ describe('rooms endpoints', () => {
|
|||||||
expect(body).not.toHaveProperty('FriendlyName')
|
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
|
// 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
|
// `error: null` / `error_id` is a different envelope from the room mutations' — a
|
||||||
// "cleanup" that unified the two would break the client silently.
|
// "cleanup" that unified the two would break the client silently.
|
||||||
|
|||||||
Reference in New Issue
Block a user