Files
baya-monorepo/server/src/API/Baya.Web.Api/Controllers/V1/AdminEvvController.cs
T
2026-07-06 19:23:44 +03:30

40 lines
1.7 KiB
C#

using System.ComponentModel.DataAnnotations;
using Asp.Versioning;
using Baya.Application.Features.Bookings.Commands.DetectNoShowSessions;
using Baya.Application.Features.Bookings.Queries.ListAdminEvv;
using Baya.Application.Models.Booking;
using Baya.Application.Models.Common;
using Baya.Infrastructure.Identity.Identity.PermissionManager;
using Baya.WebFramework.Attributes;
using Baya.WebFramework.BaseController;
using Baya.WebFramework.ServiceConfiguration;
using Mediator;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
namespace Baya.Web.Api.Controllers.V1;
/// <summary>
/// The admin EVV-review surface: the mismatch/no-show queue and the manual no-show sweep trigger (the same
/// idempotent command the deferred cron will call).
/// </summary>
[ApiVersion("1")]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[Authorize(ConstantPolicies.DynamicPermission)]
[EnableRateLimiting(RateLimitingServiceExtension.SensitivePolicy)]
[Display(Description = "Admin EVV review queue (location mismatch / no-show) + manual no-show sweep")]
public sealed class AdminEvvController(ISender sender) : BaseController
{
[HttpGet("[action]")]
[ProducesOkApiResponseType<PagedResult<AdminEvvItemDto>>]
public async Task<IActionResult> List([FromQuery] ListAdminEvvQuery query, CancellationToken cancellationToken)
=> OperationResult(await sender.Send(query, cancellationToken));
[HttpPost("[action]")]
[ProducesOkApiResponseType<NoShowSweepResult>]
public async Task<IActionResult> DetectNoShows(CancellationToken cancellationToken)
=> OperationResult(await sender.Send(new DetectNoShowSessionsCommand(), cancellationToken));
}