mirror of
https://github.com/prdlk/leetcode.git
synced 2026-09-16 23:16:26 +00:00
docs(api): clarify /admin/solved payload and add /admin/due endpoint documentation
This commit is contained in:
+19
-10
@@ -57,7 +57,8 @@ day never feeds drills just because its calendar week lapsed.
|
||||
| `POST /webhook/github` | HMAC (`WEBHOOK_SECRET`) | `/done <n> pass\|fail` comments (owner only, any issue); `review`-issue close → gate scoring |
|
||||
| `GET /chart/{progress,ladder,heatmap}.svg`, `GET /badge/gate.svg` | public | hand-rolled SVGs, `max-age=300` (GitHub Camo's freshness floor) |
|
||||
| `GET /api/stats` | public, CORS-pinned to the docs origin | one JSON document for `/progress` |
|
||||
| `POST /admin/solved` | `Authorization: Bearer <LINK_KEY>` | `{"lc":[…]}` — solutions committed under `work/`; logs each *first* solve (`source='commit'`), skips anything past stage `new`, takes `?dry=1&date=` |
|
||||
| `POST /admin/solved` | `Authorization: Bearer <LINK_KEY>` | `{"solved":[{"lc":1,"bucket":1},…]}` — solutions committed under `work/`; the bucket names the rung it settles (1 → `new`, 3 → `+3`, 7 → `+7`), so a first solve enters the ladder and a pushed re-solve advances it. Writes only when the problem stands on that rung, which is what makes re-posting the whole set a no-op. Takes `?dry=1&date=` |
|
||||
| `POST /admin/due` | `Authorization: Bearer <LINK_KEY>` | read-only: what the ladder has due on `?date=` (default today), oldest first, with the rung/bucket, how late it is, and when it was last seen. The one answer behind the daily `Spaced Repetition` issue |
|
||||
| `POST /admin/{digest,review,reconcile}` | `Authorization: Bearer <LINK_KEY>` | manual triggers; `digest` takes `?dry=1&force=1&date=` |
|
||||
|
||||
## Crons (DST-proof)
|
||||
@@ -77,15 +78,23 @@ routes). Bindings in `wrangler.jsonc`: `DB` (D1 `srs`), `EMAIL`
|
||||
(`send_email`, restricted to the verified destination). Sender domain
|
||||
`prdlk.com` is onboarded to Email Sending.
|
||||
|
||||
Two Actions workflows push into D1 with the `SRS_ADMIN_KEY` repo secret:
|
||||
`sync-d1.yml` sends curriculum issue edits to `POST /admin/reconcile`
|
||||
(the morning cron is the backstop), and `close-solved.yml` sends the whole
|
||||
implemented `work/` set to `POST /admin/solved` on every push to `main`.
|
||||
That second call is what keeps a committed solution from being invisible
|
||||
here: closing its issue is not a state change the Worker can see — the
|
||||
catalog reconcile ignores issue state, and only `logAttempt()` moves the
|
||||
ladder. `close-solved` still owns the issue close itself (it knows the files
|
||||
and the commit), so this path only writes D1 and mirrors Project fields.
|
||||
Three Actions workflows talk to this Worker with the `SRS_ADMIN_KEY` repo
|
||||
secret:
|
||||
|
||||
- `sync-d1.yml` sends curriculum issue edits to `POST /admin/reconcile` (the
|
||||
morning cron is the backstop).
|
||||
- `close-solved.yml` sends the whole implemented `work/` set — each entry
|
||||
tagged with its bucket — to `POST /admin/solved` on every push to `main`.
|
||||
That call is what keeps a committed solution from being invisible here:
|
||||
closing an issue is not a state change the Worker can see (the catalog
|
||||
reconcile ignores issue state, and only `logAttempt()` moves the ladder), and
|
||||
the bucket is what lets a pushed re-solve advance `+3 → +7` instead of
|
||||
being read as a stale first solve. `close-solved` still owns the issue close
|
||||
itself (it knows the files and the commit), so this path only writes D1 and
|
||||
mirrors Project fields.
|
||||
- `spaced-repetition.yml` reads `POST /admin/due` at 06:00 ET and renders
|
||||
today's `Spaced Repetition` issue. Read-only, and the only schedule involved
|
||||
is this Worker's ladder.
|
||||
|
||||
## Local dev
|
||||
|
||||
|
||||
Reference in New Issue
Block a user