GET Mangaconnector endpoint

This commit is contained in:
Glax 2025-05-18 17:20:53 +02:00
parent 40c70fbf19
commit 62b035f6c5

View File

@ -23,6 +23,31 @@ public class MangaConnectorController(PgsqlContext context, ILog Log) : Controll
MangaConnector[] connectors = context.MangaConnectors.ToArray(); MangaConnector[] connectors = context.MangaConnectors.ToArray();
return Ok(connectors); return Ok(connectors);
} }
/// <summary>
/// Returns the MangaConnector with the requested Name
/// </summary>
/// <param name="MangaConnectorName"></param>
/// <response code="200"></response>
/// <response code="404">Connector with ID not found.</response>
/// <response code="500">Error during Database Operation</response>
[HttpGet("{MangaConnectorName}")]
[ProducesResponseType<MangaConnector>(Status200OK, "application/json")]
public IActionResult GetConnector(string MangaConnectorName)
{
try
{
if(context.MangaConnectors.Find(MangaConnectorName) is not { } connector)
return NotFound();
return Ok(connector);
}
catch (Exception e)
{
Log.Error(e);
return StatusCode(500, e.Message);
}
}
/// <summary> /// <summary>
/// Get all enabled Connectors (Scanlation-Sites) /// Get all enabled Connectors (Scanlation-Sites)