Interface IVolunteerApplicationService
- Namespace
- Builvero.Application.Interfaces.Services
- Assembly
- Builvero.Application.dll
Defines the contract for volunteer application operations including creation, retrieval, status updates, and resume management.
public interface IVolunteerApplicationService
Remarks
This interface provides methods for managing volunteer applications throughout their lifecycle. Applications include applicant information, resume upload to S3, and application status tracking. Resume files are stored securely in S3 and managed with presigned URLs for downloads. Application deletion includes S3 cleanup for GDPR compliance.
Methods
CreateApplicationAsync(CreateVolunteerApplicationRequest, Stream, string, string, long, CancellationToken)
Creates a new volunteer application with resume upload to S3.
Task<VolunteerApplicationDto> CreateApplicationAsync(CreateVolunteerApplicationRequest request, Stream resumeStream, string resumeFileName, string resumeContentType, long resumeSizeBytes, CancellationToken cancellationToken = default)
Parameters
requestCreateVolunteerApplicationRequestThe application request containing applicant information and role details.
resumeStreamStreamThe resume file stream to upload.
resumeFileNamestringThe original filename of the resume.
resumeContentTypestringThe MIME content type of the resume file.
resumeSizeByteslongThe size of the resume file in bytes.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<VolunteerApplicationDto>
The created volunteer application DTO.
Exceptions
- Exception
Thrown when email already exists, role not found, role is closed, or resume upload fails.
- ArgumentException
Thrown when hours per week value is invalid.
DeleteApplicationAsync(Guid, CancellationToken)
Deletes a volunteer application and its associated resume from S3 (GDPR compliance - right to be forgotten).
Task<bool> DeleteApplicationAsync(Guid applicationId, CancellationToken cancellationToken = default)
Parameters
applicationIdGuidThe unique identifier of the application to delete.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
EmailExistsAsync(string, CancellationToken)
Checks if an email address already exists in the volunteer applications database.
Task<bool> EmailExistsAsync(string email, CancellationToken cancellationToken = default)
Parameters
emailstringThe email address to check.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
GetApplicationByIdAsync(Guid, CancellationToken)
Retrieves a specific volunteer application by ID.
Task<VolunteerApplicationDto?> GetApplicationByIdAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the application to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<VolunteerApplicationDto>
The application DTO if found; otherwise, null.
GetApplicationsAsync(int, int, Guid?, string?, CancellationToken)
Retrieves a paginated list of volunteer applications with optional filtering by role and status.
Task<(List<VolunteerApplicationDto> Applications, int TotalCount)> GetApplicationsAsync(int page, int pageSize, Guid? roleId = null, string? status = null, CancellationToken cancellationToken = default)
Parameters
pageintThe page number (1-based) to retrieve.
pageSizeintThe number of applications per page.
roleIdGuid?Optional role ID filter to retrieve applications for a specific role.
statusstringOptional status filter (e.g., "New", "Reviewed", "Accepted"). Must match ApplicationStatus enum values (case-insensitive).
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<(List<VolunteerApplicationDto> Applications, int TotalCount)>
A tuple containing the list of applications and the total count matching the filters.
GetResumeDownloadUrlAsync(Guid, CancellationToken)
Generates a presigned URL for downloading a volunteer application's resume from S3.
Task<string> GetResumeDownloadUrlAsync(Guid applicationId, CancellationToken cancellationToken = default)
Parameters
applicationIdGuidThe unique identifier of the application whose resume should be downloaded.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
Exceptions
- Exception
Thrown when the application is not found or the resume S3 key is missing.
UpdateApplicationStatusAsync(Guid, ApplicationStatus, CancellationToken)
Updates the status of a volunteer application.
Task<VolunteerApplicationDto> UpdateApplicationStatusAsync(Guid applicationId, ApplicationStatus status, CancellationToken cancellationToken = default)
Parameters
applicationIdGuidThe unique identifier of the application to update.
statusApplicationStatusThe new status to set. Must be one of: New, Reviewed, or Accepted.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<VolunteerApplicationDto>
The updated application DTO.
Exceptions
- Exception
Thrown when the application is not found.
- ArgumentException
Thrown when the status is Rejected (use discard/delete instead).