Adds 2 units and docs for unit 3. nfr-requirements plan

This commit is contained in:
2026-06-29 22:18:37 +02:00
parent 0e01ca1e1c
commit c156107cb1
126 changed files with 15204 additions and 80199 deletions
@@ -0,0 +1,51 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SlpModularCms.Modules.Master.Models;
using SlpModularCms.Modules.Master.Services;
namespace SlpModularCms.Modules.Master.Controllers;
[ApiController]
[Route("[controller]")]
[Authorize(Policy = "OwnerOnly")]
public class CmsInstanceController(ICmsInstanceService service) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetAll()
{
var instances = await service.GetAllAsync();
return Ok(instances);
}
[HttpPost]
public async Task<IActionResult> Add([FromBody] CreateCmsInstanceRequest request)
{
try
{
var dto = await service.AddAsync(request);
return CreatedAtAction(nameof(GetAll), null, dto);
}
catch (ArgumentException ex)
{
return BadRequest(new { error = ex.Message });
}
}
[HttpPut("{id:guid}/status")]
public async Task<IActionResult> UpdateStatus(Guid id, [FromBody] UpdateStatusRequest request)
{
try
{
var result = await service.UpdateStatusAsync(id, request);
return Ok(result);
}
catch (KeyNotFoundException ex)
{
return NotFound(new { error = ex.Message });
}
catch (ArgumentException ex)
{
return BadRequest(new { error = ex.Message });
}
}
}