Implement time off management (Issue #3) #12

Merged
thatguygriff merged 3 commits from feature/time-off-management into main 2026-04-09 19:09:17 +00:00
Owner

Summary

  • FR-T01/T02/T05: Volunteers can create, edit, and delete their own future time off; admins can manage time off for any volunteer
  • FR-T03: Conflict detection on create — warns about assigned shifts, auto-removes volunteer on confirm, notifies admins
  • FR-T04: Admin delete restores volunteer to previously removed shifts with impact preview
  • FR-T06: Hard block prevents assigning a volunteer to a shift if they have approved time off on that date (409 response)

Changes

  • internal/db/schema.go — new time_off_removed_shifts tracking table
  • internal/timeoff/ — full store + handler rewrite: Storer interface, Update/Delete/ConflictingShifts/RemoveFromShifts/RestoreShifts/HasApprovedTimeOff
  • internal/schedule/handler.goTimeOffChecker interface, FR-T06 conflict check in UpdateInstance
  • internal/volunteer/volunteer.goListAdminIDs for admin notifications
  • internal/server/server.go — new routes: PUT /timeoff/{id}, DELETE /timeoff/{id}, GET /timeoff/{id}/shifts
  • web/src/api.tsApiError class, new API methods, ConflictingShift/TimeOffConflictResponse types
  • web/src/pages/TimeOff.tsx — edit/delete buttons, conflict warning dialog, admin volunteer picker, shift restoration preview

Test plan

  • 16 Go handler tests (internal/timeoff/handler_test.go)
  • 11 React tests (web/src/pages/TimeOff.test.tsx)
  • All existing tests still pass (54 React, all Go packages)
  • Manual: create time off overlapping an assigned shift, verify conflict warning, confirm, verify removal + admin notification
  • Manual: admin deletes time off, verify shift restoration preview, confirm, verify volunteer re-added

Closes #3

## Summary - **FR-T01/T02/T05**: Volunteers can create, edit, and delete their own future time off; admins can manage time off for any volunteer - **FR-T03**: Conflict detection on create — warns about assigned shifts, auto-removes volunteer on confirm, notifies admins - **FR-T04**: Admin delete restores volunteer to previously removed shifts with impact preview - **FR-T06**: Hard block prevents assigning a volunteer to a shift if they have approved time off on that date (409 response) ## Changes - `internal/db/schema.go` — new `time_off_removed_shifts` tracking table - `internal/timeoff/` — full store + handler rewrite: `Storer` interface, Update/Delete/ConflictingShifts/RemoveFromShifts/RestoreShifts/HasApprovedTimeOff - `internal/schedule/handler.go` — `TimeOffChecker` interface, FR-T06 conflict check in UpdateInstance - `internal/volunteer/volunteer.go` — `ListAdminIDs` for admin notifications - `internal/server/server.go` — new routes: `PUT /timeoff/{id}`, `DELETE /timeoff/{id}`, `GET /timeoff/{id}/shifts` - `web/src/api.ts` — `ApiError` class, new API methods, `ConflictingShift`/`TimeOffConflictResponse` types - `web/src/pages/TimeOff.tsx` — edit/delete buttons, conflict warning dialog, admin volunteer picker, shift restoration preview ## Test plan - [x] 16 Go handler tests (internal/timeoff/handler_test.go) - [x] 11 React tests (web/src/pages/TimeOff.test.tsx) - [x] All existing tests still pass (54 React, all Go packages) - [x] Manual: create time off overlapping an assigned shift, verify conflict warning, confirm, verify removal + admin notification - [x] Manual: admin deletes time off, verify shift restoration preview, confirm, verify volunteer re-added Closes #3
thatguygriff added 2 commits 2026-04-09 13:54:31 +00:00
Add full time-off lifecycle: create/edit/delete with shift conflict
detection, auto-removal from conflicting shifts with admin notification,
shift restoration on admin delete, and hard block on assigning volunteers
with approved time off to shifts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move TimeOff test to vite
All checks were successful
CI / Go tests & lint (push) Successful in 7s
CI / Frontend tests & type-check (push) Successful in 26s
CI / Go tests & lint (pull_request) Successful in 7s
CI / Frontend tests & type-check (pull_request) Successful in 24s
704f11cec3
thatguygriff force-pushed feature/time-off-management from 6427595c62 to 704f11cec3 2026-04-09 13:54:31 +00:00 Compare
thatguygriff added 1 commit 2026-04-09 19:07:49 +00:00
Fix time-off date display and improve UI
All checks were successful
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Successful in 29s
CI / Go tests & lint (pull_request) Successful in 9s
CI / Frontend tests & type-check (pull_request) Successful in 25s
975225e650
Scan datetime columns directly into time.Time instead of strings in the
timeoff store — the intermediate string parse silently failed with
parseTime=true, producing zero-value dates. Display dates with month
names and filter admin's own entry from the volunteer dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thatguygriff merged commit 0446e8f8a7 into main 2026-04-09 19:09:17 +00:00
thatguygriff deleted branch feature/time-off-management 2026-04-09 19:09:17 +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#12