Initial import into Gitea

This commit is contained in:
Grae Jones
2026-03-14 13:50:09 -07:00
parent 8e7e03702e
commit 34c1f09e01
154 changed files with 17666 additions and 1548 deletions

View File

@@ -0,0 +1,48 @@
using Creative.Models;
using Creative.Security;
using Creative.Services;
using Microsoft.AspNetCore.Mvc;
namespace Creative.Controllers;
/// <summary>
/// Internal endpoint called by Gateway.
/// Single dispatch point: POST /internal/execute
/// </summary>
[ApiController]
[Route("internal")]
public class InternalController : ControllerBase
{
private readonly CreativeService _service;
private readonly ILogger<InternalController> _logger;
public InternalController(CreativeService service, ILogger<InternalController> logger)
{
_service = service;
_logger = logger;
}
/// <summary>
/// Execute a creative operation.
/// Called by Gateway with X-Internal-Key header.
/// </summary>
[HttpPost("execute")]
[ServiceFilter(typeof(InternalAuthFilter))]
public async Task<IActionResult> Execute(
[FromBody] CreativeRequest request,
CancellationToken ct)
{
var requestId = Request.Headers["X-Request-Id"].FirstOrDefault()
?? request.RequestId
?? Guid.NewGuid().ToString("N");
request.RequestId = requestId;
_logger.LogInformation("[Internal] {Operation} | RequestId={RequestId}",
request.Operation, requestId);
var result = await _service.ExecuteAsync(request, ct);
return result.Ok ? Ok(result) : BadRequest(result);
}
}