-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fetch most recent data from db rather than using the html document
- Loading branch information
Showing
15 changed files
with
135 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...id19Api.UseCases/Queries/CountryStatistics/LoadCurrentStatisticsForCountryQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using AutoMapper; | ||
using Covid19Api.Presentation.Response; | ||
using Covid19Api.Repositories.Abstractions; | ||
using Covid19Api.Services.Abstractions.Loader; | ||
using Covid19Api.UseCases.Abstractions.Queries.CountryStatistics; | ||
using Covid19Api.UseCases.Filter; | ||
using MediatR; | ||
|
||
namespace Covid19Api.UseCases.Queries.CountryStatistics | ||
{ | ||
public class | ||
LoadCurrentStatisticsForCountryQueryHandler : IRequestHandler<LoadCurrentStatisticsForCountryQuery, | ||
CountryStatisticDto> | ||
{ | ||
private readonly IMapper mapper; | ||
private readonly ICountryStatisticsReadRepository countryStatisticsReadRepository; | ||
|
||
public LoadCurrentStatisticsForCountryQueryHandler(IMapper mapper, ICountryStatisticsReadRepository countryStatisticsReadRepository) | ||
{ | ||
this.mapper = mapper; | ||
this.countryStatisticsReadRepository = countryStatisticsReadRepository; | ||
} | ||
|
||
|
||
public async Task<CountryStatisticDto> Handle(LoadCurrentStatisticsForCountryQuery request, | ||
CancellationToken cancellationToken) | ||
{ | ||
var current = await this.countryStatisticsReadRepository.LoadCurrentAsync(request.Country); | ||
|
||
return this.mapper.Map<CountryStatisticDto>(current); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...vid19Api.UseCases/Queries/CountryStatistics/LoadCurrentStatisticsForCountyQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using AutoMapper; | ||
using Covid19Api.Presentation.Response; | ||
using Covid19Api.Repositories.Abstractions; | ||
using Covid19Api.UseCases.Abstractions.Queries.CountryStatistics; | ||
using MediatR; | ||
|
||
namespace Covid19Api.UseCases.Queries.CountryStatistics | ||
{ | ||
public class LoadCurrentStatisticsForCountyQueryHandler : IRequestHandler<LoadCurrentStatisticsForCountyQuery, IEnumerable<CountryStatisticDto>> | ||
{ | ||
private readonly IMapper mapper; | ||
private readonly ICountryStatisticsReadRepository countryStatisticsReadRepository; | ||
|
||
|
||
public LoadCurrentStatisticsForCountyQueryHandler(IMapper mapper, ICountryStatisticsReadRepository countryStatisticsReadRepository) | ||
{ | ||
this.mapper = mapper; | ||
this.countryStatisticsReadRepository = countryStatisticsReadRepository; | ||
} | ||
|
||
public async Task<IEnumerable<CountryStatisticDto>> Handle(LoadCurrentStatisticsForCountyQuery request, | ||
CancellationToken cancellationToken) | ||
{ | ||
var current = await this.countryStatisticsReadRepository.LoadCurrentAsync(); | ||
|
||
return this.mapper.Map<IEnumerable<CountryStatisticDto>>(current).OrderByDescending(country => country!.TotalCases); | ||
} | ||
} | ||
} |
41 changes: 0 additions & 41 deletions
41
...ovid19Api.UseCases/Queries/CountryStatistics/LoadLatestCountriesStatisticsQueryHandler.cs
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
...i.UseCases/Queries/CountryStatistics/LoadLatestCountryStatisticsForCountryQueryHandler.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.