feat(api): add admin endpoint to issue keys for masters

Add `POST /admin/masters/{id}/keys` allowing admins to issue child keys
on behalf of a master. Introduce an `issued_by` field in the Key model
to audit whether a key was issued by the master or an admin.

Refactor master service to use typed errors for consistent HTTP status
mapping and ensure validation logic (active status, group check) is
shared.
This commit is contained in:
zenfun
2025-12-15 15:59:33 +08:00
parent 11f6e81798
commit aa69ce3659
8 changed files with 232 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ EZ-API 是"大脑"。它管理着事实的来源 (Source of Truth)。
- `POST /keys`: 创建新的客户端 API 密钥。
- `POST /models`: 注册支持的模型。
- `GET /models`: 列出所有模型。
- `POST /admin/masters/{id}/keys`: 代某个 master 签发子 key子 key 仍归属该 master仅审计 `issued_by=admin`)。
### Feature Flags给未来前端用