mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
accounts
Accounts Worker served at accounts.rec.djdevin.net. A Hono app ported from the
C# AccountsController. EF Core (AppDbContext) queries are stubbed for now —
no real bindings yet.
Behavior
- Auth-gated routes validate the Bearer JWT issued by the
authworker (same dev secret, seesrc/jwt.ts) and 401 when it's missing/invalid. - DB-backed reads return synthesized default accounts. The C# already fills
every column with a fallback (
Player{id},DefaultProfileImage.jpg, etc.), so the stubs return those defaults rather than 404ing on a missing row. - DB-backed writes (
create, thePUT /account/me/*mutations) accept the request and ack without persisting.createmints a random account id and returns it wrapped in the RecNet result envelope{ success, value }.
Endpoints
GET /— health checkGET /account/me— authed self account (SelfAccount)GET /account/bulk?id=1&id=2— accounts for the requested idsGET /account/:id— single accountGET /account/:id/bio— player bioPOST /account/create— create an account →{ success, value }GET /parentalcontrol/me— authed parental-control flagsPUT /account/me/displayname— authed, bodydisplayNamePUT /account/me/username— authed, bodyusernamePUT /account/me/bio— authed, bodybioPUT /account/me/profileimage— authed, bodyimageName
TODO before production
- Wire a DB binding (D1/DO) for
Accounts,CachedLogins,PlayerBios,Rooms/SubRooms(the dorm room created on signup). - Make reads 404 on missing rows once real data exists.
- Persist the
PUT /account/me/*mutations. - Move the JWT secret to a shared secret binding (shared with
auth).