Cleanup folder structure again
This commit is contained in:
17
src/Imprink.Application/Commands/Users/GetAllRolesHandler.cs
Normal file
17
src/Imprink.Application/Commands/Users/GetAllRolesHandler.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using Imprink.Application.Dtos;
|
||||
using MediatR;
|
||||
|
||||
namespace Imprink.Application.Commands.Users;
|
||||
|
||||
public record GetAllRolesCommand : IRequest<IEnumerable<RoleDto>>;
|
||||
|
||||
public class GetAllRolesHandler(IUnitOfWork uw, IMapper mapper): IRequestHandler<GetAllRolesCommand, IEnumerable<RoleDto>>
|
||||
{
|
||||
public async Task<IEnumerable<RoleDto>> Handle(GetAllRolesCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var roles = await uw.RoleRepository.GetAllRolesAsync(cancellationToken);
|
||||
|
||||
return mapper.Map<IEnumerable<RoleDto>>(roles);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user