User Accounts & Profiles (Issue #1) #9

Merged
thatguygriff merged 2 commits from feature/issue-1-user-accounts into main 2026-04-07 14:10:57 +00:00
Owner

Summary

Implements Issue #1 — User Accounts & Profiles.

  • FR-U01 Admin-only account creation; public /auth/register removed
  • FR-U02 Invite token generated on creation and returned in API response (admin copies link; email transport is TBD)
  • FR-U03 Email/password with invite-token activation implemented; Google Auth deferred per open decision
  • FR-U04 Deactivate/reactivate via existing active flag; inactive name display handled in frontend
  • FR-U05 Trainee flag on volunteer accounts; admin can promote (remove flag); completed shift count shown
  • FR-U06 Admin-only notes field; filtered out of non-admin API responses

New schema columns

is_trainee, phone, operational_roles, notification_preference, admin_notes, last_login, invite_token, invite_expires_at — added via ALTER TABLE … ADD COLUMN IF NOT EXISTS for existing deployments.

New / changed API endpoints

Method Path Change
POST /auth/activate New — public invite activation
POST /api/v1/volunteers New — admin-only account creation
POST /api/v1/volunteers/{id}/invite New — admin resend invite
PUT /api/v1/volunteers/{id} Updated — role-scoped: volunteers edit name+phone only
POST /auth/register Removed

Frontend pages

  • /activate?token=… — public invite activation page
  • /profile — volunteer self-edit (name + phone)
  • /volunteers — full admin management: create, trainee promotion, notes, invite resend

Test plan

  • Go: 20 tests covering handler auth rules, activate flow, update scoping, JWT round-trips
  • Frontend: 24 RTL tests for Activate, Profile, Volunteers pages, and App unauthenticated state
  • CI: .gitea/workflows/ci.yml runs go vet, go test, tsc --noEmit, and npm test on every push and PR

Closes #1

## Summary Implements Issue #1 — User Accounts & Profiles. - **FR-U01** Admin-only account creation; public `/auth/register` removed - **FR-U02** Invite token generated on creation and returned in API response (admin copies link; email transport is TBD) - **FR-U03** Email/password with invite-token activation implemented; Google Auth deferred per open decision - **FR-U04** Deactivate/reactivate via existing `active` flag; inactive name display handled in frontend - **FR-U05** Trainee flag on volunteer accounts; admin can promote (remove flag); completed shift count shown - **FR-U06** Admin-only notes field; filtered out of non-admin API responses ### New schema columns `is_trainee`, `phone`, `operational_roles`, `notification_preference`, `admin_notes`, `last_login`, `invite_token`, `invite_expires_at` — added via `ALTER TABLE … ADD COLUMN IF NOT EXISTS` for existing deployments. ### New / changed API endpoints | Method | Path | Change | |--------|------|--------| | `POST` | `/auth/activate` | New — public invite activation | | `POST` | `/api/v1/volunteers` | New — admin-only account creation | | `POST` | `/api/v1/volunteers/{id}/invite` | New — admin resend invite | | `PUT` | `/api/v1/volunteers/{id}` | Updated — role-scoped: volunteers edit name+phone only | | ~~`POST`~~ | ~~`/auth/register`~~ | Removed | ### Frontend pages - `/activate?token=…` — public invite activation page - `/profile` — volunteer self-edit (name + phone) - `/volunteers` — full admin management: create, trainee promotion, notes, invite resend ## Test plan - Go: 20 tests covering handler auth rules, activate flow, update scoping, JWT round-trips - Frontend: 24 RTL tests for Activate, Profile, Volunteers pages, and App unauthenticated state - CI: `.gitea/workflows/ci.yml` runs `go vet`, `go test`, `tsc --noEmit`, and `npm test` on every push and PR Closes #1
thatguygriff added 1 commit 2026-04-07 13:56:48 +00:00
Implement Issue #1: User Accounts & Profiles
Some checks failed
CI / Go tests & lint (push) Successful in 7s
CI / Frontend tests & type-check (push) Failing after 9s
CI / Go tests & lint (pull_request) Successful in 8s
CI / Frontend tests & type-check (pull_request) Failing after 9s
6c9746eb05
- Admin-only account creation (no self-registration); invite-token flow
  replaces the public /auth/register endpoint
- New volunteer fields: phone, is_trainee, operational_roles,
  notification_preference, admin_notes, last_login, completed_shifts
- Role-scoped profile editing: volunteers update name/phone only;
  admins update all fields including notes and trainee flag
- /auth/activate endpoint for invite-token-based account activation
- /api/v1/volunteers/{id}/invite for admin to resend invite links
- last_login recorded on each successful authentication

Tests:
- Go: handler tests (auth rules, create, activate, update scoping) via
  Storer/AuthServicer interfaces and fake store; auth unit tests for
  HashPassword, IssueToken, and Parse
- Frontend: RTL tests for Activate, Profile, and Volunteers pages
- Fixed CRA 5 + React Router v7 Jest compatibility (moduleNameMapper +
  TextEncoder polyfill)
- Replaced stale CRA App.test.tsx placeholder with real tests

CI:
- .gitea/workflows/ci.yml runs go vet, go test, tsc, and npm test on
  every push and pull request

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
thatguygriff force-pushed feature/issue-1-user-accounts from c57f4b67ff to 6c9746eb05 2026-04-07 13:56:48 +00:00 Compare
thatguygriff added 1 commit 2026-04-07 14:05:33 +00:00
Fix CI: use npm install instead of npm ci
All checks were successful
CI / Go tests & lint (pull_request) Successful in 8s
CI / Frontend tests & type-check (pull_request) Successful in 39s
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Successful in 45s
96a363d28f
npm ci fails when the lock file is missing platform-specific packages
(yaml@2.8.3) that only get resolved on Linux. Switch to npm install
which resolves dependencies at runtime rather than strictly validating
the lock file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
thatguygriff merged commit 96a363d28f into main 2026-04-07 14:10:57 +00:00
thatguygriff deleted branch feature/issue-1-user-accounts 2026-04-07 14:10:57 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: thatguygriff/walkies#9