Table of Contents

Interface IProjectRepository

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

Defines the contract for project data access operations including retrieval, creation, updates, and search.

public interface IProjectRepository

Remarks

This repository interface provides methods for managing project entities and their associated data. It supports project lookup by ID and user, project creation and updates, and advanced search functionality with filtering by category, skills, status, builder tags, and experience level.

Methods

CreateAsync(Project, CancellationToken)

Creates a new project entity in the database.

Task<Project> CreateAsync(Project project, CancellationToken cancellationToken = default)

Parameters

project Project

The project entity to create.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<Project>

The created project entity with generated ID and timestamps.

GetByIdAsync(Guid, CancellationToken)

Retrieves a project by its unique identifier.

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

Parameters

id Guid

The unique identifier of the project to retrieve.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<Project>

The project entity if found; otherwise, null.

GetByUserIdAsync(Guid, CancellationToken)

Retrieves all projects associated with a specific user (projects they own or are members of).

Task<List<Project>> GetByUserIdAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<Project>>

A list of projects associated with the user.

GetSearchCountAsync(string?, ProjectCategory?, Guid?, string?, CancellationToken)

Gets the total count of projects matching the specified search criteria (legacy search method).

Task<int> GetSearchCountAsync(string? searchTerm, ProjectCategory? category, Guid? builderTagId, string? experienceLevel, CancellationToken cancellationToken = default)

Parameters

searchTerm string

Optional search term for filtering projects by name or description.

category ProjectCategory?

Optional project category filter.

builderTagId Guid?

Optional builder tag ID filter.

experienceLevel string

Optional experience level filter (e.g., "Beginner", "Intermediate", "Expert").

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<int>

The total count of projects matching the search criteria.

GetSearchProjectsCountAsync(string?, List<Guid>?, ProjectStatus?, ProjectCategory?, CancellationToken)

Gets the total count of projects matching the specified search criteria.

Task<int> GetSearchProjectsCountAsync(string? text, List<Guid>? skillIds, ProjectStatus? status, ProjectCategory? category, CancellationToken cancellationToken = default)

Parameters

text string

Optional search text for filtering projects by name or description.

skillIds List<Guid>

Optional list of skill IDs to filter projects by.

status ProjectStatus?

Optional project status filter (e.g., Idea, InProgress, Completed).

category ProjectCategory?

Optional project category filter.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<int>

The total count of projects matching the search criteria.

SearchAsync(string?, ProjectCategory?, Guid?, string?, int, int, CancellationToken)

Searches for projects matching the specified criteria with pagination support (legacy search method).

Task<List<Project>> SearchAsync(string? searchTerm, ProjectCategory? category, Guid? builderTagId, string? experienceLevel, int page, int pageSize, CancellationToken cancellationToken = default)

Parameters

searchTerm string

Optional search term for filtering projects by name or description.

category ProjectCategory?

Optional project category filter.

builderTagId Guid?

Optional builder tag ID filter.

experienceLevel string

Optional experience level filter (e.g., "Beginner", "Intermediate", "Expert").

page int

The page number (1-based) to retrieve.

pageSize int

The number of projects per page.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<Project>>

A list of projects matching the search criteria.

SearchProjectsAsync(string?, List<Guid>?, ProjectStatus?, ProjectCategory?, int, int, CancellationToken)

Searches for projects matching the specified criteria with pagination support.

Task<List<Project>> SearchProjectsAsync(string? text, List<Guid>? skillIds, ProjectStatus? status, ProjectCategory? category, int page, int pageSize, CancellationToken cancellationToken = default)

Parameters

text string

Optional search text for filtering projects by name or description.

skillIds List<Guid>

Optional list of skill IDs to filter projects by.

status ProjectStatus?

Optional project status filter (e.g., Idea, InProgress, Completed).

category ProjectCategory?

Optional project category filter.

page int

The page number (1-based) to retrieve.

pageSize int

The number of projects per page.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<Project>>

A list of projects matching the search criteria.

UpdateAsync(Project, CancellationToken)

Updates an existing project entity in the database.

Task<Project> UpdateAsync(Project project, CancellationToken cancellationToken = default)

Parameters

project Project

The project entity with updated values.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<Project>

The updated project entity.