fix(schedule-type): accept X-API-Key for CRUD #19

Merged
hzhang merged 1 commits from feat/schedule-type-apikey-auth into main 2026-05-22 18:36:21 +00:00
Contributor

/schedule-types/ router was the last surface still gated on get_current_user (JWT-only). The companion special-slot router (PR #18) used get_current_user_or_apikey, so admin had to DB-insert the schedule_type and then call API for the special slot — annoying asymmetry.

Swaps all 5 CRUD endpoints (list / create / patch / delete / assign-agent) to get_current_user_or_apikey so the same hzhang admin api_key works for both. /schedule-types/agent/me uses X-Agent-ID headers (not user auth), unchanged. JWT callers unaffected — the OR dependency tries api_key first then falls back to JWT.

🤖 Generated with Claude Code

`/schedule-types/` router was the last surface still gated on `get_current_user` (JWT-only). The companion special-slot router (PR #18) used `get_current_user_or_apikey`, so admin had to DB-insert the schedule_type and then call API for the special slot — annoying asymmetry. Swaps all 5 CRUD endpoints (list / create / patch / delete / assign-agent) to `get_current_user_or_apikey` so the same hzhang admin api_key works for both. `/schedule-types/agent/me` uses `X-Agent-ID` headers (not user auth), unchanged. JWT callers unaffected — the OR dependency tries api_key first then falls back to JWT. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
hzhang added 1 commit 2026-05-22 18:36:16 +00:00
The /schedule-types/ router was the last surface still gated on
get_current_user (JWT-only). The companion special-slot router
(PR #18) used get_current_user_or_apikey, so the admin flow was:

  * create a schedule_type → DB direct insert (cli can't reach it)
  * add special slot via API → works

Swaps all 5 CRUD endpoints (list / create / patch / delete /
assign-agent) to get_current_user_or_apikey so the same hzhang
admin api_key that works for special-slot creation now works for
schedule_type creation too. /schedule-types/agent/me already uses
X-Agent-ID headers (not user auth), so no change there.

Existing JWT callers are unaffected — get_current_user_or_apikey
tries api_key first then falls back to JWT.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hzhang merged commit a1049492e1 into main 2026-05-22 18:36:20 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: zhi/HarborForge.Backend#19