Table of Contents

Class ProjectJoinRequestRepository

Namespace
Builvero.Infrastructure.Repositories
Assembly
Builvero.Infrastructure.dll

Repository implementation for project join request data access operations using Entity Framework Core.

public class ProjectJoinRequestRepository : IProjectJoinRequestRepository
Inheritance
ProjectJoinRequestRepository
Implements
Inherited Members

Remarks

Project join requests allow users to request to join projects. Project owners can approve or decline these requests. Join requests use secure tokens for email-based approval/decline without requiring login.

Constructors

ProjectJoinRequestRepository(ApplicationDbContext)

Initializes a new instance of the ProjectJoinRequestRepository class.

public ProjectJoinRequestRepository(ApplicationDbContext context)

Parameters

context ApplicationDbContext

The Entity Framework database context for data access.

Methods

CreateAsync(ProjectJoinRequest, CancellationToken)

Creates a new project join request in the database.

public Task<ProjectJoinRequest> CreateAsync(ProjectJoinRequest request, CancellationToken cancellationToken = default)

Parameters

request ProjectJoinRequest

The project join request entity to create.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectJoinRequest>

The created project join request entity with its generated ID.

GetByIdAsync(Guid, CancellationToken)

Retrieves a project join request by its unique identifier.

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

Parameters

id Guid

The unique identifier of the join request to retrieve.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectJoinRequest>

The join request with Project, Requester (with Profile), and Owner (with Profile) loaded, or null if not found.

GetByTokenAsync(string, CancellationToken)

Retrieves a project join request by its secure token.

public Task<ProjectJoinRequest?> GetByTokenAsync(string token, CancellationToken cancellationToken = default)

Parameters

token string

The secure token associated with the join request.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectJoinRequest>

The join request with Project, Requester (with Profile), and Owner (with Profile) loaded, or null if not found.

GetIncomingRequestsAsync(Guid, CancellationToken)

Retrieves all pending join requests received by a project owner.

public Task<List<ProjectJoinRequest>> GetIncomingRequestsAsync(Guid ownerUserId, CancellationToken cancellationToken = default)

Parameters

ownerUserId Guid

The unique identifier of the project owner.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<ProjectJoinRequest>>

A list of pending join requests with Project, Requester (with Profile), and Owner (with Profile) loaded, ordered by creation date (newest first).

GetOutgoingRequestsAsync(Guid, CancellationToken)

Retrieves all join requests sent by a user (regardless of status).

public Task<List<ProjectJoinRequest>> GetOutgoingRequestsAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user who sent the join requests.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<ProjectJoinRequest>>

A list of join requests with Project, Requester (with Profile), and Owner (with Profile) loaded, ordered by creation date (newest first).

GetPendingRequestAsync(Guid, Guid, CancellationToken)

Retrieves a pending join request for a specific project and requester.

public Task<ProjectJoinRequest?> GetPendingRequestAsync(Guid projectId, Guid requesterUserId, CancellationToken cancellationToken = default)

Parameters

projectId Guid

The unique identifier of the project.

requesterUserId Guid

The unique identifier of the user who requested to join.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectJoinRequest>

The pending join request if found; otherwise, null.

UpdateAsync(ProjectJoinRequest, CancellationToken)

Updates an existing project join request in the database.

public Task<ProjectJoinRequest> UpdateAsync(ProjectJoinRequest request, CancellationToken cancellationToken = default)

Parameters

request ProjectJoinRequest

The project join request entity to update.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectJoinRequest>

The updated project join request entity.