using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Tnsu.ApprovalRoute.Api.Common; using Tnsu.ApprovalRoute.Application.TemplateRouteSteps; namespace Tnsu.ApprovalRoute.Api.Controllers; [ApiController] [Authorize] [Route("api/template-routes/{routeId:guid}/steps")] public sealed class TemplateRouteStepsController(TemplateRouteStepService service) : ControllerBase { [HttpGet] public async Task List(Guid routeId, CancellationToken ct) => (await service.ListAsync(routeId, ct)).ToActionResult(); [HttpGet("{id:guid}")] public async Task Get(Guid routeId, Guid id, CancellationToken ct) => (await service.GetAsync(routeId, id, ct)).ToActionResult(); [HttpPost] public async Task Create(Guid routeId, CreateTemplateRouteStepRequest body, CancellationToken ct) => (await service.CreateAsync(routeId, body, ct)).ToActionResult(); [HttpPut("{id:guid}")] public async Task Update(Guid routeId, Guid id, UpdateTemplateRouteStepRequest body, CancellationToken ct) => (await service.UpdateAsync(routeId, id, body, ct)).ToActionResult(); [HttpDelete("{id:guid}")] public async Task Delete(Guid routeId, Guid id, CancellationToken ct) => (await service.DeleteAsync(routeId, id, ct)).ToActionResult(); }