- Introduced a new social-service in the Docker Compose configuration for local development, including build context, environment variables, and health checks. - Updated architecture documentation to reflect the new storage service structure and its components, including user storage quotas and file management. - Enhanced README files to provide clearer instructions on service setup, configuration, and API endpoints for file storage management. - Implemented caching mechanisms in the IAM service client for improved performance and reduced latency in user information retrieval. - Updated appsettings for development to include caching settings for IAM service interactions.
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
namespace WalletService.API.Application.Queries;
|
|
|
|
using MediatR;
|
|
using WalletService.Domain.AggregatesModel.PointAccountAggregate;
|
|
|
|
/// <summary>
|
|
/// EN: Handler for GetPointAccountQuery
|
|
/// VI: Handler cho GetPointAccountQuery
|
|
/// </summary>
|
|
public class GetPointAccountQueryHandler : IRequestHandler<GetPointAccountQuery, PointAccountDto?>
|
|
{
|
|
private readonly IPointAccountRepository _pointAccountRepository;
|
|
|
|
public GetPointAccountQueryHandler(IPointAccountRepository pointAccountRepository)
|
|
{
|
|
_pointAccountRepository = pointAccountRepository;
|
|
}
|
|
|
|
public async Task<PointAccountDto?> Handle(
|
|
GetPointAccountQuery request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var account = await _pointAccountRepository.GetByUserIdAsync(request.UserId);
|
|
|
|
if (account == null)
|
|
return null;
|
|
|
|
return new PointAccountDto(
|
|
account.Id,
|
|
account.UserId,
|
|
account.TotalPoints,
|
|
account.AvailablePoints,
|
|
account.CreatedAt,
|
|
account.UpdatedAt
|
|
);
|
|
}
|
|
}
|