Merged v0.5.1 develop into main.

This commit is contained in:
Joseph Milazzo 2022-02-11 09:25:26 -06:00
commit 150479e755
256 changed files with 6898 additions and 1833 deletions

View file

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Account;
public class ConfirmEmailDto
{
[Required]
public string Email { get; set; }
[Required]
public string Token { get; set; }
[Required]
[StringLength(32, MinimumLength = 6)]
public string Password { get; set; }
[Required]
public string Username { get; set; }
}

View file

@ -0,0 +1,7 @@
namespace API.DTOs.Account;
public class ConfirmMigrationEmailDto
{
public string Email { get; set; }
public string Token { get; set; }
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Account;
public class ConfirmPasswordResetDto
{
[Required]
public string Email { get; set; }
[Required]
public string Token { get; set; }
[Required]
[StringLength(32, MinimumLength = 6)]
public string Password { get; set; }
}

View file

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Account;
public class InviteUserDto
{
[Required]
public string Email { get; init; }
/// <summary>
/// List of Roles to assign to user. If admin not present, Pleb will be applied.
/// If admin present, all libraries will be granted access and will ignore those from DTO.
/// </summary>
public ICollection<string> Roles { get; init; }
/// <summary>
/// A list of libraries to grant access to
/// </summary>
public IList<int> Libraries { get; init; }
public bool SendEmail { get; init; } = true;
}

View file

@ -0,0 +1,9 @@
namespace API.DTOs.Account;
public class MigrateUserEmailDto
{
public string Email { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public bool SendEmail { get; set; }
}

View file

@ -0,0 +1,7 @@
namespace API.DTOs.Account;
public class TokenRequestDto
{
public string Token { get; init; }
public string RefreshToken { get; init; }
}

View file

@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace API.DTOs.Account;
public record UpdateUserDto
{
public int UserId { get; set; }
public string Username { get; set; }
/// <summary>
/// This field will not result in any change to the User model. Changing email is not supported.
/// </summary>
public string Email { get; set; }
/// <summary>
/// List of Roles to assign to user. If admin not present, Pleb will be applied.
/// If admin present, all libraries will be granted access and will ignore those from DTO.
/// </summary>
public IList<string> Roles { get; init; }
/// <summary>
/// A list of libraries to grant access to
/// </summary>
public IList<int> Libraries { get; init; }
}

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using API.DTOs.Metadata;
using API.Entities;
namespace API.DTOs
{

View file

@ -0,0 +1,12 @@
namespace API.DTOs.Email;
public class ConfirmationEmailDto
{
public string InvitingUser { get; init; }
public string EmailAddress { get; init; }
public string ServerConfirmationLink { get; init; }
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
public string InstallId { get; init; }
}

View file

@ -0,0 +1,12 @@
namespace API.DTOs.Email;
public class EmailMigrationDto
{
public string EmailAddress { get; init; }
public string Username { get; init; }
public string ServerConfirmationLink { get; init; }
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
public string InstallId { get; init; }
}

View file

@ -0,0 +1,10 @@
namespace API.DTOs.Email;
/// <summary>
/// Represents if Test Email Service URL was successful or not and if any error occured
/// </summary>
public class EmailTestResultDto
{
public bool Successful { get; set; }
public string ErrorMessage { get; set; }
}

View file

@ -0,0 +1,11 @@
namespace API.DTOs.Email;
public class PasswordResetEmailDto
{
public string EmailAddress { get; init; }
public string ServerConfirmationLink { get; init; }
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
public string InstallId { get; init; }
}

View file

@ -0,0 +1,6 @@
namespace API.DTOs.Email;
public class TestEmailDto
{
public string Url { get; set; }
}

View file

@ -80,7 +80,7 @@ namespace API.DTOs.Filtering
/// <summary>
/// Sorting Options for a query. Defaults to null, which uses the queries natural sorting order
/// </summary>
public SortOptions SortOptions { get; init; } = null;
public SortOptions SortOptions { get; set; } = null;
/// <summary>
/// Age Ratings. Empty list will return everything back
/// </summary>

View file

@ -1,6 +1,4 @@
using System;
namespace API.DTOs.Filtering;
namespace API.DTOs.Filtering;
/// <summary>
/// Represents the Reading Status. This is a flag and allows multiple statues

View file

@ -0,0 +1,32 @@
using System;
using API.Entities.Enums;
namespace API.DTOs;
/// <summary>
/// This is a representation of a Series with some amount of underlying files within it. This is used for Recently Updated Series section
/// </summary>
public class GroupedSeriesDto
{
public string SeriesName { get; set; }
public int SeriesId { get; set; }
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
public DateTime Created { get; set; }
/// <summary>
/// Chapter Id if this is a chapter. Not guaranteed to be set.
/// </summary>
public int ChapterId { get; set; } = 0;
/// <summary>
/// Volume Id if this is a chapter. Not guaranteed to be set.
/// </summary>
public int VolumeId { get; set; } = 0;
/// <summary>
/// This is used only on the UI. It is just index of being added.
/// </summary>
public int Id { get; set; }
public MangaFormat Format { get; set; }
/// <summary>
/// Number of items that are updated. This provides a sort of grouping when multiple chapters are added per Volume/Series
/// </summary>
public int Count { get; set; }
}

View file

@ -4,15 +4,16 @@ using System.Collections.Generic;
namespace API.DTOs
{
/// <summary>
/// Represents a member of a Kavita server.
/// Represents a member of a Kavita server.
/// </summary>
public class MemberDto
{
public int Id { get; init; }
public string Username { get; init; }
public string Email { get; init; }
public DateTime Created { get; init; }
public DateTime LastActive { get; init; }
public IEnumerable<LibraryDto> Libraries { get; init; }
public IEnumerable<string> Roles { get; init; }
}
}
}

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace API.DTOs
namespace API.DTOs.Reader
{
public class BookChapterItem
{
@ -16,6 +16,6 @@ namespace API.DTOs
/// Page Number to load for the chapter
/// </summary>
public int Page { get; set; }
public ICollection<BookChapterItem> Children { get; set; }
public ICollection<BookChapterItem> Children { get; set; }
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using API.Entities.Enums;
namespace API.DTOs;
/// <summary>
/// A mesh of data for Recently added volume/chapters
/// </summary>
public class RecentlyAddedItemDto
{
public string SeriesName { get; set; }
public int SeriesId { get; set; }
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
/// <summary>
/// This will automatically map to Volume X, Chapter Y, etc.
/// </summary>
public string Title { get; set; }
public DateTime Created { get; set; }
/// <summary>
/// Chapter Id if this is a chapter. Not guaranteed to be set.
/// </summary>
public int ChapterId { get; set; } = 0;
/// <summary>
/// Volume Id if this is a chapter. Not guaranteed to be set.
/// </summary>
public int VolumeId { get; set; } = 0;
/// <summary>
/// This is used only on the UI. It is just index of being added.
/// </summary>
public int Id { get; set; }
public MangaFormat Format { get; set; }
}

View file

@ -7,8 +7,9 @@ namespace API.DTOs
[Required]
public string Username { get; init; }
[Required]
public string Email { get; init; }
[Required]
[StringLength(32, MinimumLength = 6)]
public string Password { get; set; }
public bool IsAdmin { get; init; }
}
}

View file

@ -1,6 +1,6 @@
using API.Entities.Enums;
namespace API.DTOs
namespace API.DTOs.Search
{
public class SearchResultDto
{

View file

@ -0,0 +1,21 @@
using System.Collections.Generic;
using API.DTOs.CollectionTags;
using API.DTOs.Metadata;
using API.DTOs.ReadingLists;
namespace API.DTOs.Search;
/// <summary>
/// Represents all Search results for a query
/// </summary>
public class SearchResultGroupDto
{
public IEnumerable<LibraryDto> Libraries { get; set; }
public IEnumerable<SearchResultDto> Series { get; set; }
public IEnumerable<CollectionTagDto> Collections { get; set; }
public IEnumerable<ReadingListDto> ReadingLists { get; set; }
public IEnumerable<PersonDto> Persons { get; set; }
public IEnumerable<GenreTagDto> Genres { get; set; }
public IEnumerable<TagDto> Tags { get; set; }
}

View file

@ -23,11 +23,6 @@ namespace API.DTOs.Settings
/// Enables OPDS connections to be made to the server.
/// </summary>
public bool EnableOpds { get; set; }
/// <summary>
/// Enables Authentication on the server. Defaults to true.
/// </summary>
public bool EnableAuthentication { get; set; }
/// <summary>
/// Base Url for the kavita. Requires restart to take effect.
/// </summary>
@ -37,5 +32,10 @@ namespace API.DTOs.Settings
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="DirectoryService.BookmarkDirectory"/></remarks>
public string BookmarksDirectory { get; set; }
/// <summary>
/// Email service to use for the invite user flow, forgot password, etc.
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="EmailService.DefaultApiUrl"/></remarks>
public string EmailServiceUrl { get; set; }
}
}

View file

@ -8,5 +8,7 @@
public string DotnetVersion { get; set; }
public string KavitaVersion { get; set; }
public int NumOfCores { get; set; }
public int NumberOfLibraries { get; set; }
public bool HasBookmarks { get; set; }
}
}

View file

@ -4,7 +4,9 @@ namespace API.DTOs
public class UserDto
{
public string Username { get; init; }
public string Email { get; init; }
public string Token { get; init; }
public string RefreshToken { get; init; }
public string ApiKey { get; init; }
public UserPreferencesDto Preferences { get; set; }
}