feat: ship agent-first mission control v0.2.57
This commit is contained in:
@@ -1,20 +1,55 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Nexus.Api.Models;
|
||||
using Nexus.Api.Services;
|
||||
|
||||
namespace Nexus.Api.Controllers;
|
||||
|
||||
[Authorize(Roles = "owner")]
|
||||
[ProducesResponseType(
|
||||
typeof(OpenClawAgentConfigurationErrorDto),
|
||||
StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(
|
||||
typeof(OpenClawAgentConfigurationErrorDto),
|
||||
StatusCodes.Status409Conflict)]
|
||||
[ProducesResponseType(
|
||||
typeof(OpenClawAgentConfigurationErrorDto),
|
||||
StatusCodes.Status502BadGateway)]
|
||||
[ProducesResponseType(
|
||||
typeof(OpenClawAgentConfigurationErrorDto),
|
||||
StatusCodes.Status503ServiceUnavailable)]
|
||||
[ProducesResponseType(
|
||||
typeof(OpenClawAgentConfigurationErrorDto),
|
||||
StatusCodes.Status504GatewayTimeout)]
|
||||
[ApiController]
|
||||
[Route("api/v1/incidents")]
|
||||
public class IncidentsController(IIncidentService incidentService) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IResult> GetAll()
|
||||
=> Results.Ok(await incidentService.GetAllAsync());
|
||||
[ProducesResponseType(typeof(IReadOnlyList<IncidentSummary>), StatusCodes.Status200OK)]
|
||||
public Task<IResult> GetAll(
|
||||
[FromQuery] string agentId = "iris",
|
||||
CancellationToken cancellationToken = default)
|
||||
=> OpenClawContentReadEndpoint.ExecuteAsync(async () =>
|
||||
Results.Ok(await incidentService.GetAllAsync(
|
||||
agentId,
|
||||
cancellationToken)));
|
||||
|
||||
[HttpGet("{name}")]
|
||||
public async Task<IResult> GetOne(string name)
|
||||
{
|
||||
var incident = await incidentService.GetByNameAsync(name);
|
||||
return incident is null ? Results.NotFound() : Results.Ok(incident);
|
||||
}
|
||||
[ProducesResponseType(typeof(IncidentDetail), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public Task<IResult> GetOne(
|
||||
string name,
|
||||
[FromQuery] string agentId = "iris",
|
||||
CancellationToken cancellationToken = default)
|
||||
=> OpenClawContentReadEndpoint.ExecuteAsync(async () =>
|
||||
{
|
||||
var incident = await incidentService.GetByNameAsync(
|
||||
name,
|
||||
agentId,
|
||||
cancellationToken);
|
||||
return incident is null
|
||||
? Results.NotFound()
|
||||
: Results.Ok(incident);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user