Angular 15 (#1765)

* Refactored some code in BookService to make the code easier to understand

* More lint fixes

* Use npm ci for installs in pipeline

* Fixed build system again by deleting nodejs. New build system uses package-lcok going forward.
This commit is contained in:
Joe Milazzo 2023-01-30 10:47:34 -08:00 committed by GitHub
parent 72737ceff2
commit d09e458e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1418 additions and 4984 deletions

View file

@ -402,21 +402,7 @@ public class BookService : IBookService
{
publicationDate = epubBook.Schema.Package.Metadata.Dates.FirstOrDefault()?.Date;
}
var dateParsed = DateTime.TryParse(publicationDate, out var date);
var year = 0;
var month = 0;
var day = 0;
switch (dateParsed)
{
case true:
year = date.Year;
month = date.Month;
day = date.Day;
break;
case false when !string.IsNullOrEmpty(publicationDate) && publicationDate.Length == 4:
int.TryParse(publicationDate, out year);
break;
}
var (year, month, day) = GetPublicationDate(publicationDate);
var info = new ComicInfo()
{
@ -473,7 +459,28 @@ public class BookService : IBookService
return null;
}
#nullable enable
private static (int year, int month, int day) GetPublicationDate(string publicationDate)
{
var dateParsed = DateTime.TryParse(publicationDate, out var date);
var year = 0;
var month = 0;
var day = 0;
switch (dateParsed)
{
case true:
year = date.Year;
month = date.Month;
day = date.Day;
break;
case false when !string.IsNullOrEmpty(publicationDate) && publicationDate.Length == 4:
int.TryParse(publicationDate, out year);
break;
}
return (year, month, day);
}
#nullable enable
private static string ValidateLanguage(string? language)
{
if (string.IsNullOrEmpty(language)) return string.Empty;