mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-14 04:13:18 +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 API.Schema.Jobs;
|
||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||||
using SixLabors.ImageSharp.Processing;
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
@ -10,6 +10,12 @@ namespace API.Controllers;
|
|||||||
[Route("v{v:apiVersion}/[controller]")]
|
[Route("v{v:apiVersion}/[controller]")]
|
||||||
public class QueryController(PgsqlContext context) : 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}")]
|
[HttpGet("Author/{AuthorId}")]
|
||||||
[ProducesResponseType<Author>(Status200OK, "application/json")]
|
[ProducesResponseType<Author>(Status200OK, "application/json")]
|
||||||
[ProducesResponseType(Status404NotFound)]
|
[ProducesResponseType(Status404NotFound)]
|
||||||
@ -21,6 +27,11 @@ public class QueryController(PgsqlContext context) : Controller
|
|||||||
return Ok(ret);
|
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}")]
|
[HttpGet("Mangas/WithAuthorId/{AuthorId}")]
|
||||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||||
public IActionResult GetMangaWithAuthorIds(string AuthorId)
|
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)));
|
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}")]
|
[HttpGet("Link/{LinkId}")]
|
||||||
[ProducesResponseType<Link>(Status200OK, "application/json")]
|
[ProducesResponseType<Link>(Status200OK, "application/json")]
|
||||||
[ProducesResponseType(Status404NotFound)]
|
[ProducesResponseType(Status404NotFound)]
|
||||||
@ -39,14 +56,12 @@ public class QueryController(PgsqlContext context) : Controller
|
|||||||
return Ok(ret);
|
return Ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Links/WithIds")]
|
/// <summary>
|
||||||
[ProducesResponseType<Link[]>(Status200OK, "application/json")]
|
/// Returns AltTitle-Information for AltTitle-Id
|
||||||
public IActionResult GetLink([FromBody]string[] LinkIds)
|
/// </summary>
|
||||||
{
|
/// <param name="AltTitleId"></param>
|
||||||
Link[] ret = context.Link.Where(l => LinkIds.Contains(l.LinkId)).ToArray();
|
/// <response code="200"></response>
|
||||||
return Ok(ret);
|
/// <response code="404">AltTitle with ID not found</response>
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("AltTitle/{AltTitleId}")]
|
[HttpGet("AltTitle/{AltTitleId}")]
|
||||||
[ProducesResponseType<MangaAltTitle>(Status200OK, "application/json")]
|
[ProducesResponseType<MangaAltTitle>(Status200OK, "application/json")]
|
||||||
[ProducesResponseType(Status404NotFound)]
|
[ProducesResponseType(Status404NotFound)]
|
||||||
@ -58,18 +73,31 @@ public class QueryController(PgsqlContext context) : Controller
|
|||||||
return Ok(ret);
|
return Ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("AltTitles/WithIds")]
|
/// <summary>
|
||||||
[ProducesResponseType<MangaAltTitle[]>(Status200OK, "application/json")]
|
/// Returns all Manga with Tag
|
||||||
public IActionResult GetAltTitle([FromBody]string[] AltTitleIds)
|
/// </summary>
|
||||||
{
|
/// <param name="Tag"></param>
|
||||||
MangaAltTitle[] ret = context.AltTitles.Where(a => AltTitleIds.Contains(a.AltTitleId)).ToArray();
|
/// <response code="200"></response>
|
||||||
return Ok(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("Mangas/WithTag/{Tag}")]
|
[HttpGet("Mangas/WithTag/{Tag}")]
|
||||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||||
public IActionResult GetMangasWithTag(string Tag)
|
public IActionResult GetMangasWithTag(string Tag)
|
||||||
{
|
{
|
||||||
return Ok(context.Manga.Where(m => m.Tags.Contains(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