mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-09 15:11:29 -07:00
misc rooms endpoints, friends
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
getAccount,
|
||||
getAccountByUsername,
|
||||
getAccountsByIds,
|
||||
searchAccounts,
|
||||
updateAccount,
|
||||
} from './accounts-db'
|
||||
import { validateAndGetAccountId } from './jwt'
|
||||
@@ -151,6 +152,16 @@ const app = new Hono<App>()
|
||||
return c.json(toSelfAccountDto(account))
|
||||
})
|
||||
|
||||
// ---- Search --------------------------------------------------------------
|
||||
// Prefix-search accounts by username (`?name=`). Returns a bare array of public
|
||||
// account DTOs, ordered alphabetically. Registered before `/account/:id` so the
|
||||
// static `search` path wins over the param route.
|
||||
.get('/account/search', async (c) => {
|
||||
const name = c.req.query('name') ?? ''
|
||||
const accounts = await searchAccounts(c.env.DB, name)
|
||||
return c.json(accounts.map(toAccountDto))
|
||||
})
|
||||
|
||||
// ---- Bulk / single lookup ------------------------------------------------
|
||||
// Register the static `bulk` path before the `/account/:id` param route.
|
||||
.get('/account/bulk', async (c) => {
|
||||
|
||||
Reference in New Issue
Block a user