Refactored volume to contain pages and removed /reader/info API endpoint.

This commit is contained in:
Joseph Milazzo 2021-01-11 17:36:11 -06:00
parent c2b41b774a
commit 28ce2bbba1
9 changed files with 571 additions and 18 deletions

View file

@ -1,7 +1,5 @@
using System;
using System.Linq;
using System.Linq;
using System.Threading.Tasks;
using API.Comparators;
using API.DTOs;
using API.Entities;
using API.Interfaces;
@ -20,20 +18,6 @@ namespace API.Controllers
_cacheService = cacheService;
}
[HttpGet("info")]
public async Task<ActionResult<int>> GetInformation(int volumeId)
{
Volume volume = await _cacheService.Ensure(volumeId);
if (volume == null || !volume.Files.Any())
{
// TODO: Move this into Ensure and return negative numbers for different error codes.
return BadRequest("There are no files in the volume to read.");
}
return Ok(volume.Files.Select(x => x.NumberOfPages).Sum());
}
[HttpGet("image")]
public async Task<ActionResult<ImageDto>> GetImage(int volumeId, int page)
{

View file

@ -35,5 +35,11 @@ namespace API.Controllers
{
return Ok(await _seriesRepository.GetVolumesDtoAsync(seriesId));
}
[HttpGet("volume")]
public async Task<ActionResult<VolumeDto>> GetVolume(int volumeId)
{
return Ok(await _seriesRepository.GetVolumeDtoAsync(volumeId));
}
}
}