From ad492abdeacab101e3f508ace3364d77664b3241 Mon Sep 17 00:00:00 2001 From: King Date: Sun, 28 Sep 2025 18:54:22 +0330 Subject: [PATCH] Update --- .../Interfaces/IApplicationContractContext.cs | 12 ++++++++++-- .../CreateNewRole/CreateNewRoleCommandHandler.cs | 8 ++++++-- .../DeleteRole/DeleteRoleCommandHandler.cs | 7 +++++-- .../UpdateRole/UpdateRoleCommandHandler.cs | 7 +++++-- .../GetAllRoleByFilterQueryHandler.cs | 8 ++++++-- .../Queries/GetRole/GetRoleQueryHandler.cs | 8 ++++++-- .../CreateNewUserAddressCommandHandler.cs | 8 ++++++-- .../DeleteUserAddressCommandHandler.cs | 7 +++++-- .../UpdateUserAddressCommandHandler.cs | 7 +++++-- .../GetAllUserAddressByFilterQueryHandler.cs | 8 ++++++-- .../GetUserAddress/GetUserAddressQueryHandler.cs | 8 ++++++-- .../CreateNewUser/CreateNewUserCommandHandler.cs | 7 +++++-- .../DeleteUser/DeleteUserCommandHandler.cs | 7 +++++-- .../UpdateUser/UpdateUserCommandHandler.cs | 7 +++++-- .../GetAllUserByFilterQueryHandler.cs | 7 +++++-- .../Queries/GetUser/GetUserQueryHandler.cs | 7 +++++-- .../CreateNewUserOrderCommandHandler.cs | 8 ++++++-- .../DeleteUserOrderCommandHandler.cs | 7 +++++-- .../UpdateUserOrderCommandHandler.cs | 7 +++++-- .../GetAllUserOrderByFilterQueryHandler.cs | 8 ++++++-- .../GetUserOrder/GetUserOrderQueryHandler.cs | 8 ++++++-- .../CreateNewUserRoleCommandHandler.cs | 8 ++++++-- .../DeleteUserRoleCommandHandler.cs | 8 ++++++-- .../UpdateUserRoleCommandHandler.cs | 7 +++++-- .../GetAllUserRoleByFilterQueryHandler.cs | 8 ++++++-- .../GetUserRole/GetUserRoleQueryHandler.cs | 8 ++++++-- .../Services/ApplicationContractContext.cs | 16 +++++++++++----- .../BackOffice.BFF.UserOrder.Protobuf.csproj | 2 +- 28 files changed, 160 insertions(+), 58 deletions(-) diff --git a/src/BackOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs b/src/BackOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs index 7ef9830..fcd5592 100644 --- a/src/BackOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs +++ b/src/BackOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs @@ -1,4 +1,9 @@ using CMSMicroservice.Protobuf.Protos.Package; +using CMSMicroservice.Protobuf.Protos.Role; +using CMSMicroservice.Protobuf.Protos.User; +using CMSMicroservice.Protobuf.Protos.UserAddress; +using CMSMicroservice.Protobuf.Protos.UserOrder; +using CMSMicroservice.Protobuf.Protos.UserRole; using FMSMicroservice.Protobuf.Protos.FileInfo; namespace BackOffice.BFF.Application.Common.Interfaces; @@ -6,12 +11,15 @@ namespace BackOffice.BFF.Application.Common.Interfaces; public interface IApplicationContractContext { #region FM - FileInfoContract.FileInfoContractClient FileInfos { get; } - #endregion #region CMS PackageContract.PackageContractClient Packages { get; } + RoleContract.RoleContractClient Roles { get; } + UserAddressContract.UserAddressContractClient UserAddress { get; } + UserContract.UserContractClient Users { get; } + UserOrderContract.UserOrderContractClient UserOrders { get; } + UserRoleContract.UserRoleContractClient UserRoles { get; } #endregion } diff --git a/src/BackOffice.BFF.Application/RoleCQ/Commands/CreateNewRole/CreateNewRoleCommandHandler.cs b/src/BackOffice.BFF.Application/RoleCQ/Commands/CreateNewRole/CreateNewRoleCommandHandler.cs index 2c4770d..f5a126c 100644 --- a/src/BackOffice.BFF.Application/RoleCQ/Commands/CreateNewRole/CreateNewRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/RoleCQ/Commands/CreateNewRole/CreateNewRoleCommandHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser; +using CMSMicroservice.Protobuf.Protos.Role; + namespace BackOffice.BFF.Application.RoleCQ.Commands.CreateNewRole; public class CreateNewRoleCommandHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class CreateNewRoleCommandHandler : IRequestHandler Handle(CreateNewRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new CreateNewRoleResponseDto(); + var response = await _context.Roles.CreateNewRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/RoleCQ/Commands/DeleteRole/DeleteRoleCommandHandler.cs b/src/BackOffice.BFF.Application/RoleCQ/Commands/DeleteRole/DeleteRoleCommandHandler.cs index 2912ae1..c3347ed 100644 --- a/src/BackOffice.BFF.Application/RoleCQ/Commands/DeleteRole/DeleteRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/RoleCQ/Commands/DeleteRole/DeleteRoleCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.Role; + namespace BackOffice.BFF.Application.RoleCQ.Commands.DeleteRole; public class DeleteRoleCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class DeleteRoleCommandHandler : IRequestHandler public async Task Handle(DeleteRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.Roles.DeleteRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/RoleCQ/Commands/UpdateRole/UpdateRoleCommandHandler.cs b/src/BackOffice.BFF.Application/RoleCQ/Commands/UpdateRole/UpdateRoleCommandHandler.cs index 487a327..4b08c38 100644 --- a/src/BackOffice.BFF.Application/RoleCQ/Commands/UpdateRole/UpdateRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/RoleCQ/Commands/UpdateRole/UpdateRoleCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.Role; + namespace BackOffice.BFF.Application.RoleCQ.Commands.UpdateRole; public class UpdateRoleCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class UpdateRoleCommandHandler : IRequestHandler public async Task Handle(UpdateRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.Roles.UpdateRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/RoleCQ/Queries/GetAllRoleByFilter/GetAllRoleByFilterQueryHandler.cs b/src/BackOffice.BFF.Application/RoleCQ/Queries/GetAllRoleByFilter/GetAllRoleByFilterQueryHandler.cs index 8636d63..510a3da 100644 --- a/src/BackOffice.BFF.Application/RoleCQ/Queries/GetAllRoleByFilter/GetAllRoleByFilterQueryHandler.cs +++ b/src/BackOffice.BFF.Application/RoleCQ/Queries/GetAllRoleByFilter/GetAllRoleByFilterQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter; +using CMSMicroservice.Protobuf.Protos.Role; + namespace BackOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter; public class GetAllRoleByFilterQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetAllRoleByFilterQueryHandler : IRequestHandler Handle(GetAllRoleByFilterQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetAllRoleByFilterResponseDto(); + var response = await _context.Roles.GetAllRoleByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/RoleCQ/Queries/GetRole/GetRoleQueryHandler.cs b/src/BackOffice.BFF.Application/RoleCQ/Queries/GetRole/GetRoleQueryHandler.cs index c6ee6d7..1e91d5f 100644 --- a/src/BackOffice.BFF.Application/RoleCQ/Queries/GetRole/GetRoleQueryHandler.cs +++ b/src/BackOffice.BFF.Application/RoleCQ/Queries/GetRole/GetRoleQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.RoleCQ.Queries.GetRole; +using CMSMicroservice.Protobuf.Protos.Role; + namespace BackOffice.BFF.Application.RoleCQ.Queries.GetRole; public class GetRoleQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetRoleQueryHandler : IRequestHandler Handle(GetRoleQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetRoleResponseDto(); + var response = await _context.Roles.GetRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/CreateNewUserAddress/CreateNewUserAddressCommandHandler.cs b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/CreateNewUserAddress/CreateNewUserAddressCommandHandler.cs index 5bc37d5..72c5d51 100644 --- a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/CreateNewUserAddress/CreateNewUserAddressCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/CreateNewUserAddress/CreateNewUserAddressCommandHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser; +using CMSMicroservice.Protobuf.Protos.UserAddress; + namespace BackOffice.BFF.Application.UserAddressCQ.Commands.CreateNewUserAddress; public class CreateNewUserAddressCommandHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class CreateNewUserAddressCommandHandler : IRequestHandler Handle(CreateNewUserAddressCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new CreateNewUserAddressResponseDto(); + var response = await _context.UserAddress.CreateNewUserAddressAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/DeleteUserAddress/DeleteUserAddressCommandHandler.cs b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/DeleteUserAddress/DeleteUserAddressCommandHandler.cs index 1d20d78..47b91e0 100644 --- a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/DeleteUserAddress/DeleteUserAddressCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/DeleteUserAddress/DeleteUserAddressCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserAddress; + namespace BackOffice.BFF.Application.UserAddressCQ.Commands.DeleteUserAddress; public class DeleteUserAddressCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class DeleteUserAddressCommandHandler : IRequestHandler Handle(DeleteUserAddressCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserAddress.DeleteUserAddressAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/UpdateUserAddress/UpdateUserAddressCommandHandler.cs b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/UpdateUserAddress/UpdateUserAddressCommandHandler.cs index e3f93d3..0ca6173 100644 --- a/src/BackOffice.BFF.Application/UserAddressCQ/Commands/UpdateUserAddress/UpdateUserAddressCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserAddressCQ/Commands/UpdateUserAddress/UpdateUserAddressCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserAddress; + namespace BackOffice.BFF.Application.UserAddressCQ.Commands.UpdateUserAddress; public class UpdateUserAddressCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class UpdateUserAddressCommandHandler : IRequestHandler Handle(UpdateUserAddressCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserAddress.UpdateUserAddressAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetAllUserAddressByFilter/GetAllUserAddressByFilterQueryHandler.cs b/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetAllUserAddressByFilter/GetAllUserAddressByFilterQueryHandler.cs index b49f84d..465993e 100644 --- a/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetAllUserAddressByFilter/GetAllUserAddressByFilterQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetAllUserAddressByFilter/GetAllUserAddressByFilterQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Queries.GetAllUserByFilter; +using CMSMicroservice.Protobuf.Protos.UserAddress; + namespace BackOffice.BFF.Application.UserAddressCQ.Queries.GetAllUserAddressByFilter; public class GetAllUserAddressByFilterQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetAllUserAddressByFilterQueryHandler : IRequestHandler Handle(GetAllUserAddressByFilterQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetAllUserAddressByFilterResponseDto(); + var response = await _context.UserAddress.GetAllUserAddressByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetUserAddress/GetUserAddressQueryHandler.cs b/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetUserAddress/GetUserAddressQueryHandler.cs index ee46d91..2853d1a 100644 --- a/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetUserAddress/GetUserAddressQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserAddressCQ/Queries/GetUserAddress/GetUserAddressQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Queries.GetUser; +using CMSMicroservice.Protobuf.Protos.UserAddress; + namespace BackOffice.BFF.Application.UserAddressCQ.Queries.GetUserAddress; public class GetUserAddressQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetUserAddressQueryHandler : IRequestHandler Handle(GetUserAddressQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetUserAddressResponseDto(); + var response = await _context.UserAddress.GetUserAddressAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserCQ/Commands/CreateNewUser/CreateNewUserCommandHandler.cs b/src/BackOffice.BFF.Application/UserCQ/Commands/CreateNewUser/CreateNewUserCommandHandler.cs index a325652..c40eb9d 100644 --- a/src/BackOffice.BFF.Application/UserCQ/Commands/CreateNewUser/CreateNewUserCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserCQ/Commands/CreateNewUser/CreateNewUserCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.User; + namespace BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser; public class CreateNewUserCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class CreateNewUserCommandHandler : IRequestHandler Handle(CreateNewUserCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new CreateNewUserResponseDto(); + var response = await _context.Users.CreateNewUserAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserCQ/Commands/DeleteUser/DeleteUserCommandHandler.cs b/src/BackOffice.BFF.Application/UserCQ/Commands/DeleteUser/DeleteUserCommandHandler.cs index 7570b56..30c7eb5 100644 --- a/src/BackOffice.BFF.Application/UserCQ/Commands/DeleteUser/DeleteUserCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserCQ/Commands/DeleteUser/DeleteUserCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.User; + namespace BackOffice.BFF.Application.UserCQ.Commands.DeleteUser; public class DeleteUserCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class DeleteUserCommandHandler : IRequestHandler public async Task Handle(DeleteUserCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.Users.DeleteUserAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserCQ/Commands/UpdateUser/UpdateUserCommandHandler.cs b/src/BackOffice.BFF.Application/UserCQ/Commands/UpdateUser/UpdateUserCommandHandler.cs index 5ec96f6..7834ae7 100644 --- a/src/BackOffice.BFF.Application/UserCQ/Commands/UpdateUser/UpdateUserCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserCQ/Commands/UpdateUser/UpdateUserCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.User; + namespace BackOffice.BFF.Application.UserCQ.Commands.UpdateUser; public class UpdateUserCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class UpdateUserCommandHandler : IRequestHandler public async Task Handle(UpdateUserCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.Users.UpdateUserAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserCQ/Queries/GetAllUserByFilter/GetAllUserByFilterQueryHandler.cs b/src/BackOffice.BFF.Application/UserCQ/Queries/GetAllUserByFilter/GetAllUserByFilterQueryHandler.cs index 3ecf829..dca2fe9 100644 --- a/src/BackOffice.BFF.Application/UserCQ/Queries/GetAllUserByFilter/GetAllUserByFilterQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserCQ/Queries/GetAllUserByFilter/GetAllUserByFilterQueryHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.User; + namespace BackOffice.BFF.Application.UserCQ.Queries.GetAllUserByFilter; public class GetAllUserByFilterQueryHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class GetAllUserByFilterQueryHandler : IRequestHandler Handle(GetAllUserByFilterQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetAllUserByFilterResponseDto(); + var response = await _context.Users.GetAllUserByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserCQ/Queries/GetUser/GetUserQueryHandler.cs b/src/BackOffice.BFF.Application/UserCQ/Queries/GetUser/GetUserQueryHandler.cs index 27135e0..182e6b0 100644 --- a/src/BackOffice.BFF.Application/UserCQ/Queries/GetUser/GetUserQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserCQ/Queries/GetUser/GetUserQueryHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.User; + namespace BackOffice.BFF.Application.UserCQ.Queries.GetUser; public class GetUserQueryHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class GetUserQueryHandler : IRequestHandler Handle(GetUserQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetUserResponseDto(); + var response = await _context.Users.GetUserAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/CreateNewUserOrder/CreateNewUserOrderCommandHandler.cs b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/CreateNewUserOrder/CreateNewUserOrderCommandHandler.cs index 42ec0b7..fe53cc1 100644 --- a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/CreateNewUserOrder/CreateNewUserOrderCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/CreateNewUserOrder/CreateNewUserOrderCommandHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser; +using CMSMicroservice.Protobuf.Protos.UserOrder; + namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder; public class CreateNewUserOrderCommandHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class CreateNewUserOrderCommandHandler : IRequestHandler Handle(CreateNewUserOrderCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new CreateNewUserOrderResponseDto(); + var response = await _context.UserOrders.CreateNewUserOrderAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/DeleteUserOrder/DeleteUserOrderCommandHandler.cs b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/DeleteUserOrder/DeleteUserOrderCommandHandler.cs index 38cca7f..8f5713c 100644 --- a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/DeleteUserOrder/DeleteUserOrderCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/DeleteUserOrder/DeleteUserOrderCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserOrder; + namespace BackOffice.BFF.Application.UserOrderCQ.Commands.DeleteUserOrder; public class DeleteUserOrderCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class DeleteUserOrderCommandHandler : IRequestHandler Handle(DeleteUserOrderCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserOrders.DeleteUserOrderAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/UpdateUserOrder/UpdateUserOrderCommandHandler.cs b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/UpdateUserOrder/UpdateUserOrderCommandHandler.cs index a0ac407..2763668 100644 --- a/src/BackOffice.BFF.Application/UserOrderCQ/Commands/UpdateUserOrder/UpdateUserOrderCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserOrderCQ/Commands/UpdateUserOrder/UpdateUserOrderCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserOrder; + namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder; public class UpdateUserOrderCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class UpdateUserOrderCommandHandler : IRequestHandler Handle(UpdateUserOrderCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserOrders.UpdateUserOrderAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetAllUserOrderByFilter/GetAllUserOrderByFilterQueryHandler.cs b/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetAllUserOrderByFilter/GetAllUserOrderByFilterQueryHandler.cs index c9a2a1a..e4b788a 100644 --- a/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetAllUserOrderByFilter/GetAllUserOrderByFilterQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetAllUserOrderByFilter/GetAllUserOrderByFilterQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Queries.GetAllUserByFilter; +using CMSMicroservice.Protobuf.Protos.UserOrder; + namespace BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter; public class GetAllUserOrderByFilterQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetAllUserOrderByFilterQueryHandler : IRequestHandler Handle(GetAllUserOrderByFilterQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetAllUserOrderByFilterResponseDto(); + var response = await _context.UserOrders.GetAllUserOrderByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetUserOrder/GetUserOrderQueryHandler.cs b/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetUserOrder/GetUserOrderQueryHandler.cs index 5834783..cf79d34 100644 --- a/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetUserOrder/GetUserOrderQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserOrderCQ/Queries/GetUserOrder/GetUserOrderQueryHandler.cs @@ -1,3 +1,6 @@ +using BackOffice.BFF.Application.UserCQ.Queries.GetUser; +using CMSMicroservice.Protobuf.Protos.UserOrder; + namespace BackOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder; public class GetUserOrderQueryHandler : IRequestHandler { @@ -10,7 +13,8 @@ public class GetUserOrderQueryHandler : IRequestHandler Handle(GetUserOrderQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetUserOrderResponseDto(); + var response = await _context.UserOrders.GetUserOrderAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/CreateNewUserRole/CreateNewUserRoleCommandHandler.cs b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/CreateNewUserRole/CreateNewUserRoleCommandHandler.cs index 9133813..59d9120 100644 --- a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/CreateNewUserRole/CreateNewUserRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/CreateNewUserRole/CreateNewUserRoleCommandHandler.cs @@ -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 { @@ -10,7 +13,8 @@ public class CreateNewUserRoleCommandHandler : IRequestHandler Handle(CreateNewUserRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new CreateNewUserRoleResponseDto(); + var response = await _context.UserRoles.CreateNewUserRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/DeleteUserRole/DeleteUserRoleCommandHandler.cs b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/DeleteUserRole/DeleteUserRoleCommandHandler.cs index 72b1c8c..fb37e1e 100644 --- a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/DeleteUserRole/DeleteUserRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/DeleteUserRole/DeleteUserRoleCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserRole; + namespace BackOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole; public class DeleteUserRoleCommandHandler : IRequestHandler { @@ -10,7 +12,9 @@ public class DeleteUserRoleCommandHandler : IRequestHandler Handle(DeleteUserRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserRoles.DeleteUserRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; + } } diff --git a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/UpdateUserRole/UpdateUserRoleCommandHandler.cs b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/UpdateUserRole/UpdateUserRoleCommandHandler.cs index 4958167..b477a9e 100644 --- a/src/BackOffice.BFF.Application/UserRoleCQ/Commands/UpdateUserRole/UpdateUserRoleCommandHandler.cs +++ b/src/BackOffice.BFF.Application/UserRoleCQ/Commands/UpdateUserRole/UpdateUserRoleCommandHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.UserRole; + namespace BackOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole; public class UpdateUserRoleCommandHandler : IRequestHandler { @@ -10,7 +12,8 @@ public class UpdateUserRoleCommandHandler : IRequestHandler Handle(UpdateUserRoleCommand request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new Unit(); + await _context.UserRoles.UpdateUserRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return Unit.Value; } } diff --git a/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetAllUserRoleByFilter/GetAllUserRoleByFilterQueryHandler.cs b/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetAllUserRoleByFilter/GetAllUserRoleByFilterQueryHandler.cs index 66140ae..0baaea4 100644 --- a/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetAllUserRoleByFilter/GetAllUserRoleByFilterQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetAllUserRoleByFilter/GetAllUserRoleByFilterQueryHandler.cs @@ -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 { @@ -10,7 +13,8 @@ public class GetAllUserRoleByFilterQueryHandler : IRequestHandler Handle(GetAllUserRoleByFilterQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetAllUserRoleByFilterResponseDto(); + var response = await _context.UserRoles.GetAllUserRoleByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetUserRole/GetUserRoleQueryHandler.cs b/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetUserRole/GetUserRoleQueryHandler.cs index 2dad9ff..155a33e 100644 --- a/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetUserRole/GetUserRoleQueryHandler.cs +++ b/src/BackOffice.BFF.Application/UserRoleCQ/Queries/GetUserRole/GetUserRoleQueryHandler.cs @@ -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 { @@ -10,7 +13,8 @@ public class GetUserRoleQueryHandler : IRequestHandler Handle(GetUserRoleQuery request, CancellationToken cancellationToken) { - //TODO: Implement your business logic - return new GetUserRoleResponseDto(); + var response = await _context.UserRoles.GetUserRoleAsync(request.Adapt(), cancellationToken: cancellationToken); + + return response.Adapt(); } } diff --git a/src/BackOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs b/src/BackOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs index e912367..696b2aa 100644 --- a/src/BackOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs +++ b/src/BackOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs @@ -1,5 +1,10 @@ using BackOffice.BFF.Application.Common.Interfaces; using CMSMicroservice.Protobuf.Protos.Package; +using CMSMicroservice.Protobuf.Protos.Role; +using CMSMicroservice.Protobuf.Protos.User; +using CMSMicroservice.Protobuf.Protos.UserAddress; +using CMSMicroservice.Protobuf.Protos.UserOrder; +using CMSMicroservice.Protobuf.Protos.UserRole; using FMSMicroservice.Protobuf.Protos.FileInfo; using Microsoft.Extensions.DependencyInjection; @@ -30,13 +35,14 @@ public class ApplicationContractContext : IApplicationContractContext } #region FM - - //public FileLogContract.FileLogContractClient FileManagements => GetService(); - + public FileInfoContract.FileInfoContractClient FileInfos => GetService(); #endregion #region CMS public PackageContract.PackageContractClient Packages => GetService(); - public FileInfoContract.FileInfoContractClient FileInfos => GetService(); - + public RoleContract.RoleContractClient Roles => GetService(); + public UserAddressContract.UserAddressContractClient UserAddress => GetService(); + public UserContract.UserContractClient Users => GetService(); + public UserOrderContract.UserOrderContractClient UserOrders => GetService(); + public UserRoleContract.UserRoleContractClient UserRoles => GetService(); #endregion } \ No newline at end of file diff --git a/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj b/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj index 6e1b96c..a669207 100644 --- a/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj +++ b/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj @@ -1,4 +1,4 @@ - + net7.0