mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-01 12:44:44 -04:00
* Introduced a new claim on the Token to get UserId as well as Username, thus allowing for many places of reduced DB calls. All users will need to reauthenticate. Introduced UTC Dates throughout the application, they are not exposed in all DTOs, that will come later when we fully switch over. For now, Utc dates will be updated along side timezone specific dates. Refactored get-progress/progress api to be 50% faster by reducing how much data is loaded from the query. * Speed up the following apis: collection/search, download/bookmarks, reader/bookmark-info, recommended/quick-reads, recommended/quick-catchup-reads, recommended/highly-rated, recommended/more-in, recommended/rediscover, want-to-read/ * Added a migration to sync all dates with their new UTC counterpart. * Added LastReadingProgressUtc onto ChapterDto for some browsing apis, but not all. Added LastReadingProgressUtc to reading list items. Refactored the migration to run raw SQL which is much faster. * Added LastReadingProgressUtc onto ChapterDto for some browsing apis, but not all. Added LastReadingProgressUtc to reading list items. Refactored the migration to run raw SQL which is much faster. * Fixed the unit tests * Fixed an issue with auto mapper which was causing progress page number to not get sent to UI * series/volume has chapter last reading progress * Added filesize and library name on reading list item dto for CDisplayEx. * Some minor code cleanup * Forgot to fill a field
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using System.Threading.Tasks;
|
|
using API.Data;
|
|
using API.Data.Repositories;
|
|
using API.DTOs;
|
|
using API.Extensions;
|
|
using API.Services;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace API.Controllers;
|
|
|
|
/// <summary>
|
|
/// All APIs are for Tachiyomi extension and app. They have hacks for our implementation and should not be used for any
|
|
/// other purposes.
|
|
/// </summary>
|
|
public class TachiyomiController : BaseApiController
|
|
{
|
|
private readonly IUnitOfWork _unitOfWork;
|
|
private readonly ITachiyomiService _tachiyomiService;
|
|
|
|
public TachiyomiController(IUnitOfWork unitOfWork, ITachiyomiService tachiyomiService)
|
|
{
|
|
_unitOfWork = unitOfWork;
|
|
_tachiyomiService = tachiyomiService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Given the series Id, this should return the latest chapter that has been fully read.
|
|
/// </summary>
|
|
/// <param name="seriesId"></param>
|
|
/// <returns>ChapterDTO of latest chapter. Only Chapter number is used by consuming app. All other fields may be missing.</returns>
|
|
[HttpGet("latest-chapter")]
|
|
public async Task<ActionResult<ChapterDto>> GetLatestChapter(int seriesId)
|
|
{
|
|
if (seriesId < 1) return BadRequest("seriesId must be greater than 0");
|
|
return Ok(await _tachiyomiService.GetLatestChapter(seriesId, User.GetUserId()));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Marks every chapter that is sorted below the passed number as Read. This will not mark any specials as read.
|
|
/// </summary>
|
|
/// <remarks>This is built for Tachiyomi and is not expected to be called by any other place</remarks>
|
|
/// <returns></returns>
|
|
[HttpPost("mark-chapter-until-as-read")]
|
|
public async Task<ActionResult<bool>> MarkChaptersUntilAsRead(int seriesId, float chapterNumber)
|
|
{
|
|
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
|
|
return Ok(await _tachiyomiService.MarkChaptersUntilAsRead(user, seriesId, chapterNumber));
|
|
}
|
|
}
|