aboutsummaryrefslogtreecommitdiffstats
path: root/src/Endpoints
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-05 06:03:54 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-05 06:03:54 +0100
commit973370074414ad5ab8f2c401001793294822bf16 (patch)
tree289f58012ac96287a94a25e4c0564eb3433a65a7 /src/Endpoints
parent394171ed0c7d0edeb98a3be3e076ce130caf085e (diff)
downloadlettnytt-973370074414ad5ab8f2c401001793294822bf16.tar.xz
lettnytt-973370074414ad5ab8f2c401001793294822bf16.zip
feat: WIP! radio series details
Diffstat (limited to 'src/Endpoints')
-rw-r--r--src/Endpoints/GetRadioSeriesDetails.cs26
-rw-r--r--src/Endpoints/GetRadioSeriesList.cs14
2 files changed, 38 insertions, 2 deletions
diff --git a/src/Endpoints/GetRadioSeriesDetails.cs b/src/Endpoints/GetRadioSeriesDetails.cs
new file mode 100644
index 0000000..0bdbd6c
--- /dev/null
+++ b/src/Endpoints/GetRadioSeriesDetails.cs
@@ -0,0 +1,26 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace I2R.LightNews.Endpoints;
+
+public class GetRadioSeriesDetails : EndpointBase
+{
+ private readonly NrkRadioService _radio;
+
+ public GetRadioSeriesDetails(NrkRadioService radio) {
+ _radio = radio;
+ }
+
+ public class Response
+ {
+ public List<RadioSeason> Seasons { get; set; }
+ public List<RadioEpisode> Episodes { get; set; }
+ }
+
+ [HttpGet("~/radio-series/{id:int}")]
+ public ActionResult GetRadioSeries(int id) {
+ var series = RadioIndexDb.GetSeriesById(id);
+ if (series == default) {
+ return NoContent();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Endpoints/GetRadioSeriesList.cs b/src/Endpoints/GetRadioSeriesList.cs
index 7898f25..1005a45 100644
--- a/src/Endpoints/GetRadioSeriesList.cs
+++ b/src/Endpoints/GetRadioSeriesList.cs
@@ -6,8 +6,18 @@ public class RadioSearchEndpoint : EndpointBase
{
public RadioSearchEndpoint() { }
+ public class Response
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ }
+
[HttpGet("~/radio-series")]
- public async Task<ActionResult> HandleAsync(string q) {
- return Ok(RadioIndexDb.GetSeries(q));
+ public async Task<ActionResult<List<Response>>> HandleAsync(string q) {
+ var series = RadioIndexDb.GetSeries(q);
+ return Ok(series.Select(c => new Response() {
+ Id = c.Id,
+ Name = c.Name
+ }));
}
} \ No newline at end of file