Interface IProjectService
- Namespace
- Builvero.Application.Services
- Assembly
- Builvero.Application.dll
Defines the contract for project management operations.
public interface IProjectService
Remarks
This interface provides methods for creating, retrieving, searching, and managing project memberships. Profile photo URLs for owners and members are automatically converted to presigned URLs (15-minute TTL) to prevent plain S3 URL exposure.
Methods
CreateProjectAsync(Guid, CreateProjectRequest, CancellationToken)
Creates a new project with the specified user as the owner.
Task<ProjectDto> CreateProjectAsync(Guid userId, CreateProjectRequest request, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user creating the project (becomes the owner).
requestCreateProjectRequestThe project creation request containing project details, category, skills, and builder tags.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectDto>
A ProjectDto representing the created project.
Exceptions
- Exception
Thrown when the project category is invalid or other validation errors occur.
GetMyProjectsAsync(Guid, CancellationToken)
Retrieves all projects associated with a user, including projects they own and projects they are members of.
Task<List<ProjectDto>> GetMyProjectsAsync(Guid userId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user whose projects should be retrieved.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<ProjectDto>>
A list of ProjectDto objects representing all projects for the user.
GetProjectAsync(Guid, Guid, CancellationToken)
Retrieves detailed information for a specific project.
Task<ProjectDto> GetProjectAsync(Guid projectId, Guid userId, CancellationToken cancellationToken = default)
Parameters
projectIdGuidThe unique identifier of the project to retrieve.
userIdGuidThe unique identifier of the user requesting the project (used to determine their role).
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectDto>
A ProjectDto containing complete project information.
Exceptions
- Exception
Thrown when the project is not found.
JoinProjectAsync(Guid, Guid, CancellationToken)
Adds a user as a member of a project.
Task JoinProjectAsync(Guid projectId, Guid userId, CancellationToken cancellationToken = default)
Parameters
projectIdGuidThe unique identifier of the project to join.
userIdGuidThe unique identifier of the user joining the project.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for project management operations.
Remarks
Creates an active membership for the user in the project with the "Member" role. If the user is already a member, the operation is idempotent and returns without error.
LeaveProjectAsync(Guid, Guid, CancellationToken)
Removes a user's membership from a project.
Task LeaveProjectAsync(Guid projectId, Guid userId, CancellationToken cancellationToken = default)
Parameters
projectIdGuidThe unique identifier of the project to leave.
userIdGuidThe unique identifier of the user leaving the project.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for project management operations.
Exceptions
- Exception
Thrown when the project is not found, user is not a member, or membership is not active.
- UnauthorizedAccessException
Thrown when the user is the project owner (owners cannot leave their own projects).
SearchProjectsAsync(SearchProjectsRequest, CancellationToken)
Searches and retrieves projects with pagination and optional filtering.
Task<(List<ProjectDto> Projects, int TotalCount)> SearchProjectsAsync(SearchProjectsRequest request, CancellationToken cancellationToken = default)
Parameters
requestSearchProjectsRequestSearch request containing search term, category, status, skills, pagination parameters, and optional filters.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<(List<ProjectDto> Projects, int TotalCount)>
A tuple containing the list of matching projects and the total count of projects matching the search criteria.