Class VolunteerApplicationsController
- Namespace
- Builvero.Api.Controllers
- Assembly
- Builvero.Api.dll
Provides public API endpoints for submitting and checking volunteer applications (no authentication required).
[ApiController]
[Route("api/volunteer-applications")]
public class VolunteerApplicationsController : ControllerBase
- Inheritance
-
VolunteerApplicationsController
- Inherited Members
Remarks
This is a public controller - no authentication is required. It provides:
- Submitting volunteer applications with resume upload
- Checking if an email address already has an application (for client-side validation)
- Retrieving application confirmation details (minimal information, no sensitive data)
Resume files are validated for size (max 10MB), file type (PDF, DOC, DOCX), and content type. Applications include comprehensive validation of all required fields including email format, LinkedIn URL format, and minimum word counts for interest and selection reasons.
Error responses include error codes for client-side handling: RESUME_REQUIRED, FILE_TOO_LARGE, UNSUPPORTED_FILE_TYPE, UNSUPPORTED_CONTENT_TYPE, VALIDATION_ERROR, BUSINESS_RULE_VIOLATION, DUPLICATE_APPLICATION, etc.
Constructors
VolunteerApplicationsController(IVolunteerApplicationService, ILogger<VolunteerApplicationsController>)
Initializes a new instance of the VolunteerApplicationsController class.
public VolunteerApplicationsController(IVolunteerApplicationService applicationService, ILogger<VolunteerApplicationsController> logger)
Parameters
applicationServiceIVolunteerApplicationServiceService for volunteer application operations.
loggerILogger<VolunteerApplicationsController>Logger for recording operations and errors.
Methods
CheckEmail(string?, CancellationToken)
Checks if an email address already has a volunteer application (public endpoint for client-side validation).
[HttpGet("check-email")]
public Task<ActionResult<object>> CheckEmail(string? email, CancellationToken cancellationToken)
Parameters
emailstringThe email address to check.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ActionResult<object>>
200 OK: Returns
{ "exists": bool }indicating whether an application exists for the email400 Bad Request: Email address is required or invalid format
500 Internal Server Error: Error checking email
Remarks
Public endpoint (no authentication required). Validates the email format and checks if an application exists for the given email address. Used by the volunteer application form for client-side validation to prevent duplicate applications. The email is validated for format before checking.
GetApplication(Guid, CancellationToken)
Retrieves minimal application information by ID (for confirmation page - no sensitive data exposed).
[HttpGet("{id}")]
public Task<ActionResult<VolunteerApplicationDto>> GetApplication(Guid id, CancellationToken cancellationToken)
Parameters
idGuidThe unique identifier of the application to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ActionResult<VolunteerApplicationDto>>
200 OK: Returns minimal application information (id, roleTitle, fullName, status, createdAtUtc) - no email or resume info
404 Not Found: Application not found
500 Internal Server Error: Error retrieving application
Remarks
Public endpoint (no authentication required). Returns only minimal, non-sensitive information for confirmation pages. Email addresses and resume information are excluded for privacy. Used to display application confirmation after successful submission.
SubmitApplication(IFormFile, string, string, string, string?, string, string?, string, string, string, string?, bool, CancellationToken)
Submits a volunteer application with resume upload (public endpoint, no authentication required).
[HttpPost]
[RequestSizeLimit(10485760)]
[RequestFormLimits(MultipartBodyLengthLimit = 10485760)]
public Task<ActionResult<VolunteerApplicationDto>> SubmitApplication(IFormFile resume, string roleId, string fullName, string email, string? country, string linkedInUrl, string? portfolioUrl, string hoursPerWeek, string interestReason, string selectionReason, string? mobileStackOptionsJson, bool consentGiven, CancellationToken cancellationToken)
Parameters
resumeIFormFileThe resume file (PDF, DOC, or DOCX, max 10MB).
roleIdstringThe unique identifier of the volunteer role being applied for.
fullNamestringThe applicant's full name.
emailstringThe applicant's email address (must be valid format).
countrystringOptional country of residence.
linkedInUrlstringThe applicant's LinkedIn profile URL (must be valid LinkedIn URL).
portfolioUrlstringOptional portfolio or personal website URL.
hoursPerWeekstringThe number of hours per week the applicant can commit.
interestReasonstringReason for interest in the role (minimum 20 words).
selectionReasonstringReason why the applicant should be selected (minimum 20 words).
mobileStackOptionsJsonstringOptional JSON string containing mobile stack preferences.
consentGivenboolIndicates whether the applicant has given consent for data processing (required).
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ActionResult<VolunteerApplicationDto>>
201 Created: Returns created VolunteerApplicationDto with Location header
400 Bad Request: Validation errors (missing fields, invalid email, invalid LinkedIn URL, insufficient word count, etc.)
413 Payload Too Large: Resume file exceeds 10MB limit
415 Unsupported Media Type: Invalid file type or content type
502 Bad Gateway: S3 upload failed
503 Service Unavailable: S3 configuration error
500 Internal Server Error: Unexpected error
Remarks
Public endpoint (no authentication required). Validates all required fields including:
- Full name (required)
- Email (required, must be valid format)
- LinkedIn URL (required, must be valid LinkedIn profile URL)
- Interest reason (required, minimum 20 words)
- Selection reason (required, minimum 20 words)
- Hours per week (required)
- Resume file (required, max 10MB, PDF/DOC/DOCX only)
- Consent (required)
The resume file is uploaded to S3 under the resumes/ prefix. The application is created with status "New". Email notifications are sent to administrators. Error responses include error codes for client-side handling.