Skip to content

Commit

Permalink
Added some API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
majora2007 committed Nov 15, 2024
1 parent a9f2e61 commit 7a12843
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion API/Controllers/PersonController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public async Task<ActionResult<PersonDto>> UpdatePerson(UpdatePersonDto dto)
return Ok(_mapper.Map<PersonDto>(person));
}

/// <summary>
/// Attempts to download the cover from CoversDB (Note: Not yet release in Kavita)
/// </summary>
/// <param name="personId"></param>
/// <returns></returns>
[HttpPost("fetch-cover")]
public async Task<ActionResult<string>> DownloadCoverImage([FromQuery] int personId)
{
Expand All @@ -129,13 +134,13 @@ public async Task<ActionResult<string>> DownloadCoverImage([FromQuery] int perso
var personImage = await _coverDbService.DownloadPersonImageAsync(person, settings.EncodeMediaAs);

if (string.IsNullOrEmpty(personImage)) return BadRequest(await _localizationService.Translate(User.GetUserId(), "person-image-doesnt-exist"));

person.CoverImage = personImage;
_imageService.UpdateColorScape(person);
_unitOfWork.PersonRepository.Update(person);
await _unitOfWork.CommitAsync();
await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(person.Id, "person"), false);


return Ok(personImage);
}

Expand All @@ -150,6 +155,12 @@ public async Task<ActionResult<IEnumerable<SeriesDto>>> GetKnownSeries(int perso
return Ok(await _unitOfWork.PersonRepository.GetSeriesKnownFor(personId));
}

/// <summary>
/// Returns all individual chapters by role. Limited to 20 results.
/// </summary>
/// <param name="personId"></param>
/// <param name="role"></param>
/// <returns></returns>
[HttpGet("chapters-by-role")]
public async Task<ActionResult<IEnumerable<StandaloneChapterDto>>> GetChaptersByRole(int personId, PersonRole role)
{
Expand Down
2 changes: 1 addition & 1 deletion API/DTOs/VolumeDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public bool IsLooseLeaf()
}

/// <summary>
/// Does this volume hold only specials?
/// Does this volume hold only specials
/// </summary>
/// <returns></returns>
public bool IsSpecial()
Expand Down

0 comments on commit 7a12843

Please sign in to comment.