mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 22:51:30 -07:00
[rooms] add showcase stub
This commit is contained in:
@@ -874,6 +874,14 @@ export const RoomExperiencePlayer = z
|
|||||||
.array(z.unknown())
|
.array(z.unknown())
|
||||||
.describe('Always empty — no per-room experience is tracked')
|
.describe('Always empty — no per-room experience is tracked')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `GET /showcase/{playerId}` — the rooms a player showcases on their profile. Stubbed
|
||||||
|
* empty; nothing stores a showcase, so the element shape is unknown until something does.
|
||||||
|
*/
|
||||||
|
export const ShowcasedRooms = z
|
||||||
|
.array(z.unknown())
|
||||||
|
.describe('Always empty — no room showcase is stored')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `GET /rooms/curated_playlists` — the curated room playlists the discovery pages'
|
* `GET /rooms/curated_playlists` — the curated room playlists the discovery pages'
|
||||||
* playlist sections draw from. Nothing curates one on this server, so the list is always
|
* playlist sections draw from. Nothing curates one on this server, so the list is always
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ import {
|
|||||||
SaveSubRoomDataRequest,
|
SaveSubRoomDataRequest,
|
||||||
SearchSuggestions,
|
SearchSuggestions,
|
||||||
ServiceStatus,
|
ServiceStatus,
|
||||||
|
ShowcasedRooms,
|
||||||
stringQuery,
|
stringQuery,
|
||||||
SubRoomAccessibilityRequest,
|
SubRoomAccessibilityRequest,
|
||||||
SubRoomDataSaveResponseDto,
|
SubRoomDataSaveResponseDto,
|
||||||
@@ -1282,6 +1283,29 @@ const app = new Hono<App>()
|
|||||||
c.json(await getPublicRoomsByCreator(c.env.DB, Number.parseInt(c.req.param('accountId'), 10)))
|
c.json(await getPublicRoomsByCreator(c.env.DB, Number.parseInt(c.req.param('accountId'), 10)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// A player's showcased rooms — the hand-picked rail the client draws on a profile,
|
||||||
|
// separate from `ownedby/{accountId}` (which is everything public they own). Stub →
|
||||||
|
// empty list: nothing stores a showcase yet, and an empty rail is what a player who
|
||||||
|
// has picked nothing looks like, where a 404 leaves the profile half-drawn. No auth,
|
||||||
|
// matching the profile list it sits beside — a showcase is public by definition.
|
||||||
|
.get(
|
||||||
|
'/showcase/:playerId{[0-9]+}',
|
||||||
|
describeRoute({
|
||||||
|
tags: ['Rooms'],
|
||||||
|
summary: 'A player’s showcased rooms',
|
||||||
|
description: [
|
||||||
|
'The rooms a player has showcased on their profile, as a bare array. Nothing stores a',
|
||||||
|
'showcase yet, so this is a stub serving an empty list — which the client reads as',
|
||||||
|
'“nothing showcased”, the same as a player who has picked none. Unlike',
|
||||||
|
'`ownedby/{accountId}`, which lists everything public the account owns, a showcase is',
|
||||||
|
'a chosen subset. No auth: a profile is public.',
|
||||||
|
].join(' '),
|
||||||
|
parameters: [playerIdParam],
|
||||||
|
responses: { 200: json(ShowcasedRooms, 'An empty list') },
|
||||||
|
}),
|
||||||
|
(c) => c.json([])
|
||||||
|
)
|
||||||
|
|
||||||
// Rooms the caller has favorited (from the interaction table). Auth-gated.
|
// Rooms the caller has favorited (from the interaction table). Auth-gated.
|
||||||
// Paginated via skip/take (take defaults to 100). Returns a bare array, like the
|
// Paginated via skip/take (take defaults to 100). Returns a bare array, like the
|
||||||
// other room-source `*by/me` lists the client loads.
|
// other room-source `*by/me` lists the client loads.
|
||||||
|
|||||||
@@ -195,6 +195,23 @@ describe('rooms endpoints', () => {
|
|||||||
expect(await res.json()).toEqual([])
|
expect(await res.json()).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Stub, same reasoning: the profile asks for a showcase for any player, and an
|
||||||
|
// unregistered path leaves the profile half-drawn. No auth, and no such player is
|
||||||
|
// still [] rather than a 404.
|
||||||
|
it('GET /showcase/:playerId returns [] for any player', async () => {
|
||||||
|
const res = await SELF.fetch(`${ORIGIN}/showcase/205`)
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual([])
|
||||||
|
|
||||||
|
const unknown = await SELF.fetch(`${ORIGIN}/showcase/99999`)
|
||||||
|
expect(unknown.status).toBe(200)
|
||||||
|
expect(await unknown.json()).toEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('GET /showcase/:playerId 404s on a non-numeric id', async () => {
|
||||||
|
expect((await SELF.fetch(`${ORIGIN}/showcase/abc`)).status).toBe(404)
|
||||||
|
})
|
||||||
|
|
||||||
it('GET /rooms/:id 404s for a room not in D1', async () => {
|
it('GET /rooms/:id 404s for a room not in D1', async () => {
|
||||||
const res = await SELF.fetch(`${ORIGIN}/rooms/99999`)
|
const res = await SELF.fetch(`${ORIGIN}/rooms/99999`)
|
||||||
expect(res.status).toBe(404)
|
expect(res.status).toBe(404)
|
||||||
@@ -4088,6 +4105,7 @@ describe('rooms endpoints', () => {
|
|||||||
'GET /rooms/{roomId}/subrooms/{subRoomId}/saves/no_unity_assets',
|
'GET /rooms/{roomId}/subrooms/{subRoomId}/saves/no_unity_assets',
|
||||||
'GET /rooms/{roomId}/subrooms/{subRoomId}/saves/{saveId}',
|
'GET /rooms/{roomId}/subrooms/{subRoomId}/saves/{saveId}',
|
||||||
'GET /roomserver/rooms/createdby/me',
|
'GET /roomserver/rooms/createdby/me',
|
||||||
|
'GET /showcase/{playerId}',
|
||||||
'POST /rooms/bulk',
|
'POST /rooms/bulk',
|
||||||
'POST /rooms/{roomId}/bans',
|
'POST /rooms/{roomId}/bans',
|
||||||
'POST /rooms/{roomId}/clone',
|
'POST /rooms/{roomId}/clone',
|
||||||
|
|||||||
Reference in New Issue
Block a user