Table of Contents

Interface IVolunteerRoleService

Namespace
Builvero.Application.Interfaces.Services
Assembly
Builvero.Application.dll

Defines the contract for volunteer role operations including retrieval, activation, and deactivation.

public interface IVolunteerRoleService

Remarks

This interface provides methods for managing volunteer roles. Active roles are visible to applicants and can receive new applications. Closed roles are hidden from public view and cannot receive new applications.

Methods

CloseRoleAsync(Guid, CancellationToken)

Closes (deactivates) a volunteer role, preventing new applications.

Task<VolunteerRoleDto> CloseRoleAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The unique identifier of the role to close.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRoleDto>

The updated volunteer role DTO.

Exceptions

Exception

Thrown when the role is not found.

GetActiveRolesAsync(CancellationToken)

Retrieves all active volunteer roles (visible to applicants).

Task<List<VolunteerRoleDto>> GetActiveRolesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<VolunteerRoleDto>>

A list of active volunteer role DTOs.

Remarks

Returns only roles where IsActive is true. Used for public display of available volunteer positions.

GetAllRolesAsync(CancellationToken)

Retrieves all volunteer roles including inactive ones (for admin purposes).

Task<List<VolunteerRoleDto>> GetAllRolesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<VolunteerRoleDto>>

A list of all volunteer role DTOs (both active and inactive).

Remarks

Returns all roles regardless of active status. Used by admin interfaces to manage all roles.

OpenRoleAsync(Guid, CancellationToken)

Opens (activates) a volunteer role, allowing new applications.

Task<VolunteerRoleDto> OpenRoleAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The unique identifier of the role to open.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRoleDto>

The updated volunteer role DTO.

Exceptions

Exception

Thrown when the role is not found.