Appearance
Backend Feature: RegisterVolunteer
User story
As a person interested in volunteering, I want to register my availability, so that the institute can contact me and I can quickly reach out to them via WhatsApp.
Dependencies
- Entities: Volunteer, Institution
- API specs: POST /volunteers
Acceptance criteria
- [ ] Persists a new volunteer with name, profession, and availability.
- [ ]
availability.daysmust have at least one valid English weekday name; returns 400 otherwise. - [ ]
availability.startTimeandavailability.endTimemust matchHH:MMformat; returns 400 otherwise. - [ ]
availability.endTimemust be afteravailability.startTime; returns 400 otherwise. - [ ] Fetches the institution's WhatsApp number after persisting the volunteer.
- [ ] Returns 422 if the institution has no WhatsApp number registered.
- [ ] Builds and returns a
whatsappUrlwith the pre-filled message and the number prefixed with55. - [ ] Returns 201 with the created volunteer data and
whatsappUrl.
Edge cases
- Institution not seeded or WhatsApp not set: returns 422.
availability.dayscontains an invalid weekday (e.g.segunda): returns 400.availability.endTimeequal toavailability.startTime: returns 400.availability.daysis an empty array: returns 400.
Notes
- The WhatsApp message template: "Olá! Me chamo {name}, sou {profession} e gostaria de me voluntariar no Instituto Padre José. Tenho disponibilidade às {days joined by ', '} das {startTime} às {endTime}."
- The volunteer record is always saved before the WhatsApp URL is built — even if the institution has no WhatsApp, the record is persisted.