UTC Dates + CDisplayEx API Enhancements (#1781)
* Introduced a new claim on the Token to get UserId as well as Username, thus allowing for many places of reduced DB calls. All users will need to reauthenticate. Introduced UTC Dates throughout the application, they are not exposed in all DTOs, that will come later when we fully switch over. For now, Utc dates will be updated along side timezone specific dates. Refactored get-progress/progress api to be 50% faster by reducing how much data is loaded from the query. * Speed up the following apis: collection/search, download/bookmarks, reader/bookmark-info, recommended/quick-reads, recommended/quick-catchup-reads, recommended/highly-rated, recommended/more-in, recommended/rediscover, want-to-read/ * Added a migration to sync all dates with their new UTC counterpart. * Added LastReadingProgressUtc onto ChapterDto for some browsing apis, but not all. Added LastReadingProgressUtc to reading list items. Refactored the migration to run raw SQL which is much faster. * Added LastReadingProgressUtc onto ChapterDto for some browsing apis, but not all. Added LastReadingProgressUtc to reading list items. Refactored the migration to run raw SQL which is much faster. * Fixed the unit tests * Fixed an issue with auto mapper which was causing progress page number to not get sent to UI * series/volume has chapter last reading progress * Added filesize and library name on reading list item dto for CDisplayEx. * Some minor code cleanup * Forgot to fill a field
This commit is contained in:
parent
36b48404c1
commit
7616eb5b0f
58 changed files with 3003 additions and 131 deletions
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using API.DTOs.Metadata;
|
||||
using API.DTOs.Reader;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Interfaces;
|
||||
|
||||
|
@ -11,7 +9,7 @@ namespace API.DTOs;
|
|||
/// A Chapter is the lowest grouping of a reading medium. A Chapter contains a set of MangaFiles which represents the underlying
|
||||
/// file (abstracted from type).
|
||||
/// </summary>
|
||||
public class ChapterDto : IHasReadTimeEstimate
|
||||
public class ChapterDto : IHasReadTimeEstimate, IEntityDate
|
||||
{
|
||||
public int Id { get; init; }
|
||||
/// <summary>
|
||||
|
@ -43,6 +41,10 @@ public class ChapterDto : IHasReadTimeEstimate
|
|||
/// </summary>
|
||||
public int PagesRead { get; set; }
|
||||
/// <summary>
|
||||
/// The last time a chapter was read by current authenticated user
|
||||
/// </summary>
|
||||
public DateTime LastReadingProgressUtc { get; set; }
|
||||
/// <summary>
|
||||
/// If the Cover Image is locked for this entity
|
||||
/// </summary>
|
||||
public bool CoverImageLocked { get; set; }
|
||||
|
@ -53,7 +55,10 @@ public class ChapterDto : IHasReadTimeEstimate
|
|||
/// <summary>
|
||||
/// When chapter was created
|
||||
/// </summary>
|
||||
public DateTime Created { get; init; }
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime LastModified { get; set; }
|
||||
public DateTime CreatedUtc { get; set; }
|
||||
public DateTime LastModifiedUtc { get; set; }
|
||||
/// <summary>
|
||||
/// When the chapter was released.
|
||||
/// </summary>
|
||||
|
@ -77,7 +82,6 @@ public class ChapterDto : IHasReadTimeEstimate
|
|||
/// Total words in a Chapter (books only)
|
||||
/// </summary>
|
||||
public long WordCount { get; set; } = 0L;
|
||||
|
||||
/// <summary>
|
||||
/// Formatted Volume title ie) Volume 2.
|
||||
/// </summary>
|
||||
|
|
|
@ -30,4 +30,8 @@ public class DeviceDto
|
|||
/// Last time this device was used to send a file
|
||||
/// </summary>
|
||||
public DateTime LastUsed { get; set; }
|
||||
/// <summary>
|
||||
/// Last time this device was used to send a file
|
||||
/// </summary>
|
||||
public DateTime LastUsedUtc { get; set; }
|
||||
}
|
||||
|
|
|
@ -20,5 +20,13 @@ public class JobDto
|
|||
/// Last time the job was run
|
||||
/// </summary>
|
||||
public DateTime? LastExecution { get; set; }
|
||||
/// <summary>
|
||||
/// When the job was created
|
||||
/// </summary>
|
||||
public DateTime? CreatedAtUtc { get; set; }
|
||||
/// <summary>
|
||||
/// Last time the job was run
|
||||
/// </summary>
|
||||
public DateTime? LastExecutionUtc { get; set; }
|
||||
public string Cron { get; set; }
|
||||
}
|
||||
|
|
|
@ -16,12 +16,8 @@ public class ProgressDto
|
|||
[Required]
|
||||
public int LibraryId { get; set; }
|
||||
/// <summary>
|
||||
/// For Book reader, this can be an optional string of the id of a part marker, to help resume reading position
|
||||
/// For EPUB reader, this can be an optional string of the id of a part marker, to help resume reading position
|
||||
/// on pages that combine multiple "chapters".
|
||||
/// </summary>
|
||||
public string BookScrollId { get; set; }
|
||||
/// <summary>
|
||||
/// Last time the progress was synced from UI or external app
|
||||
/// </summary>
|
||||
public DateTime LastModified { get; set; }
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public class ReadingListItemDto
|
|||
public int VolumeId { get; set; }
|
||||
public int LibraryId { get; set; }
|
||||
public LibraryType LibraryType { get; set; }
|
||||
public string LibraryName { get; set; }
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// Release Date from Chapter
|
||||
|
@ -28,4 +29,13 @@ public class ReadingListItemDto
|
|||
/// Used internally only
|
||||
/// </summary>
|
||||
public int ReadingListId { get; set; }
|
||||
/// <summary>
|
||||
/// The last time a reading list item (underlying chapter) was read by current authenticated user
|
||||
/// </summary>
|
||||
public DateTime LastReadingProgressUtc { get; set; }
|
||||
/// <summary>
|
||||
/// File size of underlying item
|
||||
/// </summary>
|
||||
/// <remarks>This is only used for CDisplayEx</remarks>
|
||||
public long FileSize { get; set; }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using API.Entities.Enums.Theme;
|
||||
using API.Entities.Interfaces;
|
||||
using API.Services;
|
||||
|
||||
namespace API.DTOs.Theme;
|
||||
|
@ -7,7 +8,7 @@ namespace API.DTOs.Theme;
|
|||
/// <summary>
|
||||
/// Represents a set of css overrides the user can upload to Kavita and will load into webui
|
||||
/// </summary>
|
||||
public class SiteThemeDto
|
||||
public class SiteThemeDto : IEntityDate
|
||||
{
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
|
@ -29,5 +30,7 @@ public class SiteThemeDto
|
|||
public ThemeProvider Provider { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime LastModified { get; set; }
|
||||
public DateTime CreatedUtc { get; set; }
|
||||
public DateTime LastModifiedUtc { get; set; }
|
||||
public string Selector => "bg-" + Name.ToLower();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue