Convert Projects module to MediatR commands/queries

Replaces IProjectService/ProjectService. IProjectMemberService is
left in place for now — ProjectMembersController still depends on it
until the next task converts it too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 08:47:02 +07:00
co-authored by Claude Sonnet 5
parent 3a926e8693
commit 7e265805c3
12 changed files with 208 additions and 151 deletions
@@ -0,0 +1,16 @@
using AutoMapper;
using MediatR;
using Mws.Application.Common;
namespace Mws.Application.Projects;
public record SearchProjectsQuery(Guid UserId, string Term) : IRequest<List<ProjectDto>>;
public class SearchProjectsHandler(IUnitOfWork uow, IMapper mapper) : IRequestHandler<SearchProjectsQuery, List<ProjectDto>>
{
public async Task<List<ProjectDto>> Handle(SearchProjectsQuery query, CancellationToken ct)
{
var projects = await uow.Projects.SearchForUserAsync(query.UserId, query.Term, ct);
return mapper.Map<List<ProjectDto>>(projects);
}
}