From 3864b0f68bf541a262e0779db888dc6b98c2ce1a Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 14 Jan 2026 13:13:23 +0100 Subject: [PATCH] Add CommonController with POST endpoint using MediatR Introduced CommonController in the ReC.API.Controllers namespace with a POST endpoint at "api/common". The endpoint accepts an InsertObjectProcedure from the request body, sends it via MediatR, and returns a 201 Created response with the generated ID. --- src/ReC.API/Controllers/CommonController.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/ReC.API/Controllers/CommonController.cs diff --git a/src/ReC.API/Controllers/CommonController.cs b/src/ReC.API/Controllers/CommonController.cs new file mode 100644 index 0000000..c3cef5b --- /dev/null +++ b/src/ReC.API/Controllers/CommonController.cs @@ -0,0 +1,17 @@ +using MediatR; +using Microsoft.AspNetCore.Mvc; +using ReC.Application.Common.Procedures.InsertProcedure; + +namespace ReC.API.Controllers; + +[Route("api/[controller]")] +[ApiController] +public class CommonController(IMediator mediator) : ControllerBase +{ + [HttpPost] + public async Task CreateObject([FromBody] InsertObjectProcedure procedure, CancellationToken cancel) + { + var id = await mediator.Send(procedure, cancel); + return StatusCode(StatusCodes.Status201Created, id); + } +} \ No newline at end of file