diff --git a/src/ReC.API/Controllers/EndpointsController.cs b/src/ReC.API/Controllers/EndpointsController.cs index b486166..c69af98 100644 --- a/src/ReC.API/Controllers/EndpointsController.cs +++ b/src/ReC.API/Controllers/EndpointsController.cs @@ -1,15 +1,12 @@ 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.Endpoints.Commands; namespace ReC.API.Controllers; [Route("api/[controller]")] [ApiController] -public class EndpointsController(IMediator mediator, IConfiguration config) : ControllerBase +public class EndpointsController(IMediator mediator) : ControllerBase { /// /// Inserts an endpoint via the ENDPOINT insert procedure. @@ -21,22 +18,21 @@ public class EndpointsController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status201Created)] public async Task Post([FromBody] InsertEndpointProcedure procedure, CancellationToken cancel) { - var id = await mediator.ExecuteInsertProcedure(procedure, config["AddedWho"], cancel); + var id = await mediator.Send(procedure, cancel); return StatusCode(StatusCodes.Status201Created, id); } /// /// Updates an endpoint via the ENDPOINT update procedure. /// - /// ENDPOINT identifier to update. /// UpdateEndpointProcedure payload. /// A token to cancel the operation. /// No content on success. - [HttpPut("{id:long}")] + [HttpPut] [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task Put([FromRoute] long id, [FromBody] UpdateEndpointProcedure procedure, CancellationToken cancel) + public async Task Put([FromBody] UpdateEndpointProcedure procedure, CancellationToken cancel) { - await mediator.ExecuteUpdateProcedure(procedure, id, cancel: cancel); + await mediator.Send(procedure, cancel); return NoContent(); } @@ -50,7 +46,7 @@ public class EndpointsController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task Delete([FromBody] DeleteEndpointProcedure procedure, CancellationToken cancel) { - await mediator.ExecuteDeleteProcedure(procedure, cancel); + await mediator.Send(procedure, cancel); return NoContent(); } }