Kavita/API/Entities/AppUser.cs
Joe Milazzo bd19b282d5
Misc Fixes + Enhancements (#1875)
* Moved Collapse Series with relationships into a user preference rather than library setting.

* Fixed bookmarks not converting to webp after initial save

* Fixed a bug where when merging we'd print out a duplicate series error when we shouldn't have

* Fixed a bug where clicking on a genre or tag from server stats wouldn't load all-series page in a filtered state.

* Implemented the ability to have Login role and thus disable accounts.

* Ensure first time flow gets the Login role

* Refactored user management screen so that pending users can be edited or deleted before the end user accepts the invite. A side effect is old legacy users that were here before email was required can now be deleted.

* Show a progress bar under the main series image on larger viewports to show whole series progress.

* Removed code no longer needed

* Cleanup tags, people, collections without connections after editing series metadata.

* Moved the Entity Builders to the main project
2023-03-10 17:09:38 -08:00

73 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using API.Entities.Enums;
using API.Entities.Interfaces;
using Microsoft.AspNetCore.Identity;
namespace API.Entities;
public class AppUser : IdentityUser<int>, IHasConcurrencyToken
{
public DateTime Created { get; set; } = DateTime.Now;
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public DateTime LastActive { get; set; }
public DateTime LastActiveUtc { get; set; }
public ICollection<Library> Libraries { get; set; } = null!;
public ICollection<AppUserRole> UserRoles { get; set; } = null!;
public ICollection<AppUserProgress> Progresses { get; set; } = null!;
public ICollection<AppUserRating> Ratings { get; set; } = null!;
public AppUserPreferences UserPreferences { get; set; } = null!;
/// <summary>
/// Bookmarks associated with this User
/// </summary>
public ICollection<AppUserBookmark> Bookmarks { get; set; } = null!;
/// <summary>
/// Reading lists associated with this user
/// </summary>
public ICollection<ReadingList> ReadingLists { get; set; } = null!;
/// <summary>
/// A list of Series the user want's to read
/// </summary>
public ICollection<Series> WantToRead { get; set; } = null!;
/// <summary>
/// A list of Devices which allows the user to send files to
/// </summary>
public ICollection<Device> Devices { get; set; } = null!;
/// <summary>
/// An API Key to interact with external services, like OPDS
/// </summary>
public string? ApiKey { get; set; }
/// <summary>
/// The confirmation token for the user (invite). This will be set to null after the user confirms.
/// </summary>
public string? ConfirmationToken { get; set; }
/// <summary>
/// The highest age rating the user has access to. Not applicable for admins
/// </summary>
public AgeRating AgeRestriction { get; set; } = AgeRating.NotApplicable;
/// <summary>
/// If an age rating restriction is applied to the account, if Unknowns should be allowed for the user. Defaults to false.
/// </summary>
public bool AgeRestrictionIncludeUnknowns { get; set; } = false;
/// <inheritdoc />
[ConcurrencyCheck]
public uint RowVersion { get; private set; }
/// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
public void UpdateLastActive()
{
LastActive = DateTime.Now;
LastActiveUtc = DateTime.UtcNow;
}
}