mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-13 03:43:17 +02:00
Query Endpoints documentation
This commit is contained in:
parent
d278a25f16
commit
a2bc14d54a
@ -1,9 +1,7 @@
|
||||
using API.APIEndpointRecords;
|
||||
using API.Schema;
|
||||
using API.Schema;
|
||||
using API.Schema.Jobs;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
|
@ -10,6 +10,12 @@ namespace API.Controllers;
|
||||
[Route("v{v:apiVersion}/[controller]")]
|
||||
public class QueryController(PgsqlContext context) : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the Author-Information for Author-ID
|
||||
/// </summary>
|
||||
/// <param name="AuthorId">Author-Id</param>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="404">Author with ID not found</response>
|
||||
[HttpGet("Author/{AuthorId}")]
|
||||
[ProducesResponseType<Author>(Status200OK, "application/json")]
|
||||
[ProducesResponseType(Status404NotFound)]
|
||||
@ -21,6 +27,11 @@ public class QueryController(PgsqlContext context) : Controller
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all Mangas which where Authored by Author with AuthorId
|
||||
/// </summary>
|
||||
/// <param name="AuthorId">Author-ID</param>
|
||||
/// <response code="200"></response>
|
||||
[HttpGet("Mangas/WithAuthorId/{AuthorId}")]
|
||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||
public IActionResult GetMangaWithAuthorIds(string AuthorId)
|
||||
@ -28,6 +39,12 @@ public class QueryController(PgsqlContext context) : Controller
|
||||
return Ok(context.Manga.Where(m => m.AuthorIds.Contains(AuthorId)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns Link-Information for Link-Id
|
||||
/// </summary>
|
||||
/// <param name="LinkId"></param>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="404">Link with ID not found</response>
|
||||
[HttpGet("Link/{LinkId}")]
|
||||
[ProducesResponseType<Link>(Status200OK, "application/json")]
|
||||
[ProducesResponseType(Status404NotFound)]
|
||||
@ -39,14 +56,12 @@ public class QueryController(PgsqlContext context) : Controller
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("Links/WithIds")]
|
||||
[ProducesResponseType<Link[]>(Status200OK, "application/json")]
|
||||
public IActionResult GetLink([FromBody]string[] LinkIds)
|
||||
{
|
||||
Link[] ret = context.Link.Where(l => LinkIds.Contains(l.LinkId)).ToArray();
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns AltTitle-Information for AltTitle-Id
|
||||
/// </summary>
|
||||
/// <param name="AltTitleId"></param>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="404">AltTitle with ID not found</response>
|
||||
[HttpGet("AltTitle/{AltTitleId}")]
|
||||
[ProducesResponseType<MangaAltTitle>(Status200OK, "application/json")]
|
||||
[ProducesResponseType(Status404NotFound)]
|
||||
@ -58,18 +73,31 @@ public class QueryController(PgsqlContext context) : Controller
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("AltTitles/WithIds")]
|
||||
[ProducesResponseType<MangaAltTitle[]>(Status200OK, "application/json")]
|
||||
public IActionResult GetAltTitle([FromBody]string[] AltTitleIds)
|
||||
{
|
||||
MangaAltTitle[] ret = context.AltTitles.Where(a => AltTitleIds.Contains(a.AltTitleId)).ToArray();
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all Manga with Tag
|
||||
/// </summary>
|
||||
/// <param name="Tag"></param>
|
||||
/// <response code="200"></response>
|
||||
[HttpGet("Mangas/WithTag/{Tag}")]
|
||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||
public IActionResult GetMangasWithTag(string Tag)
|
||||
{
|
||||
return Ok(context.Manga.Where(m => m.Tags.Contains(Tag)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns Chapter-Information for Chapter-Id
|
||||
/// </summary>
|
||||
/// <param name="ChapterId"></param>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="404">Chapter with ID not found</response>
|
||||
[HttpGet("Chapter/{ChapterId}")]
|
||||
[ProducesResponseType<Chapter>(Status200OK, "application/json")]
|
||||
public IActionResult GetChapter(string ChapterId)
|
||||
{
|
||||
Chapter? ret = context.Chapters.Find(ChapterId);
|
||||
if (ret is null)
|
||||
return NotFound();
|
||||
return Ok(ret);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user