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,5 @@
using CMSMicroservice.Protobuf.Protos.User;
namespace BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand, CreateNewUserResponseDto>
{
@@ -10,7 +12,8 @@ public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand,
public async Task<CreateNewUserResponseDto> Handle(CreateNewUserCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new CreateNewUserResponseDto();
var response = await _context.Users.CreateNewUserAsync(request.Adapt<CreateNewUserRequest>(), cancellationToken: cancellationToken);
return response.Adapt<CreateNewUserResponseDto>();
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.User;
namespace BackOffice.BFF.Application.UserCQ.Commands.DeleteUser;
public class DeleteUserCommandHandler : IRequestHandler<DeleteUserCommand, Unit>
{
@@ -10,7 +12,8 @@ public class DeleteUserCommandHandler : IRequestHandler<DeleteUserCommand, Unit>
public async Task<Unit> Handle(DeleteUserCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
await _context.Users.DeleteUserAsync(request.Adapt<DeleteUserRequest>(), cancellationToken: cancellationToken);
return Unit.Value;
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.User;
namespace BackOffice.BFF.Application.UserCQ.Commands.UpdateUser;
public class UpdateUserCommandHandler : IRequestHandler<UpdateUserCommand, Unit>
{
@@ -10,7 +12,8 @@ public class UpdateUserCommandHandler : IRequestHandler<UpdateUserCommand, Unit>
public async Task<Unit> Handle(UpdateUserCommand request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new Unit();
await _context.Users.UpdateUserAsync(request.Adapt<UpdateUserRequest>(), cancellationToken: cancellationToken);
return Unit.Value;
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.User;
namespace BackOffice.BFF.Application.UserCQ.Queries.GetAllUserByFilter;
public class GetAllUserByFilterQueryHandler : IRequestHandler<GetAllUserByFilterQuery, GetAllUserByFilterResponseDto>
{
@@ -10,7 +12,8 @@ public class GetAllUserByFilterQueryHandler : IRequestHandler<GetAllUserByFilter
public async Task<GetAllUserByFilterResponseDto> Handle(GetAllUserByFilterQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetAllUserByFilterResponseDto();
var response = await _context.Users.GetAllUserByFilterAsync(request.Adapt<GetAllUserByFilterRequest>(), cancellationToken: cancellationToken);
return response.Adapt<GetAllUserByFilterResponseDto>();
}
}
@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.User;
namespace BackOffice.BFF.Application.UserCQ.Queries.GetUser;
public class GetUserQueryHandler : IRequestHandler<GetUserQuery, GetUserResponseDto>
{
@@ -10,7 +12,8 @@ public class GetUserQueryHandler : IRequestHandler<GetUserQuery, GetUserResponse
public async Task<GetUserResponseDto> Handle(GetUserQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetUserResponseDto();
var response = await _context.Users.GetUserAsync(request.Adapt<GetUserRequest>(), cancellationToken: cancellationToken);
return response.Adapt<GetUserResponseDto>();
}
}