This commit is contained in:
kislovdm
2026-03-10 17:02:08 +03:00
parent 0fb652664f
commit e4ac2e04f7
5 changed files with 84 additions and 24 deletions
@@ -45,7 +45,10 @@ public class PepperClient : IPepperClient
public async Task<IReadOnlyList<Deal>> GetLatestDealsAsync(CancellationToken cancellationToken)
{
using var request = new HttpRequestMessage(HttpMethod.Get, Url);
_logger.LogDebug("Отправка запроса за последними скидками Pepper: {Url}", Url);
using var response = await _httpClient.SendAsync(request, cancellationToken);
_logger.LogDebug("Получен ответ от Pepper: {StatusCode}", (int)response.StatusCode);
response.EnsureSuccessStatusCode();
@@ -58,7 +61,12 @@ public class PepperClient : IPepperClient
return Array.Empty<Deal>();
}
return dto.Deals.Select(MapToDeal).ToArray();
_logger.LogInformation("Успешно распарсен ответ Pepper: всего сделок в ответе {DealCount}", dto.Deals.Count);
var mappedDeals = dto.Deals.Select(MapToDeal).ToArray();
_logger.LogDebug("После маппинга в доменную модель осталось сделок: {MappedCount}", mappedDeals.Length);
return mappedDeals;
}
private static Deal MapToDeal(PepperDeal dto)