Table of Contents

Interface IVolunteerRoleRepository

Namespace
Builvero.Application.Interfaces.Repositories
Assembly
Builvero.Application.dll

Defines the contract for volunteer role data access operations including retrieval, creation, and updates.

public interface IVolunteerRoleRepository

Remarks

This repository interface provides methods for managing volunteer role entities. Volunteer roles represent available positions for volunteers to apply to. Roles can be active (accepting applications) or closed (not accepting new applications).

Methods

CreateAsync(VolunteerRole, CancellationToken)

Creates a new volunteer role entity in the database.

Task<VolunteerRole> CreateAsync(VolunteerRole role, CancellationToken cancellationToken = default)

Parameters

role VolunteerRole

The volunteer role entity to create.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRole>

The created volunteer role entity with generated ID and timestamps.

GetActiveRolesAsync(CancellationToken)

Retrieves all active volunteer roles (roles that are currently accepting applications).

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

Parameters

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<VolunteerRole>>

A list of active volunteer roles.

GetAllRolesAsync(CancellationToken)

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

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

Parameters

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<VolunteerRole>>

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

GetByIdAsync(Guid, CancellationToken)

Retrieves a volunteer role by its unique identifier.

Task<VolunteerRole?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The unique identifier of the volunteer role to retrieve.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRole>

The volunteer role entity if found; otherwise, null.

GetByKeyAsync(string, CancellationToken)

Retrieves a volunteer role by its unique key identifier.

Task<VolunteerRole?> GetByKeyAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string

The unique key identifier of the volunteer role (e.g., "mobile-developer", "ui-designer").

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRole>

The volunteer role entity if found; otherwise, null.

UpdateAsync(VolunteerRole, CancellationToken)

Updates an existing volunteer role entity in the database.

Task<VolunteerRole> UpdateAsync(VolunteerRole role, CancellationToken cancellationToken = default)

Parameters

role VolunteerRole

The volunteer role entity with updated values.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<VolunteerRole>

The updated volunteer role entity.