Merge branch 'develop' of https://github.com/Kareadita/Kavita into feature/magazine
This commit is contained in:
commit
08a32a26bc
283 changed files with 8056 additions and 2679 deletions
|
@ -8,6 +8,10 @@ public static class EasyCacheProfiles
|
|||
public const string RevokedJwt = "revokedJWT";
|
||||
public const string Favicon = "favicon";
|
||||
/// <summary>
|
||||
/// Images for Publishers
|
||||
/// </summary>
|
||||
public const string Publisher = "publisherImages";
|
||||
/// <summary>
|
||||
/// If a user's license is valid
|
||||
/// </summary>
|
||||
public const string License = "license";
|
||||
|
|
|
@ -6,6 +6,7 @@ using API.Constants;
|
|||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs;
|
||||
using API.DTOs.SeriesDetail;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Person;
|
||||
|
@ -14,8 +15,10 @@ using API.Helpers;
|
|||
using API.Services;
|
||||
using API.Services.Tasks.Scanner.Parser;
|
||||
using API.SignalR;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Nager.ArticleNumber;
|
||||
|
||||
|
@ -27,13 +30,16 @@ public class ChapterController : BaseApiController
|
|||
private readonly ILocalizationService _localizationService;
|
||||
private readonly IEventHub _eventHub;
|
||||
private readonly ILogger<ChapterController> _logger;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public ChapterController(IUnitOfWork unitOfWork, ILocalizationService localizationService, IEventHub eventHub, ILogger<ChapterController> logger)
|
||||
public ChapterController(IUnitOfWork unitOfWork, ILocalizationService localizationService, IEventHub eventHub, ILogger<ChapterController> logger,
|
||||
IMapper mapper)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_localizationService = localizationService;
|
||||
_eventHub = eventHub;
|
||||
_logger = logger;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,7 +68,8 @@ public class ChapterController : BaseApiController
|
|||
{
|
||||
if (User.IsInRole(PolicyConstants.ReadOnlyRole)) return BadRequest(await _localizationService.Translate(User.GetUserId(), "permission-denied"));
|
||||
|
||||
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
|
||||
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId,
|
||||
ChapterIncludes.Files | ChapterIncludes.ExternalReviews | ChapterIncludes.ExternalRatings);
|
||||
if (chapter == null)
|
||||
return BadRequest(_localizationService.Translate(User.GetUserId(), "chapter-doesnt-exist"));
|
||||
|
||||
|
@ -80,6 +87,15 @@ public class ChapterController : BaseApiController
|
|||
_unitOfWork.ChapterRepository.Remove(chapter);
|
||||
}
|
||||
|
||||
// If we removed the volume, do an additional check if we need to delete the actual series as well or not
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(vol.SeriesId, SeriesIncludes.ExternalData | SeriesIncludes.Volumes);
|
||||
var needToRemoveSeries = needToRemoveVolume && series != null && series.Volumes.Count <= 1;
|
||||
if (needToRemoveSeries)
|
||||
{
|
||||
_unitOfWork.SeriesRepository.Remove(series!);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!await _unitOfWork.CommitAsync()) return Ok(false);
|
||||
|
||||
|
@ -89,6 +105,12 @@ public class ChapterController : BaseApiController
|
|||
await _eventHub.SendMessageAsync(MessageFactory.VolumeRemoved, MessageFactory.VolumeRemovedEvent(chapter.VolumeId, vol.SeriesId), false);
|
||||
}
|
||||
|
||||
if (needToRemoveSeries)
|
||||
{
|
||||
await _eventHub.SendMessageAsync(MessageFactory.SeriesRemoved,
|
||||
MessageFactory.SeriesRemovedEvent(series!.Id, series.Name, series.LibraryId), false);
|
||||
}
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
|
@ -391,6 +413,39 @@ public class ChapterController : BaseApiController
|
|||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns Ratings and Reviews for an individual Chapter
|
||||
/// </summary>
|
||||
/// <param name="chapterId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("chapter-detail-plus")]
|
||||
public async Task<ActionResult<ChapterDetailPlusDto>> ChapterDetailPlus([FromQuery] int chapterId)
|
||||
{
|
||||
var ret = new ChapterDetailPlusDto();
|
||||
|
||||
var userReviews = (await _unitOfWork.UserRepository.GetUserRatingDtosForChapterAsync(chapterId, User.GetUserId()))
|
||||
.Where(r => !string.IsNullOrEmpty(r.Body))
|
||||
.OrderByDescending(review => review.Username.Equals(User.GetUsername()) ? 1 : 0)
|
||||
.ToList();
|
||||
|
||||
var ownRating = await _unitOfWork.UserRepository.GetUserChapterRatingAsync(User.GetUserId(), chapterId);
|
||||
if (ownRating != null)
|
||||
{
|
||||
ret.Rating = ownRating.Rating;
|
||||
ret.HasBeenRated = ownRating.HasBeenRated;
|
||||
}
|
||||
|
||||
var externalReviews = await _unitOfWork.ChapterRepository.GetExternalChapterReviewDtos(chapterId);
|
||||
if (externalReviews.Count > 0)
|
||||
{
|
||||
userReviews.AddRange(ReviewHelper.SelectSpectrumOfReviews(externalReviews));
|
||||
}
|
||||
|
||||
ret.Reviews = userReviews;
|
||||
|
||||
ret.Ratings = await _unitOfWork.ChapterRepository.GetExternalChapterRatingDtos(chapterId);
|
||||
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc
|
|||
return Ok(ret);
|
||||
}
|
||||
|
||||
private async Task PrepareSeriesDetail(List<UserReviewDto> userReviews, SeriesDetailPlusDto ret)
|
||||
private async Task PrepareSeriesDetail(List<UserReviewDto> userReviews, SeriesDetailPlusDto? ret)
|
||||
{
|
||||
var isAdmin = User.IsInRole(PolicyConstants.AdminRole);
|
||||
var user = await unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId())!;
|
||||
|
@ -235,12 +235,12 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc
|
|||
ret.Recommendations.OwnedSeries =
|
||||
await unitOfWork.SeriesRepository.GetSeriesDtoByIdsAsync(
|
||||
ret.Recommendations.OwnedSeries.Select(s => s.Id), user);
|
||||
ret.Recommendations.ExternalSeries = new List<ExternalSeriesDto>();
|
||||
ret.Recommendations.ExternalSeries = [];
|
||||
}
|
||||
|
||||
if (ret.Recommendations != null && user != null)
|
||||
{
|
||||
ret.Recommendations.OwnedSeries ??= new List<SeriesDto>();
|
||||
ret.Recommendations.OwnedSeries ??= [];
|
||||
await unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, ret.Recommendations.OwnedSeries);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PluginController(IUnitOfWork unitOfWork, ITokenService tokenService
|
|||
public async Task<ActionResult<UserDto>> Authenticate([Required] string apiKey, [Required] string pluginName)
|
||||
{
|
||||
// NOTE: In order to log information about plugins, we need some Plugin Description information for each request
|
||||
// Should log into access table so we can tell the user
|
||||
// Should log into the access table so we can tell the user
|
||||
var ipAddress = HttpContext.Connection.RemoteIpAddress?.ToString();
|
||||
var userAgent = HttpContext.Request.Headers.UserAgent;
|
||||
var userId = await unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs;
|
||||
using API.Extensions;
|
||||
using API.Services;
|
||||
using API.Services.Plus;
|
||||
using EasyCaching.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
||||
|
@ -21,21 +18,85 @@ namespace API.Controllers;
|
|||
public class RatingController : BaseApiController
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IRatingService _ratingService;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
|
||||
public RatingController(IUnitOfWork unitOfWork)
|
||||
public RatingController(IUnitOfWork unitOfWork, IRatingService ratingService, ILocalizationService localizationService)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
|
||||
_ratingService = ratingService;
|
||||
_localizationService = localizationService;
|
||||
}
|
||||
|
||||
[HttpGet("overall")]
|
||||
public async Task<ActionResult<RatingDto>> GetOverallRating(int seriesId)
|
||||
/// <summary>
|
||||
/// Update the users' rating of the given series
|
||||
/// </summary>
|
||||
/// <param name="updateRating"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UnauthorizedAccessException"></exception>
|
||||
[HttpPost("series")]
|
||||
public async Task<ActionResult> UpdateSeriesRating(UpdateRatingDto updateRating)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
if (user == null) throw new UnauthorizedAccessException();
|
||||
|
||||
if (await _ratingService.UpdateSeriesRating(user, updateRating))
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the users' rating of the given chapter
|
||||
/// </summary>
|
||||
/// <param name="updateRating">chapterId must be set</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UnauthorizedAccessException"></exception>
|
||||
[HttpPost("chapter")]
|
||||
public async Task<ActionResult> UpdateChapterRating(UpdateRatingDto updateRating)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
if (user == null) throw new UnauthorizedAccessException();
|
||||
|
||||
if (await _ratingService.UpdateChapterRating(user, updateRating))
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overall rating from all Kavita users for a given Series
|
||||
/// </summary>
|
||||
/// <param name="seriesId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("overall-series")]
|
||||
public async Task<ActionResult<RatingDto>> GetOverallSeriesRating(int seriesId)
|
||||
{
|
||||
return Ok(new RatingDto()
|
||||
{
|
||||
Provider = ScrobbleProvider.Kavita,
|
||||
AverageScore = await _unitOfWork.SeriesRepository.GetAverageUserRating(seriesId, User.GetUserId()),
|
||||
FavoriteCount = 0
|
||||
FavoriteCount = 0,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overall rating from all Kavita users for a given Chapter
|
||||
/// </summary>
|
||||
/// <param name="chapterId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("overall-chapter")]
|
||||
public async Task<ActionResult<RatingDto>> GetOverallChapterRating(int chapterId)
|
||||
{
|
||||
return Ok(new RatingDto()
|
||||
{
|
||||
Provider = ScrobbleProvider.Kavita,
|
||||
AverageScore = await _unitOfWork.ChapterRepository.GetAverageUserRating(chapterId, User.GetUserId()),
|
||||
FavoriteCount = 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs.SeriesDetail;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Extensions;
|
||||
using API.Helpers.Builders;
|
||||
using API.Services.Plus;
|
||||
|
@ -30,17 +33,17 @@ public class ReviewController : BaseApiController
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the review for a given series
|
||||
/// Updates the user's review for a given series
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<UserReviewDto>> UpdateReview(UpdateUserReviewDto dto)
|
||||
[HttpPost("series")]
|
||||
public async Task<ActionResult<UserReviewDto>> UpdateSeriesReview(UpdateUserReviewDto dto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings);
|
||||
if (user == null) return Unauthorized();
|
||||
|
||||
var ratingBuilder = new RatingBuilder(user.Ratings.FirstOrDefault(r => r.SeriesId == dto.SeriesId));
|
||||
var ratingBuilder = new RatingBuilder(await _unitOfWork.UserRepository.GetUserRatingAsync(dto.SeriesId, user.Id));
|
||||
|
||||
var rating = ratingBuilder
|
||||
.WithBody(dto.Body)
|
||||
|
@ -52,22 +55,58 @@ public class ReviewController : BaseApiController
|
|||
{
|
||||
user.Ratings.Add(rating);
|
||||
}
|
||||
|
||||
_unitOfWork.UserRepository.Update(user);
|
||||
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
|
||||
BackgroundJob.Enqueue(() =>
|
||||
_scrobblingService.ScrobbleReviewUpdate(user.Id, dto.SeriesId, string.Empty, dto.Body));
|
||||
return Ok(_mapper.Map<UserReviewDto>(rating));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the user's review for a given chapter
|
||||
/// </summary>
|
||||
/// <param name="dto">chapterId must be set</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("chapter")]
|
||||
public async Task<ActionResult<UserReviewDto>> UpdateChapterReview(UpdateUserReviewDto dto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.ChapterRatings);
|
||||
if (user == null) return Unauthorized();
|
||||
|
||||
if (dto.ChapterId == null) return BadRequest();
|
||||
|
||||
int chapterId = dto.ChapterId.Value;
|
||||
|
||||
var ratingBuilder = new ChapterRatingBuilder(await _unitOfWork.UserRepository.GetUserChapterRatingAsync(user.Id, chapterId));
|
||||
|
||||
var rating = ratingBuilder
|
||||
.WithBody(dto.Body)
|
||||
.WithSeriesId(dto.SeriesId)
|
||||
.WithChapterId(chapterId)
|
||||
.Build();
|
||||
|
||||
if (rating.Id == 0)
|
||||
{
|
||||
user.ChapterRatings.Add(rating);
|
||||
}
|
||||
|
||||
_unitOfWork.UserRepository.Update(user);
|
||||
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
return Ok(_mapper.Map<UserReviewDto>(rating));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the user's review for the given series
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<ActionResult> DeleteReview(int seriesId)
|
||||
[HttpDelete("series")]
|
||||
public async Task<ActionResult> DeleteSeriesReview([FromQuery] int seriesId)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings);
|
||||
if (user == null) return Unauthorized();
|
||||
|
@ -80,4 +119,23 @@ public class ReviewController : BaseApiController
|
|||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the user's review for the given chapter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("chapter")]
|
||||
public async Task<ActionResult> DeleteChapterReview([FromQuery] int chapterId)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.ChapterRatings);
|
||||
if (user == null) return Unauthorized();
|
||||
|
||||
user.ChapterRatings = user.ChapterRatings.Where(r => r.ChapterId != chapterId).ToList();
|
||||
|
||||
_unitOfWork.UserRepository.Update(user);
|
||||
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,21 +191,6 @@ public class SeriesController : BaseApiController
|
|||
return Ok(await _unitOfWork.ChapterRepository.GetChapterMetadataDtoAsync(chapterId));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update the user rating for the given series
|
||||
/// </summary>
|
||||
/// <param name="updateSeriesRatingDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("update-rating")]
|
||||
public async Task<ActionResult> UpdateSeriesRating(UpdateSeriesRatingDto updateSeriesRatingDto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Ratings);
|
||||
if (!await _seriesService.UpdateRating(user!, updateSeriesRatingDto))
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the Series
|
||||
/// </summary>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class AgeRestrictionDto
|
||||
public sealed record AgeRestrictionDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum age rating a user has access to. -1 if not applicable
|
||||
/// </summary>
|
||||
public required AgeRating AgeRating { get; set; } = AgeRating.NotApplicable;
|
||||
public required AgeRating AgeRating { get; init; } = AgeRating.NotApplicable;
|
||||
/// <summary>
|
||||
/// Are Unknowns explicitly allowed against age rating
|
||||
/// </summary>
|
||||
/// <remarks>Unknown is always lowest and default age rating. Setting this to false will ensure Teen age rating applies and unknowns are still filtered</remarks>
|
||||
public required bool IncludeUnknowns { get; set; } = false;
|
||||
public required bool IncludeUnknowns { get; init; } = false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class ConfirmEmailDto
|
||||
public sealed record ConfirmEmailDto
|
||||
{
|
||||
[Required]
|
||||
public string Email { get; set; } = default!;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class ConfirmEmailUpdateDto
|
||||
public sealed record ConfirmEmailUpdateDto
|
||||
{
|
||||
[Required]
|
||||
public string Email { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Account;
|
||||
|
||||
public class ConfirmMigrationEmailDto
|
||||
public sealed record ConfirmMigrationEmailDto
|
||||
{
|
||||
public string Email { get; set; } = default!;
|
||||
public string Token { get; set; } = default!;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class ConfirmPasswordResetDto
|
||||
public sealed record ConfirmPasswordResetDto
|
||||
{
|
||||
[Required]
|
||||
public string Email { get; set; } = default!;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class InviteUserDto
|
||||
public sealed record InviteUserDto
|
||||
{
|
||||
[Required]
|
||||
public string Email { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Account;
|
||||
|
||||
public class InviteUserResponse
|
||||
public sealed record InviteUserResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Email link used to setup the user account
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace API.DTOs.Account;
|
||||
#nullable enable
|
||||
|
||||
public class LoginDto
|
||||
public sealed record LoginDto
|
||||
{
|
||||
public string Username { get; init; } = default!;
|
||||
public string Password { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Account;
|
||||
|
||||
public class MigrateUserEmailDto
|
||||
public sealed record MigrateUserEmailDto
|
||||
{
|
||||
public string Email { get; set; } = default!;
|
||||
public string Username { get; set; } = default!;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class ResetPasswordDto
|
||||
public sealed record ResetPasswordDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The Username of the User
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Account;
|
||||
|
||||
public class TokenRequestDto
|
||||
public sealed record TokenRequestDto
|
||||
{
|
||||
public string Token { get; init; } = default!;
|
||||
public string RefreshToken { get; init; } = default!;
|
||||
|
|
|
@ -3,7 +3,7 @@ using API.Entities.Enums;
|
|||
|
||||
namespace API.DTOs.Account;
|
||||
|
||||
public class UpdateAgeRestrictionDto
|
||||
public sealed record UpdateAgeRestrictionDto
|
||||
{
|
||||
[Required]
|
||||
public AgeRating AgeRating { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Account;
|
||||
|
||||
public class UpdateEmailDto
|
||||
public sealed record UpdateEmailDto
|
||||
{
|
||||
public string Email { get; set; } = default!;
|
||||
public string Password { get; set; } = default!;
|
||||
|
|
|
@ -4,12 +4,16 @@ using System.ComponentModel.DataAnnotations;
|
|||
namespace API.DTOs.Account;
|
||||
#nullable enable
|
||||
|
||||
public record UpdateUserDto
|
||||
public sealed record UpdateUserDto
|
||||
{
|
||||
/// <inheritdoc cref="API.Entities.AppUser.Id"/>
|
||||
public int UserId { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.AppUser.UserName"/>
|
||||
public string Username { get; set; } = default!;
|
||||
/// <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; } = default!;
|
||||
/// <summary>
|
||||
/// A list of libraries to grant access to
|
||||
|
@ -19,8 +23,6 @@ public record UpdateUserDto
|
|||
/// An Age Rating which will limit the account to seeing everything equal to or below said rating.
|
||||
/// </summary>
|
||||
public AgeRestrictionDto AgeRestriction { get; init; } = default!;
|
||||
/// <summary>
|
||||
/// Email of the user
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.AppUser.Email"/>
|
||||
public string? Email { get; set; } = default!;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs;
|
||||
|
||||
public class BulkActionDto
|
||||
public sealed record BulkActionDto
|
||||
{
|
||||
public List<int> Ids { get; set; }
|
||||
/**
|
||||
|
|
14
API/DTOs/ChapterDetailPlusDto.cs
Normal file
14
API/DTOs/ChapterDetailPlusDto.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using API.DTOs.SeriesDetail;
|
||||
|
||||
namespace API.DTOs;
|
||||
|
||||
public sealed record ChapterDetailPlusDto
|
||||
{
|
||||
public float Rating { get; set; }
|
||||
public bool HasBeenRated { get; set; }
|
||||
|
||||
public IList<UserReviewDto> Reviews { get; set; } = [];
|
||||
public IList<RatingDto> Ratings { get; set; } = [];
|
||||
}
|
|
@ -13,37 +13,24 @@ namespace API.DTOs;
|
|||
/// </summary>
|
||||
public class ChapterDto : IHasReadTimeEstimate, IHasCoverImage
|
||||
{
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Id"/>
|
||||
public int Id { get; init; }
|
||||
/// <summary>
|
||||
/// Range of chapters. Chapter 2-4 -> "2-4". Chapter 2 -> "2". If special, will be special name.
|
||||
/// </summary>
|
||||
/// <remarks>This can be something like 19.HU or Alpha as some comics are like this</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Range"/>
|
||||
public string Range { get; init; } = default!;
|
||||
/// <summary>
|
||||
/// Smallest number of the Range.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Number"/>
|
||||
[Obsolete("Use MinNumber and MaxNumber instead")]
|
||||
public string Number { get; init; } = default!;
|
||||
/// <summary>
|
||||
/// This may be 0 under the circumstance that the Issue is "Alpha" or other non-standard numbers.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.MinNumber"/>
|
||||
public float MinNumber { get; init; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.MaxNumber"/>
|
||||
public float MaxNumber { get; init; }
|
||||
/// <summary>
|
||||
/// The sorting order of the Chapter. Inherits from MinNumber, but can be overridden.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.SortOrder"/>
|
||||
public float SortOrder { get; set; }
|
||||
/// <summary>
|
||||
/// Total number of pages in all MangaFiles
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Pages"/>
|
||||
public int Pages { get; init; }
|
||||
/// <summary>
|
||||
/// If this Chapter contains files that could only be identified as Series or has Special Identifier from filename
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.IsSpecial"/>
|
||||
public bool IsSpecial { get; init; }
|
||||
/// <summary>
|
||||
/// Used for books/specials to display custom title. For non-specials/books, will be set to <see cref="Range"/>
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Title"/>
|
||||
public string Title { get; set; } = default!;
|
||||
/// <summary>
|
||||
/// The files that represent this Chapter
|
||||
|
@ -61,46 +48,25 @@ public class ChapterDto : IHasReadTimeEstimate, IHasCoverImage
|
|||
/// The last time a chapter was read by current authenticated user
|
||||
/// </summary>
|
||||
public DateTime LastReadingProgress { get; set; }
|
||||
/// <summary>
|
||||
/// If the Cover Image is locked for this entity
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.CoverImageLocked"/>
|
||||
public bool CoverImageLocked { get; set; }
|
||||
/// <summary>
|
||||
/// Volume Id this Chapter belongs to
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.VolumeId"/>
|
||||
public int VolumeId { get; init; }
|
||||
/// <summary>
|
||||
/// When chapter was created
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.CreatedUtc"/>
|
||||
public DateTime CreatedUtc { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.LastModifiedUtc"/>
|
||||
public DateTime LastModifiedUtc { get; set; }
|
||||
/// <summary>
|
||||
/// When chapter was created in local server time
|
||||
/// </summary>
|
||||
/// <remarks>This is required for Tachiyomi Extension</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Created"/>
|
||||
public DateTime Created { get; set; }
|
||||
/// <summary>
|
||||
/// When the chapter was released.
|
||||
/// </summary>
|
||||
/// <remarks>Metadata field</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.ReleaseDate"/>
|
||||
public DateTime ReleaseDate { get; init; }
|
||||
/// <summary>
|
||||
/// Title of the Chapter/Issue
|
||||
/// </summary>
|
||||
/// <remarks>Metadata field</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.TitleName"/>
|
||||
public string TitleName { get; set; } = default!;
|
||||
/// <summary>
|
||||
/// Summary of the Chapter
|
||||
/// </summary>
|
||||
/// <remarks>This is not set normally, only for Series Detail</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Summary"/>
|
||||
public string Summary { get; init; } = default!;
|
||||
/// <summary>
|
||||
/// Age Rating for the issue/chapter
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.AgeRating"/>
|
||||
public AgeRating AgeRating { get; init; }
|
||||
/// <summary>
|
||||
/// Total words in a Chapter (books only)
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.WordCount"/>
|
||||
public long WordCount { get; set; } = 0L;
|
||||
/// <summary>
|
||||
/// Formatted Volume title ie) Volume 2.
|
||||
|
@ -113,14 +79,9 @@ public class ChapterDto : IHasReadTimeEstimate, IHasCoverImage
|
|||
public int MaxHoursToRead { get; set; }
|
||||
/// <inheritdoc cref="IHasReadTimeEstimate.AvgHoursToRead"/>
|
||||
public float AvgHoursToRead { get; set; }
|
||||
/// <summary>
|
||||
/// Comma-separated link of urls to external services that have some relation to the Chapter
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.WebLinks"/>
|
||||
public string WebLinks { get; set; }
|
||||
/// <summary>
|
||||
/// ISBN-13 (usually) of the Chapter
|
||||
/// </summary>
|
||||
/// <remarks>This is guaranteed to be Valid</remarks>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.ISBN"/>
|
||||
public string ISBN { get; set; }
|
||||
|
||||
#region Metadata
|
||||
|
@ -146,51 +107,60 @@ public class ChapterDto : IHasReadTimeEstimate, IHasCoverImage
|
|||
/// </summary>
|
||||
public ICollection<TagDto> Tags { get; set; } = new List<TagDto>();
|
||||
public PublicationStatus PublicationStatus { get; set; }
|
||||
/// <summary>
|
||||
/// Language for the Chapter/Issue
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Language"/>
|
||||
public string? Language { get; set; }
|
||||
/// <summary>
|
||||
/// Number in the TotalCount of issues
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.Count"/>
|
||||
public int Count { get; set; }
|
||||
/// <summary>
|
||||
/// Total number of issues for the series
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.TotalCount"/>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <inheritdoc cref="API.Entities.Chapter.LanguageLocked"/>
|
||||
public bool LanguageLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.SummaryLocked"/>
|
||||
public bool SummaryLocked { get; set; }
|
||||
/// <summary>
|
||||
/// Locked by user so metadata updates from scan loop will not override AgeRating
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.Chapter.AgeRatingLocked"/>
|
||||
public bool AgeRatingLocked { get; set; }
|
||||
/// <summary>
|
||||
/// Locked by user so metadata updates from scan loop will not override PublicationStatus
|
||||
/// </summary>
|
||||
public bool PublicationStatusLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.GenresLocked"/>
|
||||
public bool GenresLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.TagsLocked"/>
|
||||
public bool TagsLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.WriterLocked"/>
|
||||
public bool WriterLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.CharacterLocked"/>
|
||||
public bool CharacterLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.ColoristLocked"/>
|
||||
public bool ColoristLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.EditorLocked"/>
|
||||
public bool EditorLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.InkerLocked"/>
|
||||
public bool InkerLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.ImprintLocked"/>
|
||||
public bool ImprintLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.LettererLocked"/>
|
||||
public bool LettererLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.PencillerLocked"/>
|
||||
public bool PencillerLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.PublisherLocked"/>
|
||||
public bool PublisherLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.TranslatorLocked"/>
|
||||
public bool TranslatorLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.TeamLocked"/>
|
||||
public bool TeamLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.LocationLocked"/>
|
||||
public bool LocationLocked { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.CoverArtistLocked"/>
|
||||
public bool CoverArtistLocked { get; set; }
|
||||
public bool ReleaseYearLocked { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public string CoverImage { get; set; }
|
||||
public string PrimaryColor { get; set; } = string.Empty;
|
||||
public string SecondaryColor { get; set; } = string.Empty;
|
||||
/// <inheritdoc cref="API.Entities.Chapter.CoverImage"/>
|
||||
public string? CoverImage { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.Chapter.PrimaryColor"/>
|
||||
public string? PrimaryColor { get; set; } = string.Empty;
|
||||
/// <inheritdoc cref="API.Entities.Chapter.SecondaryColor"/>
|
||||
public string? SecondaryColor { get; set; } = string.Empty;
|
||||
|
||||
public void ResetColorScape()
|
||||
{
|
||||
|
|
|
@ -6,52 +6,52 @@ using API.Services.Plus;
|
|||
namespace API.DTOs.Collection;
|
||||
#nullable enable
|
||||
|
||||
public class AppUserCollectionDto : IHasCoverImage
|
||||
public sealed record AppUserCollectionDto : IHasCoverImage
|
||||
{
|
||||
public int Id { get; init; }
|
||||
public string Title { get; set; } = default!;
|
||||
public string? Summary { get; set; } = default!;
|
||||
public bool Promoted { get; set; }
|
||||
public AgeRating AgeRating { get; set; }
|
||||
public string Title { get; init; } = default!;
|
||||
public string? Summary { get; init; } = default!;
|
||||
public bool Promoted { get; init; }
|
||||
public AgeRating AgeRating { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used to tell the UI if it should request a Cover Image or not. If null or empty, it has not been set.
|
||||
/// </summary>
|
||||
public string? CoverImage { get; set; } = string.Empty;
|
||||
|
||||
public string PrimaryColor { get; set; } = string.Empty;
|
||||
public string SecondaryColor { get; set; } = string.Empty;
|
||||
public bool CoverImageLocked { get; set; }
|
||||
public string? PrimaryColor { get; set; } = string.Empty;
|
||||
public string? SecondaryColor { get; set; } = string.Empty;
|
||||
public bool CoverImageLocked { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of Series in the Collection
|
||||
/// </summary>
|
||||
public int ItemCount { get; set; }
|
||||
public int ItemCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Owner of the Collection
|
||||
/// </summary>
|
||||
public string? Owner { get; set; }
|
||||
public string? Owner { get; init; }
|
||||
/// <summary>
|
||||
/// Last time Kavita Synced the Collection with an upstream source (for non Kavita sourced collections)
|
||||
/// </summary>
|
||||
public DateTime LastSyncUtc { get; set; }
|
||||
public DateTime LastSyncUtc { get; init; }
|
||||
/// <summary>
|
||||
/// Who created/manages the list. Non-Kavita lists are not editable by the user, except to promote
|
||||
/// </summary>
|
||||
public ScrobbleProvider Source { get; set; } = ScrobbleProvider.Kavita;
|
||||
public ScrobbleProvider Source { get; init; } = ScrobbleProvider.Kavita;
|
||||
/// <summary>
|
||||
/// For Non-Kavita sourced collections, the url to sync from
|
||||
/// </summary>
|
||||
public string? SourceUrl { get; set; }
|
||||
public string? SourceUrl { get; init; }
|
||||
/// <summary>
|
||||
/// Total number of items as of the last sync. Not applicable for Kavita managed collections.
|
||||
/// </summary>
|
||||
public int TotalSourceCount { get; set; }
|
||||
public int TotalSourceCount { get; init; }
|
||||
/// <summary>
|
||||
/// A <br/> separated string of all missing series
|
||||
/// </summary>
|
||||
public string? MissingSeriesFromSource { get; set; }
|
||||
public string? MissingSeriesFromSource { get; init; }
|
||||
|
||||
public void ResetColorScape()
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.CollectionTags;
|
||||
|
||||
public class CollectionTagBulkAddDto
|
||||
public sealed record CollectionTagBulkAddDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection Tag Id
|
||||
|
|
|
@ -3,15 +3,21 @@
|
|||
namespace API.DTOs.CollectionTags;
|
||||
|
||||
[Obsolete("Use AppUserCollectionDto")]
|
||||
public class CollectionTagDto
|
||||
public sealed record CollectionTagDto
|
||||
{
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.Id"/>
|
||||
public int Id { get; set; }
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.Title"/>
|
||||
public string Title { get; set; } = default!;
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.Summary"/>
|
||||
public string Summary { get; set; } = default!;
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.Promoted"/>
|
||||
public bool Promoted { get; set; }
|
||||
/// <summary>
|
||||
/// The cover image string. This is used on Frontend to show or hide the Cover Image
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.CoverImage"/>
|
||||
public string CoverImage { get; set; } = default!;
|
||||
/// <inheritdoc cref="API.Entities.CollectionTag.CoverImageLocked"/>
|
||||
public bool CoverImageLocked { get; set; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using API.DTOs.Collection;
|
|||
|
||||
namespace API.DTOs.CollectionTags;
|
||||
|
||||
public class UpdateSeriesForTagDto
|
||||
public sealed record UpdateSeriesForTagDto
|
||||
{
|
||||
public AppUserCollectionDto Tag { get; init; } = default!;
|
||||
public IEnumerable<int> SeriesIdsToRemove { get; init; } = default!;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/// <summary>
|
||||
/// A primary and secondary color
|
||||
/// </summary>
|
||||
public class ColorScape
|
||||
public sealed record ColorScape
|
||||
{
|
||||
public required string? Primary { get; set; }
|
||||
public required string? Secondary { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs;
|
||||
|
||||
public class CopySettingsFromLibraryDto
|
||||
public sealed record CopySettingsFromLibraryDto
|
||||
{
|
||||
public int SourceLibraryId { get; set; }
|
||||
public List<int> TargetLibraryIds { get; set; }
|
||||
|
|
|
@ -3,7 +3,7 @@ using YamlDotNet.Serialization;
|
|||
|
||||
namespace API.DTOs.CoverDb;
|
||||
|
||||
public class CoverDbAuthor
|
||||
public sealed record CoverDbAuthor
|
||||
{
|
||||
[YamlMember(Alias = "name", ApplyNamingConventions = false)]
|
||||
public string Name { get; set; }
|
||||
|
|
|
@ -3,7 +3,7 @@ using YamlDotNet.Serialization;
|
|||
|
||||
namespace API.DTOs.CoverDb;
|
||||
|
||||
public class CoverDbPeople
|
||||
public sealed record CoverDbPeople
|
||||
{
|
||||
[YamlMember(Alias = "people", ApplyNamingConventions = false)]
|
||||
public List<CoverDbAuthor> People { get; set; } = new List<CoverDbAuthor>();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace API.DTOs.CoverDb;
|
||||
#nullable enable
|
||||
|
||||
public class CoverDbPersonIds
|
||||
public sealed record CoverDbPersonIds
|
||||
{
|
||||
[YamlMember(Alias = "hardcover_id", ApplyNamingConventions = false)]
|
||||
public string? HardcoverId { get; set; } = null;
|
||||
|
|
|
@ -4,7 +4,7 @@ using API.Entities.Enums;
|
|||
|
||||
namespace API.DTOs.Dashboard;
|
||||
|
||||
public class DashboardStreamDto
|
||||
public sealed record DashboardStreamDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace API.DTOs.Dashboard;
|
|||
/// <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 sealed record GroupedSeriesDto
|
||||
{
|
||||
public string SeriesName { get; set; } = default!;
|
||||
public int SeriesId { get; set; }
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace API.DTOs.Dashboard;
|
|||
/// <summary>
|
||||
/// A mesh of data for Recently added volume/chapters
|
||||
/// </summary>
|
||||
public class RecentlyAddedItemDto
|
||||
public sealed record RecentlyAddedItemDto
|
||||
{
|
||||
public string SeriesName { get; set; } = default!;
|
||||
public int SeriesId { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Dashboard;
|
||||
|
||||
public class SmartFilterDto
|
||||
public sealed record SmartFilterDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Dashboard;
|
||||
|
||||
public class UpdateDashboardStreamPositionDto
|
||||
public sealed record UpdateDashboardStreamPositionDto
|
||||
{
|
||||
public int FromPosition { get; set; }
|
||||
public int ToPosition { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Dashboard;
|
||||
|
||||
public class UpdateStreamPositionDto
|
||||
public sealed record UpdateStreamPositionDto
|
||||
{
|
||||
public int FromPosition { get; set; }
|
||||
public int ToPosition { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs;
|
||||
|
||||
public class DeleteChaptersDto
|
||||
public sealed record DeleteChaptersDto
|
||||
{
|
||||
public IList<int> ChapterIds { get; set; } = default!;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs;
|
||||
|
||||
public class DeleteSeriesDto
|
||||
public sealed record DeleteSeriesDto
|
||||
{
|
||||
public IList<int> SeriesIds { get; set; } = default!;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using API.Entities.Enums.Device;
|
|||
|
||||
namespace API.DTOs.Device;
|
||||
|
||||
public class CreateDeviceDto
|
||||
public sealed record CreateDeviceDto
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; } = default!;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace API.DTOs.Device;
|
|||
/// <summary>
|
||||
/// A Device is an entity that can receive data from Kavita (kindle)
|
||||
/// </summary>
|
||||
public class DeviceDto
|
||||
public sealed record DeviceDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The device Id
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Device;
|
||||
|
||||
public class SendSeriesToDeviceDto
|
||||
public sealed record SendSeriesToDeviceDto
|
||||
{
|
||||
public int DeviceId { get; set; }
|
||||
public int SeriesId { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Device;
|
||||
|
||||
public class SendToDeviceDto
|
||||
public sealed record SendToDeviceDto
|
||||
{
|
||||
public int DeviceId { get; set; }
|
||||
public IReadOnlyList<int> ChapterIds { get; set; } = default!;
|
||||
|
|
|
@ -3,7 +3,7 @@ using API.Entities.Enums.Device;
|
|||
|
||||
namespace API.DTOs.Device;
|
||||
|
||||
public class UpdateDeviceDto
|
||||
public sealed record UpdateDeviceDto
|
||||
{
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
|
|
@ -4,7 +4,7 @@ using API.DTOs.Reader;
|
|||
|
||||
namespace API.DTOs.Downloads;
|
||||
|
||||
public class DownloadBookmarkDto
|
||||
public sealed record DownloadBookmarkDto
|
||||
{
|
||||
[Required]
|
||||
public IEnumerable<BookmarkDto> Bookmarks { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Email;
|
||||
|
||||
public class ConfirmationEmailDto
|
||||
public sealed record ConfirmationEmailDto
|
||||
{
|
||||
public string InvitingUser { get; init; } = default!;
|
||||
public string EmailAddress { get; init; } = default!;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Email;
|
||||
|
||||
public class EmailHistoryDto
|
||||
public sealed record EmailHistoryDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public bool Sent { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Email;
|
||||
|
||||
public class EmailMigrationDto
|
||||
public sealed record EmailMigrationDto
|
||||
{
|
||||
public string EmailAddress { get; init; } = default!;
|
||||
public string Username { get; init; } = default!;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// Represents if Test Email Service URL was successful or not and if any error occured
|
||||
/// </summary>
|
||||
public class EmailTestResultDto
|
||||
public sealed record EmailTestResultDto
|
||||
{
|
||||
public bool Successful { get; set; }
|
||||
public string ErrorMessage { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Email;
|
||||
|
||||
public class PasswordResetEmailDto
|
||||
public sealed record PasswordResetEmailDto
|
||||
{
|
||||
public string EmailAddress { get; init; } = default!;
|
||||
public string ServerConfirmationLink { get; init; } = default!;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Email;
|
||||
|
||||
public class SendToDto
|
||||
public sealed record SendToDto
|
||||
{
|
||||
public string DestinationEmail { get; set; } = default!;
|
||||
public IEnumerable<string> FilePaths { get; set; } = default!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Email;
|
||||
|
||||
public class TestEmailDto
|
||||
public sealed record TestEmailDto
|
||||
{
|
||||
public string Url { get; set; } = default!;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using API.Entities.Enums;
|
|||
namespace API.DTOs.Filtering;
|
||||
#nullable enable
|
||||
|
||||
public class FilterDto
|
||||
public sealed record FilterDto
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of Formats you want to be returned. An empty list will return all formats back
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Filtering;
|
||||
|
||||
public class LanguageDto
|
||||
public sealed record LanguageDto
|
||||
{
|
||||
public required string IsoCode { get; set; }
|
||||
public required string Title { get; set; }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/// <summary>
|
||||
/// Represents a range between two int/float/double
|
||||
/// </summary>
|
||||
public class Range<T>
|
||||
public sealed record Range<T>
|
||||
{
|
||||
public T? Min { get; init; }
|
||||
public T? Max { get; init; }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// Represents the Reading Status. This is a flag and allows multiple statues
|
||||
/// </summary>
|
||||
public class ReadStatus
|
||||
public sealed record ReadStatus
|
||||
{
|
||||
public bool NotRead { get; set; } = true;
|
||||
public bool InProgress { get; set; } = true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// Sorting Options for a query
|
||||
/// </summary>
|
||||
public class SortOptions
|
||||
public sealed record SortOptions
|
||||
{
|
||||
public SortField SortField { get; set; }
|
||||
public bool IsAscending { get; set; } = true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// For requesting an encoded filter to be decoded
|
||||
/// </summary>
|
||||
public class DecodeFilterDto
|
||||
public sealed record DecodeFilterDto
|
||||
{
|
||||
public string EncodedFilter { get; set; }
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Filtering.v2;
|
||||
|
||||
public class FilterStatementDto
|
||||
public sealed record FilterStatementDto
|
||||
{
|
||||
public FilterComparison Comparison { get; set; }
|
||||
public FilterField Field { get; set; }
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace API.DTOs.Filtering.v2;
|
|||
/// <summary>
|
||||
/// Metadata filtering for v2 API only
|
||||
/// </summary>
|
||||
public class FilterV2Dto
|
||||
public sealed record FilterV2Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// Not used in the UI.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Jobs;
|
||||
|
||||
public class JobDto
|
||||
public sealed record JobDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Job Id
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// Represents an individual button in a Jump Bar
|
||||
/// </summary>
|
||||
public class JumpKeyDto
|
||||
public sealed record JumpKeyDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of items in this Key
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs;
|
||||
|
||||
public class KavitaLocale
|
||||
public sealed record KavitaLocale
|
||||
{
|
||||
public string FileName { get; set; } // Key
|
||||
public string RenderName { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.KavitaPlus.Account;
|
||||
|
||||
public class AniListUpdateDto
|
||||
public sealed record AniListUpdateDto
|
||||
{
|
||||
public string Token { get; set; }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace API.DTOs.KavitaPlus.Account;
|
|||
/// <summary>
|
||||
/// Represents information around a user's tokens and their status
|
||||
/// </summary>
|
||||
public class UserTokenInfo
|
||||
public sealed record UserTokenInfo
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
public string Username { get; set; }
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace API.DTOs.KavitaPlus.ExternalMetadata;
|
|||
/// <summary>
|
||||
/// Used for matching and fetching metadata on a series
|
||||
/// </summary>
|
||||
internal class ExternalMetadataIdsDto
|
||||
internal sealed record ExternalMetadataIdsDto
|
||||
{
|
||||
public long? MalId { get; set; }
|
||||
public int? AniListId { get; set; }
|
||||
|
|
|
@ -4,7 +4,7 @@ using API.DTOs.Scrobbling;
|
|||
namespace API.DTOs.KavitaPlus.ExternalMetadata;
|
||||
#nullable enable
|
||||
|
||||
internal class MatchSeriesRequestDto
|
||||
internal sealed record MatchSeriesRequestDto
|
||||
{
|
||||
public string SeriesName { get; set; }
|
||||
public ICollection<string> AlternativeNames { get; set; }
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using API.DTOs.KavitaPlus.Metadata;
|
||||
using API.DTOs.Recommendation;
|
||||
using API.DTOs.Scrobbling;
|
||||
using API.DTOs.SeriesDetail;
|
||||
|
||||
namespace API.DTOs.KavitaPlus.ExternalMetadata;
|
||||
|
||||
internal class SeriesDetailPlusApiDto
|
||||
internal sealed record SeriesDetailPlusApiDto
|
||||
{
|
||||
public IEnumerable<MediaRecommendationDto> Recommendations { get; set; }
|
||||
public IEnumerable<UserReviewDto> Reviews { get; set; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace API.DTOs.KavitaPlus.License;
|
||||
#nullable enable
|
||||
|
||||
public class EncryptLicenseDto
|
||||
public sealed record EncryptLicenseDto
|
||||
{
|
||||
public required string License { get; set; }
|
||||
public required string InstallId { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.KavitaPlus.License;
|
||||
|
||||
public class LicenseInfoDto
|
||||
public sealed record LicenseInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// If cancelled, will represent cancellation date. If not, will represent repayment date
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.KavitaPlus.License;
|
||||
|
||||
public class LicenseValidDto
|
||||
public sealed record LicenseValidDto
|
||||
{
|
||||
public required string License { get; set; }
|
||||
public required string InstallId { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.KavitaPlus.License;
|
||||
|
||||
public class ResetLicenseDto
|
||||
public sealed record ResetLicenseDto
|
||||
{
|
||||
public required string License { get; set; }
|
||||
public required string InstallId { get; set; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace API.DTOs.KavitaPlus.License;
|
||||
#nullable enable
|
||||
|
||||
public class UpdateLicenseDto
|
||||
public sealed record UpdateLicenseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// License Key received from Kavita+
|
||||
|
|
|
@ -12,7 +12,7 @@ public enum MatchStateOption
|
|||
DontMatch = 4
|
||||
}
|
||||
|
||||
public class ManageMatchFilterDto
|
||||
public sealed record ManageMatchFilterDto
|
||||
{
|
||||
public MatchStateOption MatchStateOption { get; set; } = MatchStateOption.All;
|
||||
public string SearchTerm { get; set; } = string.Empty;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.KavitaPlus.Manage;
|
||||
|
||||
public class ManageMatchSeriesDto
|
||||
public sealed record ManageMatchSeriesDto
|
||||
{
|
||||
public SeriesDto Series { get; set; }
|
||||
public bool IsMatched { get; set; }
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace API.DTOs.KavitaPlus.Metadata;
|
|||
/// <summary>
|
||||
/// Information about an individual issue/chapter/book from Kavita+
|
||||
/// </summary>
|
||||
public class ExternalChapterDto
|
||||
public sealed record ExternalChapterDto
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using API.DTOs.KavitaPlus.Metadata;
|
||||
using API.DTOs.Recommendation;
|
||||
using API.DTOs.Scrobbling;
|
||||
using API.Services.Plus;
|
||||
|
||||
namespace API.DTOs.Recommendation;
|
||||
namespace API.DTOs.KavitaPlus.Metadata;
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// This is AniListSeries
|
||||
/// </summary>
|
||||
public class ExternalSeriesDetailDto
|
||||
public sealed record ExternalSeriesDetailDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int? AniListId { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.KavitaPlus.Metadata;
|
||||
|
||||
public class MetadataFieldMappingDto
|
||||
public sealed record MetadataFieldMappingDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public MetadataFieldType SourceType { get; set; }
|
||||
|
|
|
@ -7,7 +7,7 @@ using NotImplementedException = System.NotImplementedException;
|
|||
namespace API.DTOs.KavitaPlus.Metadata;
|
||||
|
||||
|
||||
public class MetadataSettingsDto
|
||||
public sealed record MetadataSettingsDto
|
||||
{
|
||||
/// <summary>
|
||||
/// If writing any sort of metadata from upstream (AniList, Hardcover) source is allowed
|
||||
|
|
|
@ -9,7 +9,7 @@ public enum CharacterRole
|
|||
}
|
||||
|
||||
|
||||
public class SeriesCharacter
|
||||
public sealed record SeriesCharacter
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public required string Description { get; set; }
|
||||
|
|
|
@ -5,7 +5,7 @@ using API.Services.Plus;
|
|||
|
||||
namespace API.DTOs.KavitaPlus.Metadata;
|
||||
|
||||
public class ALMediaTitle
|
||||
public sealed record ALMediaTitle
|
||||
{
|
||||
public string? EnglishTitle { get; set; }
|
||||
public string RomajiTitle { get; set; }
|
||||
|
@ -13,7 +13,7 @@ public class ALMediaTitle
|
|||
public string PreferredTitle { get; set; }
|
||||
}
|
||||
|
||||
public class SeriesRelationship
|
||||
public sealed record SeriesRelationship
|
||||
{
|
||||
public int AniListId { get; set; }
|
||||
public int? MalId { get; set; }
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using API.Entities.Enums;
|
||||
|
||||
namespace API.DTOs;
|
||||
#nullable enable
|
||||
|
||||
public class LibraryDto
|
||||
public sealed record LibraryDto
|
||||
{
|
||||
public int Id { get; init; }
|
||||
public string? Name { get; init; }
|
||||
|
|
|
@ -4,7 +4,7 @@ using API.Entities.Enums;
|
|||
namespace API.DTOs;
|
||||
#nullable enable
|
||||
|
||||
public class MangaFileDto
|
||||
public sealed record MangaFileDto
|
||||
{
|
||||
public int Id { get; init; }
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.MediaErrors;
|
||||
|
||||
public class MediaErrorDto
|
||||
public sealed record MediaErrorDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Format Type (RAR, ZIP, 7Zip, Epub, PDF)
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace API.DTOs;
|
|||
/// <summary>
|
||||
/// Represents a member of a Kavita server.
|
||||
/// </summary>
|
||||
public class MemberDto
|
||||
public sealed record MemberDto
|
||||
{
|
||||
public int Id { get; init; }
|
||||
public string? Username { get; init; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Metadata;
|
||||
|
||||
public class AgeRatingDto
|
||||
public sealed record AgeRatingDto
|
||||
{
|
||||
public AgeRating Value { get; set; }
|
||||
public required string Title { get; set; }
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace API.DTOs.Metadata;
|
|||
/// Exclusively metadata about a given chapter
|
||||
/// </summary>
|
||||
[Obsolete("Will not be maintained as of v0.8.1")]
|
||||
public class ChapterMetadataDto
|
||||
public sealed record ChapterMetadataDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ChapterId { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Metadata;
|
||||
|
||||
public class GenreTagDto
|
||||
public sealed record GenreTagDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string Title { get; set; }
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using API.DTOs.KavitaPlus.Metadata;
|
||||
using API.DTOs.Recommendation;
|
||||
|
||||
namespace API.DTOs.Metadata.Matching;
|
||||
|
||||
public class ExternalSeriesMatchDto
|
||||
public sealed record ExternalSeriesMatchDto
|
||||
{
|
||||
public ExternalSeriesDetailDto Series { get; set; }
|
||||
public float MatchRating { get; set; }
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace API.DTOs.Metadata.Matching;
|
|||
/// <summary>
|
||||
/// Used for matching a series with Kavita+ for metadata and scrobbling
|
||||
/// </summary>
|
||||
public class MatchSeriesDto
|
||||
public sealed record MatchSeriesDto
|
||||
{
|
||||
/// <summary>
|
||||
/// When set, Kavita will stop attempting to match this series and will not perform any scrobbling
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.Metadata;
|
||||
|
||||
public class PublicationStatusDto
|
||||
public sealed record PublicationStatusDto
|
||||
{
|
||||
public PublicationStatus Value { get; set; }
|
||||
public required string Title { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace API.DTOs.Metadata;
|
||||
|
||||
public class TagDto
|
||||
public sealed record TagDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string Title { get; set; }
|
||||
|
|
|
@ -4,11 +4,13 @@ using System.Xml.Serialization;
|
|||
|
||||
namespace API.DTOs.OPDS;
|
||||
|
||||
// TODO: OPDS Dtos are internal state, shouldn't be in DTO directory
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[XmlRoot("feed", Namespace = "http://www.w3.org/2005/Atom")]
|
||||
public class Feed
|
||||
public sealed record Feed
|
||||
{
|
||||
[XmlElement("updated")]
|
||||
public string Updated { get; init; } = DateTime.UtcNow.ToString("s");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.OPDS;
|
||||
|
||||
public class FeedAuthor
|
||||
public sealed record FeedAuthor
|
||||
{
|
||||
[XmlElement("name")]
|
||||
public string Name { get; set; }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.OPDS;
|
||||
|
||||
public class FeedCategory
|
||||
public sealed record FeedCategory
|
||||
{
|
||||
[XmlAttribute("scheme")]
|
||||
public string Scheme { get; } = "http://www.bisg.org/standards/bisac_subject/index.html";
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Xml.Serialization;
|
|||
namespace API.DTOs.OPDS;
|
||||
#nullable enable
|
||||
|
||||
public class FeedEntry
|
||||
public sealed record FeedEntry
|
||||
{
|
||||
[XmlElement("updated")]
|
||||
public string Updated { get; init; } = DateTime.UtcNow.ToString("s");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace API.DTOs.OPDS;
|
||||
|
||||
public class FeedEntryContent
|
||||
public sealed record FeedEntryContent
|
||||
{
|
||||
[XmlAttribute("type")]
|
||||
public string Type = "text";
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Xml.Serialization;
|
|||
|
||||
namespace API.DTOs.OPDS;
|
||||
|
||||
public class FeedLink
|
||||
public sealed record FeedLink
|
||||
{
|
||||
[XmlIgnore]
|
||||
public bool IsPageStream { get; set; }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue