Refactored the setContinuePoint code from the UI to the backend. Now, through an API, we can get the chapter to restart from. (#973)

This commit is contained in:
Joseph Milazzo 2022-01-20 15:49:26 -08:00 committed by GitHub
parent 3eb494dff4
commit 218f642870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 281 additions and 59 deletions

View file

@ -356,6 +356,19 @@ namespace API.Controllers
return BadRequest("Could not save progress");
}
/// <summary>
/// Continue point is the chapter which you should start reading again from. If there is no progress on a series, then the first chapter will be returned (non-special unless only specials).
/// Otherwise, loop through the chapters and volumes in order to find the next chapter which has progress.
/// </summary>
/// <returns></returns>
[HttpGet("continue-point")]
public async Task<ActionResult<ChapterDto>> GetContinuePoint(int seriesId)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
return Ok(await _readerService.GetContinuePoint(seriesId, userId));
}
/// <summary>
/// Returns a list of bookmarked pages for a given Chapter
/// </summary>