mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
Add Queries for MangaConnectorIds
This commit is contained in:
@@ -456,4 +456,36 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
|
|
||||||
return new SearchController(context).SearchManga(MangaConnectorName, manga.Name);
|
return new SearchController(context).SearchManga(MangaConnectorName, manga.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all <see cref="Manga"/> which where Authored by <see cref="Author"/> with <paramref name="AuthorId"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="AuthorId"><see cref="Author"/>.Key</param>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="404"><see cref="Author"/> with <paramref name="AuthorId"/></response>
|
||||||
|
[HttpGet("WithAuthorId/{AuthorId}")]
|
||||||
|
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||||
|
public IActionResult GetMangaWithAuthorIds(string AuthorId)
|
||||||
|
{
|
||||||
|
if (context.Authors.Find(AuthorId) is not { } author)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return Ok(context.Mangas.Where(m => m.Authors.Contains(author)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all <see cref="Manga"/> with <see cref="Tag"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Tag"><see cref="Tag"/>.Tag</param>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="404"><see cref="Tag"/> not found</response>
|
||||||
|
[HttpGet("WithTag/{Tag}")]
|
||||||
|
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
||||||
|
public IActionResult GetMangasWithTag(string Tag)
|
||||||
|
{
|
||||||
|
if (context.Tags.Find(Tag) is not { } tag)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return Ok(context.Mangas.Where(m => m.MangaTags.Contains(tag)));
|
||||||
|
}
|
||||||
}
|
}
|
@@ -28,38 +28,6 @@ public class QueryController(MangaContext context) : Controller
|
|||||||
return Ok(author);
|
return Ok(author);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns all <see cref="Manga"/> which where Authored by <see cref="Author"/> with <paramref name="AuthorId"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="AuthorId"><see cref="Author"/>.Key</param>
|
|
||||||
/// <response code="200"></response>
|
|
||||||
/// <response code="404"><see cref="Author"/> with <paramref name="AuthorId"/></response>
|
|
||||||
[HttpGet("Mangas/WithAuthorId/{AuthorId}")]
|
|
||||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
|
||||||
public IActionResult GetMangaWithAuthorIds(string AuthorId)
|
|
||||||
{
|
|
||||||
if (context.Authors.Find(AuthorId) is not { } author)
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
return Ok(context.Mangas.Where(m => m.Authors.Contains(author)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns all <see cref="Manga"/> with <see cref="Tag"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Tag"><see cref="Tag"/>.Tag</param>
|
|
||||||
/// <response code="200"></response>
|
|
||||||
/// <response code="404"><see cref="Tag"/> not found</response>
|
|
||||||
[HttpGet("Mangas/WithTag/{Tag}")]
|
|
||||||
[ProducesResponseType<Manga[]>(Status200OK, "application/json")]
|
|
||||||
public IActionResult GetMangasWithTag(string Tag)
|
|
||||||
{
|
|
||||||
if (context.Tags.Find(Tag) is not { } tag)
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
return Ok(context.Mangas.Where(m => m.MangaTags.Contains(tag)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns <see cref="Chapter"/> with <paramref name="ChapterId"/>
|
/// Returns <see cref="Chapter"/> with <paramref name="ChapterId"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -68,6 +36,7 @@ public class QueryController(MangaContext context) : Controller
|
|||||||
/// <response code="404"><see cref="Chapter"/> with <paramref name="ChapterId"/> not found</response>
|
/// <response code="404"><see cref="Chapter"/> with <paramref name="ChapterId"/> not found</response>
|
||||||
[HttpGet("Chapter/{ChapterId}")]
|
[HttpGet("Chapter/{ChapterId}")]
|
||||||
[ProducesResponseType<Chapter>(Status200OK, "application/json")]
|
[ProducesResponseType<Chapter>(Status200OK, "application/json")]
|
||||||
|
[ProducesResponseType(Status404NotFound)]
|
||||||
public IActionResult GetChapter(string ChapterId)
|
public IActionResult GetChapter(string ChapterId)
|
||||||
{
|
{
|
||||||
if (context.Chapters.Find(ChapterId) is not { } chapter)
|
if (context.Chapters.Find(ChapterId) is not { } chapter)
|
||||||
@@ -75,4 +44,38 @@ public class QueryController(MangaContext context) : Controller
|
|||||||
|
|
||||||
return Ok(chapter);
|
return Ok(chapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the <see cref="MangaConnectorId{Manga}"/> with <see cref="MangaConnectorId{Manga}"/>.Key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="MangaConnectorIdId">Key of <see cref="MangaConnectorId{Manga}"/></param>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="404"><see cref="MangaConnectorId{Manga}"/> with <paramref name="MangaConnectorIdId"/> not found</response>
|
||||||
|
[HttpGet("Manga/MangaConnectorId/{MangaConnectorIdId}")]
|
||||||
|
[ProducesResponseType<MangaConnectorId<Manga>>(Status200OK, "application/json")]
|
||||||
|
[ProducesResponseType(Status404NotFound)]
|
||||||
|
public IActionResult GetMangaMangaConnectorId(string MangaConnectorIdId)
|
||||||
|
{
|
||||||
|
if(context.MangaConnectorToManga.Find(MangaConnectorIdId) is not { } mcIdManga)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return Ok(mcIdManga);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the <see cref="MangaConnectorId{Chapter}"/> with <see cref="MangaConnectorId{Chapter}"/>.Key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="MangaConnectorIdId">Key of <see cref="MangaConnectorId{Manga}"/></param>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="404"><see cref="MangaConnectorId{Chapter}"/> with <paramref name="MangaConnectorIdId"/> not found</response>
|
||||||
|
[HttpGet("chapter/MangaConnectorId/{MangaConnectorIdId}")]
|
||||||
|
[ProducesResponseType<MangaConnectorId<Chapter>>(Status200OK, "application/json")]
|
||||||
|
[ProducesResponseType(Status404NotFound)]
|
||||||
|
public IActionResult GetChapterMangaConnectorId(string MangaConnectorIdId)
|
||||||
|
{
|
||||||
|
if(context.MangaConnectorToChapter.Find(MangaConnectorIdId) is not { } mcIdChapter)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return Ok(mcIdChapter);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -39,6 +39,7 @@ public class Manga : Identifiable
|
|||||||
|
|
||||||
[NotMapped] public Dictionary<string, string> IdsOnMangaConnectors =>
|
[NotMapped] public Dictionary<string, string> IdsOnMangaConnectors =>
|
||||||
MangaConnectorIds.ToDictionary(id => id.MangaConnectorName, id => id.IdOnConnectorSite);
|
MangaConnectorIds.ToDictionary(id => id.MangaConnectorName, id => id.IdOnConnectorSite);
|
||||||
|
[NotMapped] public ICollection<string> MangaConnectorIdsIds => MangaConnectorIds.Select(id => id.Key).ToList();
|
||||||
[JsonIgnore] public ICollection<MangaConnectorId<Manga>> MangaConnectorIds = null!;
|
[JsonIgnore] public ICollection<MangaConnectorId<Manga>> MangaConnectorIds = null!;
|
||||||
|
|
||||||
public Manga(string name, string description, string coverUrl, MangaReleaseStatus releaseStatus,
|
public Manga(string name, string description, string coverUrl, MangaReleaseStatus releaseStatus,
|
||||||
|
@@ -11,7 +11,7 @@ public class MangaConnectorId<T> : Identifiable where T : Identifiable
|
|||||||
[StringLength(64)] [Required] public string ObjId { get; private set; } = null!;
|
[StringLength(64)] [Required] public string ObjId { get; private set; } = null!;
|
||||||
[JsonIgnore] public T Obj = null!;
|
[JsonIgnore] public T Obj = null!;
|
||||||
|
|
||||||
[StringLength(32)] [Required] public string MangaConnectorName { get; private set; } = null!;
|
[StringLength(32)] [Required] public string MangaConnectorName { get; private set; }
|
||||||
|
|
||||||
[StringLength(256)] [Required] public string IdOnConnectorSite { get; init; }
|
[StringLength(256)] [Required] public string IdOnConnectorSite { get; init; }
|
||||||
[Url] [StringLength(512)] public string? WebsiteUrl { get; internal init; }
|
[Url] [StringLength(512)] public string? WebsiteUrl { get; internal init; }
|
||||||
|
@@ -8,7 +8,8 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
|||||||
ENV XDG_CONFIG_HOME=/tmp/.chromium
|
ENV XDG_CONFIG_HOME=/tmp/.chromium
|
||||||
ENV XDG_CACHE_HOME=/tmp/.chromium
|
ENV XDG_CACHE_HOME=/tmp/.chromium
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3 chromium \
|
&& apt-get upgrade -y \
|
||||||
|
&& apt-get install -y chromium \
|
||||||
&& apt-get autopurge -y \
|
&& apt-get autopurge -y \
|
||||||
&& apt-get autoclean -y
|
&& apt-get autoclean -y
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user