2023-02-12 18:46:08 +01:00
|
|
|
namespace Application.Game.Card.Read;
|
|
|
|
|
|
|
|
|
2023-02-12 19:12:26 +01:00
|
|
|
public record ReadCoinQuery(long CardId) : IRequestWrapper<string>;
|
2023-02-12 18:46:08 +01:00
|
|
|
|
2023-02-16 17:38:01 +01:00
|
|
|
public class ReadCoinQueryHandler : RequestHandlerBase<ReadCoinQuery, string>
|
2023-02-12 18:46:08 +01:00
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
private const string COIN_XPATH = "/root/coin";
|
|
|
|
|
2023-02-12 18:46:08 +01:00
|
|
|
public ReadCoinQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Task<ServiceResult<string>> Handle(ReadCoinQuery request, CancellationToken cancellationToken)
|
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
var dto = new CoinDto
|
|
|
|
{
|
|
|
|
CardId = request.CardId,
|
|
|
|
CurrentCoins = 900000,
|
|
|
|
MonthlyCoins = 900000,
|
|
|
|
TotalCoins = 900000,
|
|
|
|
Created = "2013-01-01 08:00:00",
|
|
|
|
Modified = "2013-01-01 08:00:00"
|
|
|
|
};
|
|
|
|
|
|
|
|
var result = dto.SerializeCardData(COIN_XPATH);
|
|
|
|
|
|
|
|
return Task.FromResult(new ServiceResult<string>(result));
|
2023-02-12 18:46:08 +01:00
|
|
|
}
|
|
|
|
}
|