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

- 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>
This commit is contained in:
2026-04-07 10:53:39 -03:00
parent c2b0a4fea2
commit 6c9746eb05
21 changed files with 1892 additions and 101 deletions

View File

@@ -2,10 +2,12 @@ import React from 'react';
import { BrowserRouter, Routes, Route, NavLink, Navigate } from 'react-router-dom';
import { AuthProvider, useAuth } from './auth';
import Login from './pages/Login';
import Activate from './pages/Activate';
import Dashboard from './pages/Dashboard';
import Schedules from './pages/Schedules';
import TimeOff from './pages/TimeOff';
import Volunteers from './pages/Volunteers';
import Profile from './pages/Profile';
import './App.css';
function Nav() {
@@ -16,6 +18,7 @@ function Nav() {
<NavLink to="/">Dashboard</NavLink>
<NavLink to="/schedules">Schedules</NavLink>
<NavLink to="/timeoff">Time Off</NavLink>
<NavLink to="/profile">Profile</NavLink>
{role === 'admin' && <NavLink to="/volunteers">Volunteers</NavLink>}
<button className="btn-link" onClick={logout}>Sign Out</button>
</nav>
@@ -33,6 +36,7 @@ function ProtectedLayout() {
<Route path="/" element={<Dashboard />} />
<Route path="/schedules" element={<Schedules />} />
<Route path="/timeoff" element={<TimeOff />} />
<Route path="/profile" element={<Profile />} />
<Route path="/volunteers" element={<Volunteers />} />
</Routes>
</main>
@@ -52,6 +56,7 @@ export default function App() {
<BrowserRouter>
<Routes>
<Route path="/login" element={<LoginRoute />} />
<Route path="/activate" element={<Activate />} />
<Route path="/*" element={<ProtectedLayout />} />
</Routes>
</BrowserRouter>