26 lines
822 B
C#
26 lines
822 B
C#
using Gateway.Services;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Text.Json;
|
|
|
|
namespace Gateway.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/execution")]
|
|
public sealed class ExecutionController : ControllerBase
|
|
{
|
|
private readonly ExecutionService _svc;
|
|
public ExecutionController(ExecutionService svc) => _svc = svc;
|
|
|
|
[HttpPost("request")]
|
|
public async Task<IActionResult> Execute([FromBody] JsonElement body)
|
|
{
|
|
if (body.ValueKind == JsonValueKind.Undefined || body.ValueKind == JsonValueKind.Null)
|
|
return BadRequest(new { ok = false, error = "Missing request body" });
|
|
|
|
var resp = await _svc.ExecuteAsync(body, HttpContext.RequestAborted);
|
|
|
|
// resp is JsonElement / JsonDocument / string json — you decide.
|
|
return Content(resp, "application/json");
|
|
}
|
|
}
|