Fix 8 design majors: optional ILogger in libraries, IndexFactoryService singleton threading, SharedMediaTypeRegistry, required TrackDto fields, GetExtensionType dedup, PagedResult zero-guard, TrackService null-return on failure
This commit is contained in:
@@ -4,8 +4,8 @@ public class TrackDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public required string EntryKey { get; set; }
|
||||
public string TrackName { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public required string TrackName { get; set; }
|
||||
public required string Artist { get; set; }
|
||||
public string? Album { get; set; }
|
||||
public string? Genre { get; set; }
|
||||
public DateOnly? ReleaseDate { get; set; }
|
||||
|
||||
@@ -6,7 +6,7 @@ public class PagedResult<T>
|
||||
public int TotalCount { get; set; }
|
||||
public int Page { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public int TotalPages => (int)Math.Ceiling((double)TotalCount / PageSize);
|
||||
public int TotalPages => PageSize > 0 ? (int)Math.Ceiling((double)TotalCount / PageSize) : 0;
|
||||
public bool HasNextPage => Page < TotalPages;
|
||||
public bool HasPreviousPage => Page > 1;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PagedResult<T>
|
||||
|
||||
public PagedResult(IEnumerable<T> items, int totalCount, int page, int pageSize)
|
||||
{
|
||||
Items = items.ToList() ?? new List<T>();
|
||||
Items = items.ToList();
|
||||
TotalCount = totalCount;
|
||||
Page = page;
|
||||
PageSize = pageSize;
|
||||
|
||||
Reference in New Issue
Block a user