Kavita/API/Entities/Device.cs
Joe Milazzo 7616eb5b0f
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
2023-02-11 04:01:24 -08:00

56 lines
1.6 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Net;
using API.Entities.Enums.Device;
using API.Entities.Interfaces;
namespace API.Entities;
/// <summary>
/// A Device is an entity that can receive data from Kavita (kindle)
/// </summary>
public class Device : IEntityDate
{
public int Id { get; set; }
/// <summary>
/// Last Seen IP Address of the device
/// </summary>
public string IpAddress { get; set; }
/// <summary>
/// A name given to this device
/// </summary>
/// <remarks>If this device is web, this will be the browser name</remarks>
/// <example>Pixel 3a, John's Kindle</example>
public string Name { get; set; }
/// <summary>
/// An email address associated with the device (ie Kindle). Will be used with Send to functionality
/// </summary>
public string EmailAddress { get; set; }
/// <summary>
/// Platform (ie) Windows 10
/// </summary>
public DevicePlatform Platform { get; set; }
public int AppUserId { get; set; }
public AppUser AppUser { get; set; }
/// <summary>
/// Last time this device was used to send a file
/// </summary>
public DateTime LastUsed { get; set; }
public DateTime LastUsedUtc { get; set; }
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
public DateTime LastModifiedUtc { get; set; }
public void UpdateLastUsed()
{
LastUsed = DateTime.Now;
LastUsedUtc = DateTime.UtcNow;
}
}