df94ed3cd4
- GatewayBridgeController: MCP-artiger Kommando-Adapter für Agent-zu-Backend - TaskBridgeService + LiveUpdateService: SSE Live-Sync + Bridge-Kommandos - FlowBoard.vue: Board-first orchestration dashboard panel - live-sync.ts store + live.ts service: SSE-basierte Live-Updates - Nullability-Warnung in HealthController.cs gefixt - nginx.conf: SSE-Proxy + CORS für Bridge-Endpunkte - .gitignore: pnpm/corepack local caches ausgeschlossen - docs: architecture-board-first-orchestration.md hinzugefügt - README: Backend Bridge API dokumentiert
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Nexus.Api.DTOs;
|
|
using Nexus.Api.Services;
|
|
|
|
namespace Nexus.Api.Controllers;
|
|
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/v1/projects")]
|
|
public class ProjectsController(IProjectService projectService) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<IResult> GetAll(CancellationToken ct)
|
|
=> Results.Ok(await projectService.GetAllAsync(ct));
|
|
|
|
[HttpGet("{id:guid}")]
|
|
public async Task<IResult> GetById(Guid id, CancellationToken ct)
|
|
{
|
|
var project = await projectService.GetByIdAsync(id, ct);
|
|
return project is null ? Results.NotFound() : Results.Ok(project);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<IResult> Create([FromBody] CreateProjectRequest request, CancellationToken ct)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(request.Name))
|
|
return Results.ValidationProblem(new Dictionary<string, string[]> { ["name"] = ["Name is required."] });
|
|
|
|
var project = await projectService.CreateAsync(request, ct);
|
|
return Results.Created($"/api/v1/projects/{project.Id}", project);
|
|
}
|
|
|
|
[HttpPatch("{id:guid}")]
|
|
public async Task<IResult> Update(Guid id, [FromBody] UpdateProjectRequest request, CancellationToken ct)
|
|
{
|
|
var project = await projectService.UpdateAsync(id, request, ct);
|
|
return project is null ? Results.NotFound() : Results.Ok(project);
|
|
}
|
|
|
|
[HttpDelete("{id:guid}")]
|
|
public async Task<IResult> Delete(Guid id, CancellationToken ct)
|
|
{
|
|
var result = await projectService.DeleteAsync(id, ct);
|
|
return result.Outcome switch
|
|
{
|
|
ProjectDeleteOutcome.NotFound => Results.NotFound(),
|
|
ProjectDeleteOutcome.Archived => Results.Ok(result.Project),
|
|
_ => Results.NoContent()
|
|
};
|
|
}
|
|
}
|