more image endpoints, rooms

This commit is contained in:
Devin Zuczek
2026-07-05 16:29:56 -04:00
parent 0e8bf114e0
commit bc7e4d718c
6 changed files with 298 additions and 1 deletions
+11
View File
@@ -11,6 +11,7 @@ import {
getHotRooms,
getInteraction,
getPublicRoomsByCreator,
getRecommendedRooms,
getRoomById,
getRoomByName,
getRoomsByCreator,
@@ -185,6 +186,16 @@ const app = new Hono<App>()
return c.json(await getBaseRooms(c.env.DB, skip, take))
})
// Recommended rooms feed — public, non-dorm rooms ranked by engagement, returned
// as a bare array (the client's recommendation room-source expects a plain list).
// The `splitTestId`/`splitTestValue` A/B params are accepted and ignored.
// Paginated via skip/take (take defaults to 100).
.get('/rooms/recommendations', async (c) => {
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getRecommendedRooms(c.env.DB, skip, take))
})
// Bulk room lookup by `id` or `name` — returns an array of matched rooms (the
// client calls this bare on the rooms host). Rooms not in D1 are simply absent
// from the result; the client treats an empty result as NoSuchRoom.