mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-06 06:45:18 -04:00
Progress Overhaul + Profile Page and a LOT more! (#4262)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
@@ -10,6 +10,7 @@ using API.DTOs.WantToRead;
|
||||
using API.Entities;
|
||||
using API.Extensions;
|
||||
using API.Helpers;
|
||||
using API.Middleware;
|
||||
using API.Services;
|
||||
using API.Services.Plus;
|
||||
using Hangfire;
|
||||
@@ -38,21 +39,21 @@ public class WantToReadController : BaseApiController
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return all Series that are in the current logged in user's Want to Read list, filtered (deprecated, use v2)
|
||||
/// Return all Series that are in the current logged-in user's Want to Read list, filtered (deprecated, use v2)
|
||||
/// </summary>
|
||||
/// <remarks>This will be removed in v0.8.x</remarks>
|
||||
/// <remarks>This will be removed in v0.9.0</remarks>
|
||||
/// <param name="userParams"></param>
|
||||
/// <param name="filterDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Obsolete("use v2 instead")]
|
||||
[Obsolete("use v2 instead. This will be removed in v0.9.0")]
|
||||
public async Task<ActionResult<PagedList<SeriesDto>>> GetWantToRead([FromQuery] UserParams? userParams, FilterDto filterDto)
|
||||
{
|
||||
userParams ??= new UserParams();
|
||||
var pagedList = await _unitOfWork.SeriesRepository.GetWantToReadForUserAsync(User.GetUserId(), userParams, filterDto);
|
||||
var pagedList = await _unitOfWork.SeriesRepository.GetWantToReadForUserAsync(UserId, userParams, filterDto);
|
||||
Response.AddPaginationHeader(pagedList.CurrentPage, pagedList.PageSize, pagedList.TotalCount, pagedList.TotalPages);
|
||||
|
||||
await _unitOfWork.SeriesRepository.AddSeriesModifiers(User.GetUserId(), pagedList);
|
||||
await _unitOfWork.SeriesRepository.AddSeriesModifiers(UserId, pagedList);
|
||||
|
||||
return Ok(pagedList);
|
||||
}
|
||||
@@ -62,15 +63,19 @@ public class WantToReadController : BaseApiController
|
||||
/// </summary>
|
||||
/// <param name="userParams"></param>
|
||||
/// <param name="filterDto"></param>
|
||||
/// <param name="userId">Optional user id to request the OnDeck for someone else. They must have profile sharing enabled when doing so</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("v2")]
|
||||
public async Task<ActionResult<PagedList<SeriesDto>>> GetWantToReadV2([FromQuery] UserParams? userParams, FilterV2Dto filterDto)
|
||||
[ProfilePrivacy(allowMissingUserId: true)]
|
||||
public async Task<ActionResult<PagedList<SeriesDto>>> GetWantToReadV2([FromQuery] UserParams? userParams, FilterV2Dto filterDto, [FromQuery] int? userId = null)
|
||||
{
|
||||
var wantToReadForUser = userId ?? UserId;
|
||||
userParams ??= new UserParams();
|
||||
var pagedList = await _unitOfWork.SeriesRepository.GetWantToReadForUserV2Async(User.GetUserId(), userParams, filterDto);
|
||||
|
||||
var pagedList = await _unitOfWork.SeriesRepository.GetWantToReadForUserV2Async(wantToReadForUser, userParams, filterDto);
|
||||
Response.AddPaginationHeader(pagedList.CurrentPage, pagedList.PageSize, pagedList.TotalCount, pagedList.TotalPages);
|
||||
|
||||
await _unitOfWork.SeriesRepository.AddSeriesModifiers(User.GetUserId(), pagedList);
|
||||
await _unitOfWork.SeriesRepository.AddSeriesModifiers(wantToReadForUser, pagedList);
|
||||
|
||||
return Ok(pagedList);
|
||||
}
|
||||
@@ -78,7 +83,7 @@ public class WantToReadController : BaseApiController
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<bool>> IsSeriesInWantToRead([FromQuery] int seriesId)
|
||||
{
|
||||
return Ok(await _unitOfWork.SeriesRepository.IsSeriesInWantToRead(User.GetUserId(), seriesId));
|
||||
return Ok(await _unitOfWork.SeriesRepository.IsSeriesInWantToRead(UserId, seriesId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -89,7 +94,7 @@ public class WantToReadController : BaseApiController
|
||||
[HttpPost("add-series")]
|
||||
public async Task<ActionResult> AddSeries(UpdateWantToReadDto dto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(Username!,
|
||||
AppUserIncludes.WantToRead);
|
||||
if (user == null) return Unauthorized();
|
||||
|
||||
@@ -114,7 +119,7 @@ public class WantToReadController : BaseApiController
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-reading-list-update"));
|
||||
return BadRequest(await _localizationService.Translate(UserId, "generic-reading-list-update"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,7 +130,7 @@ public class WantToReadController : BaseApiController
|
||||
[HttpPost("remove-series")]
|
||||
public async Task<ActionResult> RemoveSeries(UpdateWantToReadDto dto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(Username!,
|
||||
AppUserIncludes.WantToRead);
|
||||
if (user == null) return Unauthorized();
|
||||
|
||||
@@ -144,6 +149,6 @@ public class WantToReadController : BaseApiController
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-reading-list-update"));
|
||||
return BadRequest(await _localizationService.Translate(UserId, "generic-reading-list-update"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user