Files
tnsu-approval-route/backend/src/Tnsu.ApprovalRoute.Api/Controllers/TemplateRouteStepsController.cs
T
2026-07-23 16:45:18 +05:00

33 lines
1.3 KiB
C#

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<IActionResult> List(Guid routeId, CancellationToken ct) =>
(await service.ListAsync(routeId, ct)).ToActionResult();
[HttpGet("{id:guid}")]
public async Task<IActionResult> Get(Guid routeId, Guid id, CancellationToken ct) =>
(await service.GetAsync(routeId, id, ct)).ToActionResult();
[HttpPost]
public async Task<IActionResult> Create(Guid routeId, CreateTemplateRouteStepRequest body, CancellationToken ct) =>
(await service.CreateAsync(routeId, body, ct)).ToActionResult();
[HttpPut("{id:guid}")]
public async Task<IActionResult> Update(Guid routeId, Guid id, UpdateTemplateRouteStepRequest body, CancellationToken ct) =>
(await service.UpdateAsync(routeId, id, body, ct)).ToActionResult();
[HttpDelete("{id:guid}")]
public async Task<IActionResult> Delete(Guid routeId, Guid id, CancellationToken ct) =>
(await service.DeleteAsync(routeId, id, ct)).ToActionResult();
}