основной круд готов-
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Tnsu.ApprovalRoute.Api.Common;
|
||||
using Tnsu.ApprovalRoute.Application.TemplateRouteSteps;
|
||||
|
||||
namespace Tnsu.ApprovalRoute.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/template-routes/{routeId:guid}/steps")]
|
||||
public sealed class TemplateRouteStepsController(ISender mediator) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List(Guid routeId, CancellationToken ct) =>
|
||||
(await mediator.Send(new ListTemplateRouteStepsQuery(routeId), ct)).ToActionResult();
|
||||
|
||||
[HttpGet("{id:guid}")]
|
||||
public async Task<IActionResult> Get(Guid routeId, Guid id, CancellationToken ct) =>
|
||||
(await mediator.Send(new GetTemplateRouteStepQuery(routeId, id), ct)).ToActionResult();
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Create(Guid routeId, CreateTemplateRouteStepRequest body, CancellationToken ct) =>
|
||||
(await mediator.Send(new CreateTemplateRouteStepCommand(routeId, body), ct)).ToActionResult();
|
||||
|
||||
[HttpPut("{id:guid}")]
|
||||
public async Task<IActionResult> Update(Guid routeId, Guid id, UpdateTemplateRouteStepRequest body, CancellationToken ct) =>
|
||||
(await mediator.Send(new UpdateTemplateRouteStepCommand(routeId, id, body), ct)).ToActionResult();
|
||||
|
||||
[HttpDelete("{id:guid}")]
|
||||
public async Task<IActionResult> Delete(Guid routeId, Guid id, CancellationToken ct) =>
|
||||
(await mediator.Send(new DeleteTemplateRouteStepCommand(routeId, id), ct)).ToActionResult();
|
||||
}
|
||||
Reference in New Issue
Block a user