Supress max page error on bookmark api and just adjust the pages for the user. (#445)

# Changed
- Changed: Suppress max page error on bookmark api and just adjust the pages for the user.
This commit is contained in:
Joseph Milazzo 2021-07-27 20:10:40 -05:00 committed by GitHub
parent b9f20f4d19
commit 55dd9e7f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -241,17 +241,18 @@ namespace API.Controllers
var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(bookmarkDto.ChapterId);
if (bookmarkDto.PageNum > chapter.Pages)
{
return BadRequest("Can't bookmark past max pages");
bookmarkDto.PageNum = chapter.Pages;
}
if (bookmarkDto.PageNum < 0)
{
return BadRequest("Can't bookmark less than 0");
bookmarkDto.PageNum = 0;
}
try
{
// TODO: Look into creating a progress entry when a new item is added to the DB so we can just look it up and modify it
user.Progresses ??= new List<AppUserProgress>();
var userProgress =
user.Progresses.SingleOrDefault(x => x.ChapterId == bookmarkDto.ChapterId && x.AppUserId == user.Id);

View File

@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Company>kavitareader.com</Company>
<Product>Kavita</Product>
<AssemblyVersion>0.4.3.5</AssemblyVersion>
<AssemblyVersion>0.4.3.6</AssemblyVersion>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>