endpoint for SendHardResetAsync

This commit is contained in:
Vinzenz Schroeter 2024-05-08 00:30:11 +02:00
parent c7bfceffe1
commit a4aab442e5

View file

@ -1,6 +1,7 @@
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using DisplayCommands;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -17,7 +18,8 @@ internal sealed class Endpoints(
PlayerServer playerService, PlayerServer playerService,
ControlsServer controlsServer, ControlsServer controlsServer,
MapService mapService, MapService mapService,
ChangeToRequestedMap changeToRequestedMap ChangeToRequestedMap changeToRequestedMap,
IDisplayConnection displayConnection
) )
{ {
public void Map(WebApplication app) public void Map(WebApplication app)
@ -29,6 +31,7 @@ internal sealed class Endpoints(
app.Map("/controls", ConnectControlsAsync); app.Map("/controls", ConnectControlsAsync);
app.MapGet("/map", () => mapService.MapNames); app.MapGet("/map", () => mapService.MapNames);
app.MapPost("/map", PostMap); app.MapPost("/map", PostMap);
app.MapPost("/resetDisplay", displayConnection.SendHardResetAsync);
app.MapGet("/map/{name}", GetMapByName); app.MapGet("/map/{name}", GetMapByName);
app.MapHealthChecks("/health", new HealthCheckOptions app.MapHealthChecks("/health", new HealthCheckOptions