Get endpoint for LOK open hours
This commit is contained in:
21
api/Public/Endpoints/LokEndpoints.cs
Normal file
21
api/Public/Endpoints/LokEndpoints.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
public static class LokEndpoints
|
||||
{
|
||||
public static void MapLokEndpoints(WebApplication app)
|
||||
{
|
||||
app.MapGet("/lok/open-hours", async (LokService lokService) =>
|
||||
{
|
||||
var openHours = await lokService.GetOpenHoursAsync();
|
||||
|
||||
if (openHours is null)
|
||||
{
|
||||
return Results.NotFound(new
|
||||
{
|
||||
Message = "Open hours not found."
|
||||
});
|
||||
}
|
||||
|
||||
return Results.Ok(openHours);
|
||||
})
|
||||
.WithName("GetLokOpenHours");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Data.Sqlite;
|
||||
|
||||
public static class PublicEndpoints
|
||||
public static class SystemEndpoints
|
||||
{
|
||||
public static void MapPublicEndpoints(WebApplication app)
|
||||
public static void MapSystemEndpoints(WebApplication app)
|
||||
{
|
||||
app.MapGet("/", () =>
|
||||
{
|
||||
@@ -28,4 +28,4 @@ public static class PublicEndpoints
|
||||
})
|
||||
.WithName("GetDatabaseHealth");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user