Add new insert endpoint for Lok open hours

This commit is contained in:
2026-02-17 23:06:29 +02:00
parent 7fba6ccc17
commit 49bf808c1d
7 changed files with 217 additions and 12 deletions

View File

@@ -2,11 +2,18 @@ public static class LokEndpoints
{
public static void MapLokEndpoints(WebApplication app)
{
app.MapPost("/lok/open-hours", async (LokOpenHours openHours, LokService lokService) =>
{
var createdOpenHours = await lokService.InsertOpenHours(openHours);
return Results.Created("/lok/open-hours", createdOpenHours);
})
.WithName("CreateLokOpenHours");
app.MapGet("/lok/open-hours", async (LokService lokService) =>
{
var openHours = await lokService.GetOpenHoursAsync();
var openHours = await lokService.GetOpenHours();
if (openHours is null)
if (openHours.Count == 0)
{
return Results.NotFound(new
{