chore(local): smoke check logs in through mobile-api admin login; README runs the portal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
da813874ec
commit
b2e0a17790
3 files changed
+34
-9
No files matched your search
+18
-1
@@ -25,7 +25,7 @@ Then check it:
|
||||
local/smoke.sh
|
||||
```
|
||||
|
||||
It prints `smoke: OK` when admin login, a service-counter read and a public mobile-api call all succeed.
|
||||
It prints `smoke: OK` when admin login, `/api/admin/me`, the users list, a service-counter read and a public mobile-api call all succeed.
|
||||
|
||||
| What | Where |
|
||||
|---|---|
|
||||
@@ -34,6 +34,23 @@ It prints `smoke: OK` when admin login, a service-counter read and a public mobi
|
||||
| MySQL | localhost:3307, user `root`, password `colite-dev` |
|
||||
| Admin login | `admin` / `colite-dev-admin` |
|
||||
|
||||
## Admin portal
|
||||
|
||||
The portal runs outside Docker with `npm run dev` and talks to `mobile-api` on port 8080. With the stack up:
|
||||
|
||||
```sh
|
||||
cd solvway-admin-portal
|
||||
cat > .env.local <<'EOF'
|
||||
MOBILE_API_BASE_URL=http://localhost:8080
|
||||
MOBILE_API_KEY=colite-local-app-key
|
||||
SESSION_SECRET=colite-local-session-secret-0123456789abcdef
|
||||
EOF
|
||||
npm ci
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open http://localhost:3001 and log in as `admin` / `colite-dev-admin`. `.env.local` is git-ignored. The portal declares Node 24; Node 22 also runs it.
|
||||
|
||||
## Reset
|
||||
|
||||
Deletes the database volume; the next start reseeds from `local/seed/`:
|
||||
|
||||
+15
-7
@@ -8,19 +8,27 @@ APP_KEY=colite-local-app-key
|
||||
|
||||
fail() { echo "FAIL: $1"; exit 1; }
|
||||
|
||||
# 1. Admin login: gateway -> service-auth -> service-system -> MySQL
|
||||
token=$(curl -sf -X POST "$GW/auth/authenticate" -H "api-key: $GW_KEY" -H 'Content-Type: application/json' \
|
||||
-d '{"username":"admin","password":"colite-dev-admin"}') || fail "POST $GW/auth/authenticate"
|
||||
[ -n "$token" ] || fail "POST $GW/auth/authenticate returned no token"
|
||||
echo "auth/authenticate: 200"
|
||||
# 1. Admin login: mobile-api -> service-auth -> service-system -> MySQL
|
||||
token=$(curl -sf -X POST "$MOBILE/api/admin/auth/login" -H "api-key: $APP_KEY" -H 'Content-Type: application/json' \
|
||||
-d '{"username":"admin","password":"colite-dev-admin"}' \
|
||||
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p') || fail "POST $MOBILE/api/admin/auth/login"
|
||||
[ -n "$token" ] || fail "POST $MOBILE/api/admin/auth/login returned no token"
|
||||
echo "api/admin/auth/login: 200"
|
||||
|
||||
# 2. gateway -> service-counter -> MySQL
|
||||
# 2. Admin guard and session lookup, then the users list (service-system)
|
||||
for path in /api/admin/me /api/admin/users; do
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$MOBILE$path" -H "api-key: $APP_KEY" -H "Authorization: Bearer $token")
|
||||
[ "$code" = 200 ] || fail "GET $MOBILE$path returned $code"
|
||||
echo "${path#/}: $code"
|
||||
done
|
||||
|
||||
# 3. gateway -> service-counter -> MySQL
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$GW/counter/event/findCurrentEvent" \
|
||||
-H "api-key: $GW_KEY" -H "Authorization: Bearer $token")
|
||||
[ "$code" = 200 ] || fail "GET $GW/counter/event/findCurrentEvent returned $code"
|
||||
echo "counter/event/findCurrentEvent: $code"
|
||||
|
||||
# 3. mobile-api -> gateway -> service-system -> MySQL
|
||||
# 4. mobile-api -> gateway -> service-system -> MySQL, no login
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$MOBILE/api/public/messages/en_US" -H "api-key: $APP_KEY")
|
||||
[ "$code" = 200 ] || fail "GET $MOBILE/api/public/messages/en_US returned $code"
|
||||
echo "api/public/messages/en_US: $code"
|
||||
|
||||
@@ -38,7 +38,7 @@ Babyboo source: `~/Projects/babyboo` (read only). All tasks run serially; most t
|
||||
|
||||
## 7. Local stack and end-to-end check
|
||||
|
||||
- [ ] 7.1 Update `local/smoke.sh` to log in via `POST :8080/api/admin/auth/login` and call `/api/admin/me` and `/api/admin/users` (keep the counter read and the public call); add the portal to the README run steps (`npm run dev` with `MOBILE_API_BASE_URL=http://localhost:8080` and the app key). Verify: fresh `local/up.sh` then `local/smoke.sh` prints `smoke: OK`.
|
||||
- [x] 7.1 Update `local/smoke.sh` to log in via `POST :8080/api/admin/auth/login` and call `/api/admin/me` and `/api/admin/users` (keep the counter read and the public call); add the portal to the README run steps (`npm run dev` with `MOBILE_API_BASE_URL=http://localhost:8080` and the app key). Verify: fresh `local/up.sh` then `local/smoke.sh` prints `smoke: OK`.
|
||||
- Scope: `local/smoke.sh`, `local/README.md`, `local/.env.example`
|
||||
- [ ] 7.2 Drive the portal in a browser with Playwright against the local stack: login (correct and wrong password), first-login change for a new user, users list/create/edit/deactivate, roles create and grant `BO_USERS`, not-authorised page for a user without `BO_ROLES`, forgot-password message. Screenshots in the change folder's `verification/`. Only local dev data is created. Verify: each scenario observed as specified.
|
||||
- Scope: `openspec/changes/add-admin-auth-users-roles/verification/**`
|
||||
|
||||
Reference in new issue
Block a user