Implement Issue #2: Scheduling & Publishing #10

Merged
thatguygriff merged 10 commits from feature/issue-2-scheduling into main 2026-04-08 23:02:18 +00:00
Owner

Summary

  • Replaces stub schedule CRUD with full shift template + instance system covering all FR-S01–S10
  • 5 new DB tables: shift_templates, shift_template_roles, shift_template_volunteers, shift_instances, shift_instance_volunteers
  • New API endpoints for template CRUD, shift generation, publish/unpublish, per-shift edits, and volunteer confirmation
  • Notifications dispatched on publish (FR-S04), unpublish (FR-S05), shift edit/reset (FR-S09), and mid-month volunteer add (FR-S10)
  • Schedules page rewritten with month navigation, template management, admin publish controls, and volunteer confirmation UI

API

Method Path Auth Description
GET /api/v1/shift-templates any List templates
POST /api/v1/shift-templates admin Create template
PUT /api/v1/shift-templates/{id} admin Update template
DELETE /api/v1/shift-templates/{id} admin Delete template
GET /api/v1/shifts?year=&month= any List instances
POST /api/v1/shifts/generate admin Generate drafts for a month
POST /api/v1/shifts/publish admin Publish a month
POST /api/v1/shifts/unpublish admin Unpublish a month
PUT /api/v1/shifts/{id} admin Edit volunteers/capacity
POST /api/v1/shifts/{id}/confirm volunteer Confirm attendance

Test plan

  • go vet ./... — clean
  • go test ./internal/schedule/... — 14 handler tests pass
  • React tests — 11 tests pass (Schedules.test.tsx)
  • Manual: create a template, generate a month, publish, confirm as volunteer
  • Manual: edit a published shift and verify confirmation resets + notifications appear

Closes #2

## Summary - Replaces stub schedule CRUD with full shift template + instance system covering all FR-S01–S10 - 5 new DB tables: `shift_templates`, `shift_template_roles`, `shift_template_volunteers`, `shift_instances`, `shift_instance_volunteers` - New API endpoints for template CRUD, shift generation, publish/unpublish, per-shift edits, and volunteer confirmation - Notifications dispatched on publish (FR-S04), unpublish (FR-S05), shift edit/reset (FR-S09), and mid-month volunteer add (FR-S10) - Schedules page rewritten with month navigation, template management, admin publish controls, and volunteer confirmation UI ## API | Method | Path | Auth | Description | |--------|------|------|-------------| | GET | `/api/v1/shift-templates` | any | List templates | | POST | `/api/v1/shift-templates` | admin | Create template | | PUT | `/api/v1/shift-templates/{id}` | admin | Update template | | DELETE | `/api/v1/shift-templates/{id}` | admin | Delete template | | GET | `/api/v1/shifts?year=&month=` | any | List instances | | POST | `/api/v1/shifts/generate` | admin | Generate drafts for a month | | POST | `/api/v1/shifts/publish` | admin | Publish a month | | POST | `/api/v1/shifts/unpublish` | admin | Unpublish a month | | PUT | `/api/v1/shifts/{id}` | admin | Edit volunteers/capacity | | POST | `/api/v1/shifts/{id}/confirm` | volunteer | Confirm attendance | ## Test plan - [x] `go vet ./...` — clean - [x] `go test ./internal/schedule/...` — 14 handler tests pass - [x] React tests — 11 tests pass (`Schedules.test.tsx`) - [x] Manual: create a template, generate a month, publish, confirm as volunteer - [x] Manual: edit a published shift and verify confirmation resets + notifications appear Closes #2
thatguygriff added 1 commit 2026-04-08 14:41:49 +00:00
Implement Issue #2: Scheduling & Publishing
Some checks failed
CI / Go tests & lint (push) Successful in 1m42s
CI / Frontend tests & type-check (push) Failing after 1m38s
CI / Go tests & lint (pull_request) Successful in 8s
CI / Frontend tests & type-check (pull_request) Failing after 32s
fc88b8f005
Replaces stub schedule CRUD with full shift template + instance system.

- DB: add shift_templates, shift_template_roles, shift_template_volunteers,
  shift_instances, shift_instance_volunteers tables
- schedule package: ShiftTemplate and ShiftInstance models with store
  (generate, publish/unpublish, per-instance edits, volunteer confirmation)
- API: shift-templates CRUD + shifts generate/publish/unpublish/update/confirm
- Notifications sent on publish (FR-S04), unpublish (FR-S05), instance edit
  (FR-S09), and volunteer added mid-month (FR-S10)
- Frontend: Schedules page with month navigation, template management,
  publish/unpublish controls, and per-shift edit/confirm
- Tests: Go handler tests (14 cases) + React tests (11 cases)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 14:48:50 +00:00
Fix Dashboard.tsx: update Schedule refs to ShiftInstance
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 38s
CI / Go tests & lint (pull_request) Successful in 8s
CI / Frontend tests & type-check (pull_request) Successful in 38s
9905234b34
Replace removed Schedule type and api.listSchedules() with
ShiftInstance and api.listShifts() after the schedule rewrite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 17:59:49 +00:00
Fix build and run issues
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 40s
CI / Go tests & lint (pull_request) Successful in 7s
CI / Frontend tests & type-check (pull_request) Successful in 35s
e82a39f2e4
thatguygriff added 1 commit 2026-04-08 20:32:32 +00:00
Add a skill for monitoring gitea actions
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 42s
CI / Go tests & lint (pull_request) Successful in 8s
CI / Frontend tests & type-check (pull_request) Successful in 38s
f29d9669f8
thatguygriff added 2 commits 2026-04-08 22:08:39 +00:00
When the database has no users, the UI redirects to /setup and prompts
for creation of the first admin account. The setup endpoints are
self-disabling — once any user exists, POST /setup/admin returns 403
and the frontend redirects /setup back to /login. The backend uses an
atomic transaction to prevent race conditions on concurrent requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix null volunteers array in shift instance JSON responses
All checks were successful
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Successful in 44s
CI / Go tests & lint (pull_request) Successful in 9s
CI / Frontend tests & type-check (pull_request) Successful in 44s
0af53c9b55
Initialize slice helpers with make() instead of var declaration so
empty results serialize as [] instead of null in JSON, fixing the
frontend TypeError on the schedules page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 22:10:10 +00:00
Fix SPA routing: serve index.html for non-file paths
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 39s
CI / Go tests & lint (pull_request) Successful in 9s
CI / Frontend tests & type-check (pull_request) Successful in 40s
c78a35377a
Replace bare http.FileServer with an SPA-aware handler that tries to
serve the requested static file and falls back to index.html when
the path doesn't match a real file. This lets React Router handle
client-side routes like /schedules on page reload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 22:34:32 +00:00
Persist schedules view and month in the URL
All checks were successful
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Successful in 41s
CI / Go tests & lint (pull_request) Successful in 10s
CI / Frontend tests & type-check (pull_request) Successful in 41s
9473ce24bc
- /schedules?year=2026&month=4 for the shifts view
- /schedules/templates for the templates view
- Month navigation updates search params via useNavigate
- Reloading or sharing a URL restores the exact view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 22:56:22 +00:00
Replace volunteer ID input with checkbox picker on shift edit
All checks were successful
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Successful in 41s
CI / Go tests & lint (pull_request) Successful in 9s
CI / Frontend tests & type-check (pull_request) Successful in 42s
07bf4c2112
The edit form now loads the volunteer list and groups them by
operational role. Template role requirements are shown with a
count indicator (selected/required) that turns green when filled.
Volunteers are selected via checkboxes instead of typing IDs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-04-08 22:59:07 +00:00
Filter out volunteers with approved time off from shift edit picker
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 40s
6575ce8f44
The edit form now fetches approved time-off requests and excludes
volunteers whose time off overlaps the shift date from the
selectable list. Unavailable volunteers are shown below the picker
in a "On approved time off" note.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff merged commit 6575ce8f44 into main 2026-04-08 23:02:18 +00:00
thatguygriff deleted branch feature/issue-2-scheduling 2026-04-08 23:02:18 +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#10