update
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||
|
||||
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
||||
public class GetAllUserWalletChangeLogQueryHandler : IRequestHandler<GetAllUserWalletChangeLogQuery, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetAllUserWalletChangeLogQueryHandler(IApplicationContractContext context)
|
||||
public GetAllUserWalletChangeLogQueryHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
||||
{
|
||||
_context = context;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(GetAllUserWalletChangeLogQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
await _context.UserWalletChangeLog.GetAllUserWalletChangeLogByFilterAsync(new GetAllUserWalletChangeLogByFilterRequest()
|
||||
{
|
||||
Filter = new GetAllUserWalletChangeLogByFilterFilter()
|
||||
{
|
||||
UserId = _currentUserService.UserId.Value
|
||||
}
|
||||
}, cancellationToken: cancellationToken);
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
|
||||
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetUserWallet;
|
||||
|
||||
public class GetUserWalletQueryHandler : IRequestHandler<GetUserWalletQuery, GetUserWalletResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetUserWalletQueryHandler(IApplicationContractContext context)
|
||||
public GetUserWalletQueryHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
||||
{
|
||||
_context = context;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<GetUserWalletResponseDto> Handle(GetUserWalletQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetUserWalletResponseDto();
|
||||
var userWallet = await _context.UserWallet.GetAllUserWalletByFilterAsync(new GetAllUserWalletByFilterRequest()
|
||||
{
|
||||
Filter = new GetAllUserWalletByFilterFilter()
|
||||
{
|
||||
UserId = _currentUserService.UserId.Value,
|
||||
}
|
||||
});
|
||||
if (userWallet.Models.Count == 0)
|
||||
{
|
||||
throw new NotFoundException("UserWallet", _currentUserService.UserId.Value);
|
||||
}
|
||||
|
||||
return userWallet.Models.FirstOrDefault().Adapt<GetUserWalletResponseDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user