-
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: update dependencies and framework version
* implicit usings * file-scoped namespaces * nuget packages * latest dotnet version
- Loading branch information
Showing
172 changed files
with
2,911 additions
and
3,300 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "6.0.101", | ||
"version": "6.0.201", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
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
24 changes: 11 additions & 13 deletions
24
src/Covid19Api.AutoMapper/VaccinationStatisticToDtoTypeConverter.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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
using System.Linq; | ||
using AutoMapper; | ||
using Covid19Api.Domain; | ||
using Covid19Api.Presentation.Response; | ||
|
||
namespace Covid19Api.AutoMapper | ||
namespace Covid19Api.AutoMapper; | ||
|
||
public class VaccinationStatisticToDtoTypeConverter : ITypeConverter<VaccinationStatistic, VaccinationStatisticDto> | ||
{ | ||
public class VaccinationStatisticToDtoTypeConverter : ITypeConverter<VaccinationStatistic, VaccinationStatisticDto> | ||
public VaccinationStatisticDto Convert(VaccinationStatistic source, VaccinationStatisticDto destination, | ||
ResolutionContext context) | ||
{ | ||
public VaccinationStatisticDto Convert(VaccinationStatistic source, VaccinationStatisticDto destination, | ||
ResolutionContext context) | ||
{ | ||
var values = source.Values.Select(value => new VaccinationStatisticValueDto(value.LoggedAt, | ||
value.TotalVaccinations, value.PeopleVaccinated, value.PeopleFullyVaccinated, | ||
value.PeopleFullyVaccinatedPerHundred, value.DailyVaccinations, | ||
value.TotalVaccinationsPerHundred, value.PeopleVaccinatedPerHundred, | ||
value.DailyVaccinationsPerMillion)); | ||
return new VaccinationStatisticDto(source.Country, source.CountyCode,values.OrderBy(value => value.LoggedAt).ToArray()); | ||
} | ||
var values = source.Values.Select(value => new VaccinationStatisticValueDto(value.LoggedAt, | ||
value.TotalVaccinations, value.PeopleVaccinated, value.PeopleFullyVaccinated, | ||
value.PeopleFullyVaccinatedPerHundred, value.DailyVaccinations, | ||
value.TotalVaccinationsPerHundred, value.PeopleVaccinatedPerHundred, | ||
value.DailyVaccinationsPerMillion)); | ||
return new VaccinationStatisticDto(source.Country, source.CountyCode,values.OrderBy(value => value.LoggedAt).ToArray()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
namespace Covid19Api.Constants | ||
namespace Covid19Api.Constants; | ||
|
||
public static class Urls | ||
{ | ||
public static class Urls | ||
{ | ||
// ReSharper disable once S1075 | ||
// ReSharper disable once S1075 | ||
#pragma warning disable S1075 | ||
public const string Covid19WorldometerUrl = "https://worldometers.info/coronavirus"; | ||
public const string Covid19WorldometerUrl = "https://worldometers.info/coronavirus"; | ||
#pragma warning restore | ||
} | ||
} |
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 |
---|---|---|
@@ -1,68 +1,66 @@ | ||
using System; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
// ReSharper disable UnusedAutoPropertyAccessor.Local | ||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local | ||
// ReSharper disable UnusedAutoPropertyAccessor.Global | ||
|
||
namespace Covid19Api.Domain | ||
namespace Covid19Api.Domain; | ||
|
||
public class CountryStatistic | ||
{ | ||
public class CountryStatistic | ||
{ | ||
public Guid Id { get; private set; } | ||
public Guid Id { get; private set; } | ||
|
||
public string Country { get; private set; } | ||
public string Country { get; private set; } | ||
|
||
public string? CountryCode { get; private set; } | ||
public string? CountryCode { get; private set; } | ||
|
||
public int TotalCases { get; private set; } | ||
public int TotalCases { get; private set; } | ||
|
||
public int NewCases { get; private set; } | ||
public int NewCases { get; private set; } | ||
|
||
public int TotalDeaths { get; private set; } | ||
public int TotalDeaths { get; private set; } | ||
|
||
public int NewDeaths { get; private set; } | ||
public int NewDeaths { get; private set; } | ||
|
||
public int RecoveredCases { get; private set; } | ||
public int RecoveredCases { get; private set; } | ||
|
||
public int ActiveCases { get; private set; } | ||
public int ActiveCases { get; private set; } | ||
|
||
public DateTime FetchedAt { get; private set; } | ||
public DateTime FetchedAt { get; private set; } | ||
|
||
public CountryStatistic(string country, string? countryCode, int totalCases, int newCases, int totalDeaths, | ||
int newDeaths, | ||
int recoveredCases, int activeCases, DateTime fetchedAt) | ||
{ | ||
this.Country = country; | ||
this.CountryCode = countryCode; | ||
this.TotalCases = totalCases; | ||
this.NewCases = newCases; | ||
this.TotalDeaths = totalDeaths; | ||
this.NewDeaths = newDeaths; | ||
this.RecoveredCases = recoveredCases; | ||
this.ActiveCases = activeCases; | ||
this.FetchedAt = fetchedAt; | ||
this.Id = this.Generate(); | ||
} | ||
public CountryStatistic(string country, string? countryCode, int totalCases, int newCases, int totalDeaths, | ||
int newDeaths, | ||
int recoveredCases, int activeCases, DateTime fetchedAt) | ||
{ | ||
this.Country = country; | ||
this.CountryCode = countryCode; | ||
this.TotalCases = totalCases; | ||
this.NewCases = newCases; | ||
this.TotalDeaths = totalDeaths; | ||
this.NewDeaths = newDeaths; | ||
this.RecoveredCases = recoveredCases; | ||
this.ActiveCases = activeCases; | ||
this.FetchedAt = fetchedAt; | ||
this.Id = this.Generate(); | ||
} | ||
|
||
public bool Empty() | ||
{ | ||
return this.TotalCases == 0 && this.NewCases == 0 && | ||
this.TotalDeaths == 0 && this.NewDeaths == 0 && | ||
this.RecoveredCases == 0 && this.ActiveCases == 0; | ||
} | ||
public bool Empty() | ||
{ | ||
return this.TotalCases == 0 && this.NewCases == 0 && | ||
this.TotalDeaths == 0 && this.NewDeaths == 0 && | ||
this.RecoveredCases == 0 && this.ActiveCases == 0; | ||
} | ||
|
||
private Guid Generate() | ||
{ | ||
using var hasher = MD5.Create(); | ||
private Guid Generate() | ||
{ | ||
using var hasher = MD5.Create(); | ||
|
||
var valueToHash = | ||
$"{this.Country}{this.FetchedAt.Date:O}"; | ||
var valueToHash = | ||
$"{this.Country}{this.FetchedAt.Date:O}"; | ||
|
||
var hashed = hasher.ComputeHash(Encoding.UTF8.GetBytes(valueToHash)); | ||
var hashed = hasher.ComputeHash(Encoding.UTF8.GetBytes(valueToHash)); | ||
|
||
return new Guid(hashed); | ||
} | ||
return new Guid(hashed); | ||
} | ||
} |
Oops, something went wrong.