This commit is contained in:
King
2025-09-28 18:54:22 +03:30
parent 9fcc5d9276
commit ad492abdea
28 changed files with 160 additions and 58 deletions
@@ -1,3 +1,6 @@
using BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
using CMSMicroservice.Protobuf.Protos.UserRole;
namespace BackOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
public class CreateNewUserRoleCommandHandler : IRequestHandler<CreateNewUserRoleCommand, CreateNewUserRoleResponseDto>
{
@@ -10,7 +13,8 @@ public class CreateNewUserRoleCommandHandler : IRequestHandler<CreateNewUserRole
public async Task<CreateNewUserRoleResponseDto> Handle(CreateNewUserRoleCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewUserRoleResponseDto();
var response = await _context.UserRoles.CreateNewUserRoleAsync(request.Adapt<CreateNewUserRoleRequest>(), cancellationToken: cancellationToken);
return response.Adapt<CreateNewUserRoleResponseDto>();
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.UserRole;
namespace BackOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
public class DeleteUserRoleCommandHandler : IRequestHandler<DeleteUserRoleCommand, Unit>
{
@@ -10,7 +12,9 @@ public class DeleteUserRoleCommandHandler : IRequestHandler<DeleteUserRoleComman
public async Task<Unit> Handle(DeleteUserRoleCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
await _context.UserRoles.DeleteUserRoleAsync(request.Adapt<DeleteUserRoleRequest>(), cancellationToken: cancellationToken);
return Unit.Value;
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.UserRole;
namespace BackOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole;
public class UpdateUserRoleCommandHandler : IRequestHandler<UpdateUserRoleCommand, Unit>
{
@@ -10,7 +12,8 @@ public class UpdateUserRoleCommandHandler : IRequestHandler<UpdateUserRoleComman
public async Task<Unit> Handle(UpdateUserRoleCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
await _context.UserRoles.UpdateUserRoleAsync(request.Adapt<UpdateUserRoleRequest>(), cancellationToken: cancellationToken);
return Unit.Value;
}
}
@@ -1,3 +1,6 @@
using BackOffice.BFF.Application.UserCQ.Queries.GetAllUserByFilter;
using CMSMicroservice.Protobuf.Protos.UserRole;
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
public class GetAllUserRoleByFilterQueryHandler : IRequestHandler<GetAllUserRoleByFilterQuery, GetAllUserRoleByFilterResponseDto>
{
@@ -10,7 +13,8 @@ public class GetAllUserRoleByFilterQueryHandler : IRequestHandler<GetAllUserRole
public async Task<GetAllUserRoleByFilterResponseDto> Handle(GetAllUserRoleByFilterQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetAllUserRoleByFilterResponseDto();
var response = await _context.UserRoles.GetAllUserRoleByFilterAsync(request.Adapt<GetAllUserRoleByFilterRequest>(), cancellationToken: cancellationToken);
return response.Adapt<GetAllUserRoleByFilterResponseDto>();
}
}
@@ -1,3 +1,6 @@
using BackOffice.BFF.Application.UserCQ.Queries.GetUser;
using CMSMicroservice.Protobuf.Protos.UserRole;
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
public class GetUserRoleQueryHandler : IRequestHandler<GetUserRoleQuery, GetUserRoleResponseDto>
{
@@ -10,7 +13,8 @@ public class GetUserRoleQueryHandler : IRequestHandler<GetUserRoleQuery, GetUser
public async Task<GetUserRoleResponseDto> Handle(GetUserRoleQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetUserRoleResponseDto();
var response = await _context.UserRoles.GetUserRoleAsync(request.Adapt<GetUserRoleRequest>(), cancellationToken: cancellationToken);
return response.Adapt<GetUserRoleResponseDto>();
}
}