This commit is contained in:
masoodafar-web
2025-11-25 02:46:57 +03:30
parent 50ccd10e24
commit 34f66fcb2d
14 changed files with 457 additions and 420 deletions

View File

@@ -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();
}
}

View File

@@ -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>();
}
}
}