8.0 Volunteering - FatinaAlTaherr/HopeConnect GitHub Wiki
Overview
The Volunteering Event Management System facilitates the organization and participation in volunteer events. It allows administrators to create and manage events while enabling volunteers to register for available opportunities. The system implements role-based access control and maintains relationships between events and volunteers.
Models
Event
Represents a volunteer opportunity or activity.
- Attributes:
id
: Unique identifier (auto-generated)name
: Event title (required)description
: Detailed information about the eventstartDateTime
: Scheduled beginning timeendDateTime
: Scheduled conclusion timelocation
: Physical or virtual venueparticipants
: Set of registered volunteers (many-to-many relationship)organizerEmail
: Contact for event coordinator
Volunteer
Represents a volunteer participant (associated via many-to-many relationship).
- Note: The Volunteer model is referenced but not shown in provided code. Assumed to contain at minimum:
id
: Unique identifieremail
: Unique contact identifier- Other relevant volunteer profile fields
Services
EventService
Handles core business logic for event management.
- Methods:
getAllEvents()
: Retrieves all eventsgetEventById(id)
: Finds specific event by IDcreateEvent(event)
: Creates new event recordupdateEvent(id, updatedEvent)
: Modifies existing eventdeleteEvent(id)
: Removes event permanentlyregisterVolunteer(eventId, volunteerEmail)
: Adds volunteer to event
Controllers
EventController
Handles HTTP requests for event operations.
- Endpoints:
GET /api/events
: Lists all eventsGET /api/events/{id}
: Retrieves specific eventPOST /api/events
: Creates new event (ADMIN only)PUT /api/events/{id}
: Updates event (ADMIN only)DELETE /api/events/{id}
: Deletes event (ADMIN only)POST /api/events/{eventId}/register/{volunteerEmail}
: Registers volunteer (VOLUNTEER only)
Workflows
Event Management
-
Administrator Creates Event:
- ADMIN submits event details via POST endpoint
- System validates and stores new event
- Event becomes visible in public listings
-
Volunteer Registration:
- VOLUNTEER selects event and registers via endpoint
- System verifies volunteer credentials
- Volunteer added to event participants
- Both parties receive confirmation
-
Event Updates:
- ADMIN modifies event details via PUT
- Changes propagate immediately
- Registered volunteers receive notifications
-
Event Cancellation:
- ADMIN removes event via DELETE
- System notifies all registered volunteers
- Event disappears from listings
Security Features
- Role-based access control:
ADMIN
: Full event management privilegesVOLUNTEER
: Self-registration capabilities
- JWT authentication for all endpoints
- Sensitive operations require proper authorization
- Volunteer registration limited to own account
Data Relationships
- Many-to-Many association between Events and Volunteers
- Junction table
volunteer_event_members
maintains relationships - Bi-directional mapping enables efficient queries
Validation
- Event name cannot be blank
- Date/time validation (end after start)
- Email format verification
- Duplicate registration prevention
Error Handling
- 404 for non-existent resources
- 403 for unauthorized actions
- 400 for invalid requests
- 500 for server errors with detailed logging