Skip to content

five-on-it / apps/api/src/admin

apps/api/src/admin ​

The admins' routes: the accounts' daily limits (limits.ts). An admin is an account FOI_ADMINS names, a list kept apart from the moderators'; anyone else signed in gets 403, nobody signed in 401. Every change of an account's limits goes to the audit log (action: 'limits': who, when, the account, its override before and after, the note), which the moderators read too.

RouteWhat
GET /admin/limitsEvery account's override, the latest set first, each saying whether it ran out.
GET /admin/accounts?q=The accounts the API has seen (drafts' owners, quotas' spenders, overrides) whose id or name holds the words, 20 at most, each with its limits now, today's usage and its override; an id typed in whole that it has not seen comes first (when nothing else matches, or when it reads as an id: a - or an @ in it), so any account can be given limits before it ever builds.
GET /admin/accounts/:id/limitsOne account, the same way.
PUT /admin/accounts/:id/limits {builds?, rooms?, creations?, budgetExempt?, until?, note?}Sets the account's override, replacing the one it had: a number a day of each limit given (0 blocks), until a date (through that day, UTC) or a time to come.
DELETE /admin/accounts/:id/limits {note?}Takes the override away: the defaults again.
GET /admin/audit?limit=The changes of limits, newest first (100 by default, at most 500).

Functions ​