Cleaned up interfaces. Extracted server state machine trigger handler to seperated classes. Removed legacy code

This commit is contained in:
2025-09-06 15:34:35 +02:00
parent 7587a7e8e3
commit 348e9560ab
97 changed files with 1256 additions and 4670 deletions

View File

@@ -32,13 +32,18 @@ public class SettingsController : Controller
[HttpPost("{serverId:int}/install")]
[Authorize]
public async Task Install([FromRoute] int serverId)
public async Task<ActionResult> Install([FromRoute] int serverId)
{
var server = await GetServerById(serverId);
await ServerService.Install(server);
if (server.Value == null)
return server.Result ?? Problem("Unable to retrieve server");
await ServerService.Install(server.Value);
return NoContent();
}
private async Task<Server> GetServerById(int serverId)
private async Task<ActionResult<Server>> GetServerById(int serverId)
{
var server = await ServerRepository
.Get()
@@ -46,7 +51,7 @@ public class SettingsController : Controller
.FirstOrDefaultAsync(x => x.Id == serverId);
if (server == null)
throw new HttpApiException("No server with this id found", 404);
return Problem("No server with this id found", statusCode: 404);
var authorizeResult = await AuthorizeService.Authorize(
User, server,
@@ -56,9 +61,9 @@ public class SettingsController : Controller
if (!authorizeResult.Succeeded)
{
throw new HttpApiException(
return Problem(
authorizeResult.Message ?? "No permission for the requested resource",
403
statusCode: 403
);
}