2023-02-12 18:46:08 +01:00
|
|
|
namespace Application.Game.Card.Read;
|
|
|
|
|
|
|
|
|
2023-02-12 19:12:26 +01:00
|
|
|
public record ReadNavigatorQuery(long CardId) : IRequestWrapper<string>;
|
2023-02-12 18:46:08 +01:00
|
|
|
|
2023-02-16 17:38:01 +01:00
|
|
|
public class ReadNavigatorQueryHandler : RequestHandlerBase<ReadNavigatorQuery, string>
|
2023-02-12 18:46:08 +01:00
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
private const string NAVIGATOR_XPATH = "/root/navigator/record";
|
2023-02-12 19:12:26 +01:00
|
|
|
|
2023-02-12 18:46:08 +01:00
|
|
|
public ReadNavigatorQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Task<ServiceResult<string>> Handle(ReadNavigatorQuery request, CancellationToken cancellationToken)
|
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
var count = Config.NavigatorCount;
|
|
|
|
|
|
|
|
var list = new List<NavigatorDto>();
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
var navigator = new NavigatorDto
|
|
|
|
{
|
|
|
|
Id = i,
|
|
|
|
CardId = request.CardId,
|
2023-02-16 08:26:13 +01:00
|
|
|
NavigatorId = i + 1,
|
2023-02-13 17:38:19 +01:00
|
|
|
Created = "2013-01-01 08:00:00",
|
|
|
|
Modified = "2013-01-01 08:00:00",
|
|
|
|
NewFlag = 0,
|
2023-02-16 08:26:13 +01:00
|
|
|
UseFlag = i == 10 ? 0 : 1
|
2023-02-13 17:38:19 +01:00
|
|
|
};
|
|
|
|
list.Add(navigator);
|
|
|
|
}
|
|
|
|
|
|
|
|
var result = list.SerializeCardDataList(NAVIGATOR_XPATH);
|
|
|
|
|
|
|
|
return Task.FromResult(new ServiceResult<string>(result));
|
2023-02-12 18:46:08 +01:00
|
|
|
}
|
|
|
|
}
|