feat: switch to global auth and tenant route prefix

This commit is contained in:
2026-01-26 18:04:05 +08:00
parent 8addf6f900
commit cde4fb8594
25 changed files with 479 additions and 7196 deletions

View File

@@ -3,8 +3,8 @@
## Service Startup (Local)
- Backend: `go run ./backend/main.go serve` (default `http://localhost:8080`).
- Portal frontend: `npm -C frontend/portal install` then `npm -C frontend/portal run dev` (default `http://localhost:5174`).
- Superadmin frontend: `npm -C frontend/superadmin install` then `npm -C frontend/superadmin run dev` (default `http://localhost:5173`).
- Portal frontend: `npm -C frontend/portal install` then `npm -C frontend/portal run dev` (default `http://localhost:5174`, remote use `http://10.1.1.104:5174`).
- Superadmin frontend: `npm -C frontend/superadmin install` then `npm -C frontend/superadmin run dev` (default `http://localhost:5173`, remote use `http://10.1.1.104:5173`).
- Portal dev server proxies `/v1` to `http://localhost:8080` (`frontend/portal/vite.config.js`).
- Superadmin dev server proxies `/super/v1` and `/v1` to `http://localhost:8080` (`frontend/superadmin/vite.config.mjs`).
@@ -29,7 +29,7 @@
### MCP Example Flow (AI Guidance)
1. **Open Portal Home**
- `chrome-devtools_new_page``http://localhost:5174/t/:tenantCode`
- `chrome-devtools_new_page``http://10.1.1.104:5174/t/:tenantCode`
- `chrome-devtools_wait_for` text: `探索戏曲` or page title
2. **Portal Login**
@@ -50,7 +50,7 @@
- Assert detail page loads and cover/media is visible
5. **Superadmin Login**
- `chrome-devtools_new_page``http://localhost:5173/super/auth/login`
- `chrome-devtools_new_page``http://10.1.1.104:5173/super/auth/login`
- Fill `#username` with `superadmin` and `#password1` with `superadmin123`
- Click `Sign In`
- Wait for dashboard cards or `Dashboard` text
@@ -80,7 +80,7 @@
## Portal Smoke (Use tenantCode)
- Tenant code: query DB (`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`), then open `http://localhost:5174/t/:tenantCode`.- Login: OTP is fixed to `1234` (see `backend/app/services/user.go`).
- Tenant code: query DB (`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`), then open `http://10.1.1.104:5174/t/:tenantCode`.- Login: OTP is fixed to `1234` (see `backend/app/services/user.go`).
- Home: `/t/:tenantCode` lists content.
- Detail: open any content detail; cover and main asset render.
- Login: sign in as `test` (phone `13800138000`, OTP `1234`) and open `/t/:tenantCode/me`.