Rename Public -> App
This commit is contained in:
21
api/App/Endpoints/LokEndpoints.cs
Normal file
21
api/App/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");
|
||||
}
|
||||
}
|
||||
31
api/App/Endpoints/SystemEndpoints.cs
Normal file
31
api/App/Endpoints/SystemEndpoints.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.Data.Sqlite;
|
||||
|
||||
public static class SystemEndpoints
|
||||
{
|
||||
public static void MapSystemEndpoints(WebApplication app)
|
||||
{
|
||||
app.MapGet("/", () =>
|
||||
{
|
||||
return new
|
||||
{
|
||||
Version = "1.0.0"
|
||||
};
|
||||
})
|
||||
.WithName("GetVersion");
|
||||
|
||||
app.MapGet("/health/db", async (SqliteConnection connection) =>
|
||||
{
|
||||
await connection.OpenAsync();
|
||||
await using var command = connection.CreateCommand();
|
||||
command.CommandText = "SELECT 1";
|
||||
var result = await command.ExecuteScalarAsync();
|
||||
|
||||
return Results.Ok(new
|
||||
{
|
||||
Database = "ok",
|
||||
Result = result
|
||||
});
|
||||
})
|
||||
.WithName("GetDatabaseHealth");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user