Files
member-platform/docs/INTERNAL_API_HANDOFF.md

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Internal API Handoff新模型
## Base URL
- Local: `http://127.0.0.1:8000`
- Prod: 由部署環境提供
## Auth Headers`/internal/*`
- `X-Client-Key: <client_key>`
- `X-API-Key: <api_key>`
## Common Error Response
```json
{ "detail": "error_code" }
```
## 資源模型(重點)
- `company`: `id`, `company_key`, `display_name`, `legal_name`, `status`
- `site`: `id`, `site_key`, `company_id`, `display_name`, `domain`, `status`
- `system`: `id`, `system_key`, `name`, `idp_client_id`, `status`
- `role`: `id`, `role_key`, `system_id`, `name`, `description`, `idp_role_name`, `status`
- `user`: `id`, `user_sub`, `username`, `email`, `display_name`, `is_active`, `status`
## 主要端點(目標)
1. `GET /internal/companies`
2. `GET /internal/sites`
3. `GET /internal/systems`
4. `GET /internal/roles`
5. `GET /internal/users`
6. `GET /internal/users/{user_sub}/roles`
- 回傳該 user 透過 site 推導出的最終 roles。
## 關聯端點(目標)
1. `POST /internal/site-roles` / `DELETE /internal/site-roles/{id}`
2. `POST /internal/user-sites` / `DELETE /internal/user-sites/{id}`
## 注意事項
- 不提供 user direct role 寫入 API。
- 若其他系統需要判斷某 user 可否做某事,請吃 `users/{user_sub}/roles` 聚合結果。