using System.ComponentModel.DataAnnotations; using Asp.Versioning; using Baya.Application.Features.SupportAlerts.Commands.AssignSupportAlert; using Baya.Application.Features.SupportAlerts.Commands.ResolveSupportAlert; using Baya.Application.Features.SupportAlerts.Queries.ListSupportAlerts; using Baya.Application.Models.Common; using Baya.Application.Models.SupportAlerts; using Baya.Infrastructure.Identity.Identity.PermissionManager; using Baya.WebFramework.Attributes; using Baya.WebFramework.BaseController; using Mediator; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Baya.Web.Api.Controllers.V1; [ApiVersion("1")] [ApiController] [Route("api/v{version:apiVersion}/[controller]")] [Authorize(ConstantPolicies.DynamicPermission)] [Display(Description = "Admin-only: the internal support-alert worklist (never user-facing)")] public sealed class SupportAlertsController(ISender sender) : BaseController { [HttpGet("[action]")] [ProducesOkApiResponseType>] public async Task GetSupportAlerts([FromQuery] ListSupportAlertsQuery query, CancellationToken cancellationToken) => OperationResult(await sender.Send(query, cancellationToken)); [HttpPost("[action]")] [ProducesOkApiResponseType] public async Task AssignSupportAlert(AssignSupportAlertCommand command, CancellationToken cancellationToken) => OperationResult(await sender.Send(command, cancellationToken)); [HttpPost("[action]")] [ProducesOkApiResponseType] public async Task ResolveSupportAlert(ResolveSupportAlertCommand command, CancellationToken cancellationToken) => OperationResult(await sender.Send(command, cancellationToken)); }