From f2d2dc9a32bbdf19cb6effb1956e886073db0f7f Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 16 Jan 2026 09:57:18 +0100 Subject: [PATCH] Add procedure-based CRUD endpoints to ProfileController Extended ProfileController with POST, PUT, and DELETE endpoints for profile management using InsertProfileProcedure, UpdateProfileProcedure, and DeleteProfileProcedure. Added necessary using directives and XML documentation for each new endpoint. --- src/ReC.API/Controllers/ProfileController.cs | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/ReC.API/Controllers/ProfileController.cs b/src/ReC.API/Controllers/ProfileController.cs index 125dfb9..c2f1eb5 100644 --- a/src/ReC.API/Controllers/ProfileController.cs +++ b/src/ReC.API/Controllers/ProfileController.cs @@ -1,5 +1,9 @@ using MediatR; using Microsoft.AspNetCore.Mvc; +using ReC.Application.Common.Procedures.DeleteProcedure; +using ReC.Application.Common.Procedures.InsertProcedure; +using ReC.Application.Common.Procedures.UpdateProcedure; +using ReC.Application.Profile.Commands; using ReC.Application.Profile.Queries; namespace ReC.API.Controllers; @@ -13,4 +17,47 @@ public class ProfileController(IMediator mediator) : ControllerBase { return Ok(await mediator.Send(query, cancel)); } + + /// + /// Inserts a profile via the PROFILE insert procedure. + /// + /// InsertProfileProcedure payload. + /// A token to cancel the operation. + /// The created profile identifier. + [HttpPost] + [ProducesResponseType(StatusCodes.Status201Created)] + public async Task Post([FromBody] InsertProfileProcedure procedure, CancellationToken cancel) + { + var id = await mediator.ExecuteInsertProcedure(procedure, cancel: cancel); + return StatusCode(StatusCodes.Status201Created, id); + } + + /// + /// Updates a profile via the PROFILE update procedure. + /// + /// Profile identifier to update. + /// UpdateProfileProcedure payload. + /// A token to cancel the operation. + /// No content on success. + [HttpPut("{id:long}")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task Put([FromRoute] long id, [FromBody] UpdateProfileProcedure procedure, CancellationToken cancel) + { + await mediator.ExecuteUpdateProcedure(procedure, id, cancel: cancel); + return NoContent(); + } + + /// + /// Deletes profile records via the PROFILE delete procedure for the specified id range. + /// + /// DeleteProfileProcedure payload (Start, End, Force). + /// A token to cancel the operation. + /// No content on success. + [HttpDelete] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task Delete([FromBody] DeleteProfileProcedure procedure, CancellationToken cancel) + { + await mediator.ExecuteDeleteProcedure(procedure, cancel); + return NoContent(); + } } \ No newline at end of file