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:
@@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using MediatR;
|
||||
using Mws.Application.Common;
|
||||
|
||||
namespace Mws.Application.Projects;
|
||||
|
||||
public record GetProjectsQuery(Guid UserId) : IRequest<List<ProjectDto>>;
|
||||
|
||||
public class GetProjectsHandler(IUnitOfWork uow, IMapper mapper) : IRequestHandler<GetProjectsQuery, List<ProjectDto>>
|
||||
{
|
||||
public async Task<List<ProjectDto>> Handle(GetProjectsQuery query, CancellationToken ct)
|
||||
{
|
||||
var projects = await uow.Projects.GetForUserAsync(query.UserId, ct);
|
||||
return mapper.Map<List<ProjectDto>>(projects);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user