feat(db-sync): add user endpoint and open collective sync hooks

This commit is contained in:
Tienson Qin
2026-04-20 21:17:29 +08:00
parent 08ab85ec58
commit 535f12ca7e
13 changed files with 419 additions and 2 deletions

View File

@@ -54,6 +54,11 @@
- `GET /health`
- Worker health check. Response: `{"ok":true}`.
### User
- `POST /user`
- Return current user sync entitlement/profile fields from D1.
- Response: `{"ExpireTime": <epoch-seconds>, "UserGroups": ["..."], "ProUser": <boolean>, "StorageLimit": <bytes>, "GraphCountLimit": <int>}`.
### Graphs (index DO)
- `GET /graphs`
- List graphs the user owns. Response: `{"graphs":[{graph-id, graph-name, schema-version?, graph-ready-for-use?, created-at, updated-at}...]}`.
@@ -110,6 +115,11 @@
- `DELETE /sync/:graph-id/admin/reset`
- Drop/recreate per-graph tables. Response: `{"ok":true}`.
### Open Collective webhook
- `POST /hooks/open-collective?token=<token>`
- Trigger immediate Open Collective reconciliation for member events.
- Returns: `{"ok":true}`.
### Assets
- `GET /assets/:graph-id/:asset-uuid.:ext`
- Download asset (binary response, `content-type` set, `x-asset-type` header included).