Skip to content

feat(#679): add ActivityLog entity and CRUD endpoints#704

Merged
arturasmckwcz merged 2 commits into
developfrom
679-activity-log
Jun 23, 2026
Merged

feat(#679): add ActivityLog entity and CRUD endpoints#704
arturasmckwcz merged 2 commits into
developfrom
679-activity-log

Conversation

@arturasmckwcz

Copy link
Copy Markdown
Collaborator

Closes #679

Summary

  • New ActivityLog entity (date + decimal hours, FK → OpportunityVolunteer with CASCADE delete)
  • GET /opportunity-volunteer/:id/activity-log — list all entries with totalHours + count
  • POST /opportunity-volunteer/:id/activity-log — create a new entry
  • PATCH /activity-log/:id — update an entry
  • DELETE /activity-log/:id — remove an entry
  • All endpoints restricted to COORDINATOR | AGENT | ADMIN; reads work for past matches (read-only visibility as agreed in the issue)
  • SDK bumped to 0.0.111 (ApiActivityLogEntry, ApiActivityLogGet, ApiActivityLogPost, ApiActivityLogPatch)
  • Migration add-activity-log creates the table and FK

Test plan

  • GET /opportunity-volunteer/:id/activity-log returns { data, totalHours, count } for a valid OV id
  • POST creates an entry and returns 201 with the created record
  • PATCH updates date / hours on an existing entry
  • DELETE removes the entry; subsequent GET no longer shows it
  • Deleting the parent OpportunityVolunteer cascades and removes its logs
  • VOLUNTEER role receives 401 on all four endpoints
  • Non-existent OV id → 404 on GET / POST; non-existent log id → 404 on PATCH / DELETE

🤖 Generated with Claude Code

arturasmckwcz and others added 2 commits June 23, 2026 13:40
- ActivityLog entity (date + decimal hours) with FK → OpportunityVolunteer (CASCADE)
- GET /opportunity-volunteer/:id/activity-log — returns entries + totalHours + count
- POST /opportunity-volunteer/:id/activity-log — create entry
- PATCH /activity-log/:id — update entry
- DELETE /activity-log/:id — delete entry
- All routes restricted to COORDINATOR | AGENT | ADMIN roles
- SDK upgraded to 0.0.111 (ApiActivityLog* types)
- Migration: add-activity-log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add transformer to decimal `hours` column so pg driver string is
  coerced to number at entity level instead of leaking as "2.50"
- Extract dtoActivityLogEntry / dtoActivityLogGet; route handlers now
  go through DTO instead of returning raw entities
- Remove redundant id <= 0 guards (idParamSchema already enforces minimum: 1)
- Restrict PATCH/DELETE to COORDINATOR role via per-route authenticate()
  option; AGENT retains GET/POST access only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: ActivityLog entity + CRUD endpoints for volunteer session hours

2 participants