Pipeline + Panels Tweaks (#2367)

This commit is contained in:
Joe Milazzo 2023-10-29 11:23:57 -05:00 committed by GitHub
parent 8d209e8eda
commit d7dd278582
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -44,12 +44,19 @@ public class PanelsController : BaseApiController
/// <param name="apiKey"></param>
/// <returns>The number of pages read, 0 if none read</returns>
[HttpGet("get-progress")]
public async Task<ActionResult<int>> GetProgress(int chapterId, [FromQuery] string apiKey)
public async Task<ActionResult<ProgressDto>> GetProgress(int chapterId, [FromQuery] string apiKey)
{
if (string.IsNullOrEmpty(apiKey)) return Unauthorized("ApiKey is required");
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
var progress = await _unitOfWork.AppUserProgressRepository.GetUserProgressDtoAsync(chapterId, userId);
return Ok(progress?.PageNum ?? 0);
if (progress == null) return Ok(new ProgressDto()
{
PageNum = 0,
ChapterId = chapterId,
VolumeId = 0,
SeriesId = 0
});
return Ok(progress);
}
}