Stats Page Overhaul (#4292)

Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo
2025-12-19 13:23:55 -07:00
committed by GitHub
parent 20197fa712
commit e1f421ccc0
175 changed files with 12122 additions and 5746 deletions
+13 -19
View File
@@ -412,17 +412,20 @@ public class ReaderController : BaseApiController
try
{
await _readerService.MarkChaptersAsRead(user, markVolumeReadDto.SeriesId, chapters);
}
catch (KavitaException ex)
{
return BadRequest(await _localizationService.Translate(UserId, ex.Message));
}
if (!await _unitOfWork.CommitAsync()) return BadRequest(await _localizationService.Translate(UserId, "generic-read-progress"));
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, markVolumeReadDto.SeriesId,
markVolumeReadDto.VolumeId, 0, chapters.Sum(c => c.Pages)));
if (!await _unitOfWork.CommitAsync()) return BadRequest(await _localizationService.Translate(UserId, "generic-read-progress"));
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, markVolumeReadDto.SeriesId));
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(markVolumeReadDto.SeriesId, user.Id));
return Ok();
@@ -1008,30 +1011,15 @@ public class ReaderController : BaseApiController
return Ok();
}
/// <summary>
/// Get all progress events for a given chapter
/// </summary>
/// <param name="chapterId"></param>
/// <returns></returns>
[HttpGet("all-chapter-progress")]
public async Task<ActionResult<IEnumerable<FullProgressDto>>> GetProgressForChapter(int chapterId)
{
var userId = User.IsInRole(PolicyConstants.AdminRole) ? 0 : UserId;
return Ok(await _unitOfWork.AppUserProgressRepository.GetUserProgressForChapter(chapterId, userId));
}
/// <summary>
/// Check if we should prompt the user for rereads for the given series
/// </summary>
/// <param name="seriesId"></param>
/// <returns></returns>
[HttpGet("prompt-reread/series")]
public async Task<ActionResult<RereadDto>> ShouldPromptForSeriesReRead(int seriesId)
public async Task<ActionResult<RereadDto>> ShouldPromptForSeriesReRead(int seriesId, int libraryId)
{
return Ok(await _readerService.CheckSeriesForReRead(UserId, seriesId));
return Ok(await _readerService.CheckSeriesForReRead(UserId, seriesId, libraryId));
}
/// <summary>
@@ -1060,4 +1048,10 @@ public class ReaderController : BaseApiController
return Ok(await _readerService.CheckChapterForReRead(UserId, chapterId, seriesId, libraryId));
}
[HttpGet("first-progress-date")]
public async Task<ActionResult<DateTime>> GetFirstReadingDate(int userId)
{
return Ok(await _unitOfWork.AppUserProgressRepository.GetFirstProgressForUser(userId));
}
}