mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Pull progress information for some of the recommended stuff. * Fixed some redirection code from last PR * Implemented the ability to search for files in the search and open the series directly. * Fixed nav search bar expanding too much * Fixed a bug in nav module not having router so some links broke * Fixed an issue where with new localized series tag, merging could fail if the user had 2 series with the series and localized series. Added extra error handling for tracking series parsed from disk. * Fixed the slowness when typing in a typeahead by using auditTime vs debounceTime * Removed some cleaning of Edition tags from the Parser. Only Omnibus and Uncensored will be ignored when cleaning titles, Full Color, Full Contact, etc will now stay in the title for Series name. * Implemented ability to search against chapter's title (from epub or title in comicinfo). This should help users search for books in a series a lot easier. * Restrict each search type to 15 records only to keep query performant and UI useful. * Wrote some extra messaging on invite user flow around email. * Messaging update
91 lines
3.6 KiB
C#
91 lines
3.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using API.Data;
|
|
using API.DTOs;
|
|
using API.Extensions;
|
|
using API.Helpers;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace API.Controllers;
|
|
|
|
public class RecommendedController : BaseApiController
|
|
{
|
|
private readonly IUnitOfWork _unitOfWork;
|
|
|
|
public RecommendedController(IUnitOfWork unitOfWork)
|
|
{
|
|
_unitOfWork = unitOfWork;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Quick Reads are series that are less than 2K pages in total.
|
|
/// </summary>
|
|
/// <param name="libraryId">Library to restrict series to</param>
|
|
/// <returns></returns>
|
|
[HttpGet("quick-reads")]
|
|
public async Task<ActionResult<PagedList<SeriesDto>>> GetQuickReads(int libraryId, [FromQuery] UserParams userParams)
|
|
{
|
|
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
|
|
|
|
userParams ??= new UserParams();
|
|
var series = await _unitOfWork.SeriesRepository.GetQuickReads(user.Id, libraryId, userParams);
|
|
|
|
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
|
|
return Ok(series);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Highly Rated based on other users ratings. Will pull series with ratings > 4.0, weighted by count of other users.
|
|
/// </summary>
|
|
/// <param name="libraryId">Library to restrict series to</param>
|
|
/// <returns></returns>
|
|
[HttpGet("highly-rated")]
|
|
public async Task<ActionResult<PagedList<SeriesDto>>> GetHighlyRated(int libraryId, [FromQuery] UserParams userParams)
|
|
{
|
|
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
|
|
|
|
userParams ??= new UserParams();
|
|
var series = await _unitOfWork.SeriesRepository.GetHighlyRated(user.Id, libraryId, userParams);
|
|
await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);
|
|
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
|
|
return Ok(series);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Chooses a random genre and shows series that are in that without reading progress
|
|
/// </summary>
|
|
/// <param name="libraryId">Library to restrict series to</param>
|
|
/// <returns></returns>
|
|
[HttpGet("more-in")]
|
|
public async Task<ActionResult<PagedList<SeriesDto>>> GetMoreIn(int libraryId, int genreId, [FromQuery] UserParams userParams)
|
|
{
|
|
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
|
|
|
|
userParams ??= new UserParams();
|
|
var series = await _unitOfWork.SeriesRepository.GetMoreIn(user.Id, libraryId, genreId, userParams);
|
|
await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);
|
|
|
|
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
|
|
return Ok(series);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Series that are fully read by the user in no particular order
|
|
/// </summary>
|
|
/// <param name="libraryId">Library to restrict series to</param>
|
|
/// <returns></returns>
|
|
[HttpGet("rediscover")]
|
|
public async Task<ActionResult<PagedList<SeriesDto>>> GetRediscover(int libraryId, [FromQuery] UserParams userParams)
|
|
{
|
|
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
|
|
|
|
userParams ??= new UserParams();
|
|
var series = await _unitOfWork.SeriesRepository.GetRediscover(user.Id, libraryId, userParams);
|
|
|
|
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
|
|
return Ok(series);
|
|
}
|
|
|
|
}
|