основной круд готов-

This commit is contained in:
gorbenko.pavel
2026-07-23 13:55:53 +05:00
parent 719cd81391
commit 1a5ed34182
18 changed files with 666 additions and 1 deletions
@@ -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();
}