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
contextApplicationDbContextThe 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
requestProjectJoinRequestThe project join request entity to create.
cancellationTokenCancellationTokenCancellation 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
idGuidThe unique identifier of the join request to retrieve.
cancellationTokenCancellationTokenCancellation 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
tokenstringThe secure token associated with the join request.
cancellationTokenCancellationTokenCancellation 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
ownerUserIdGuidThe unique identifier of the project owner.
cancellationTokenCancellationTokenCancellation 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
userIdGuidThe unique identifier of the user who sent the join requests.
cancellationTokenCancellationTokenCancellation 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
projectIdGuidThe unique identifier of the project.
requesterUserIdGuidThe unique identifier of the user who requested to join.
cancellationTokenCancellationTokenCancellation 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
requestProjectJoinRequestThe project join request entity to update.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectJoinRequest>
The updated project join request entity.