using Asp.Versioning; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using TarninaHub.Application.Abstractions; using TarninaHub.Application.Security; namespace TarninaHub.Controllers; [ApiController] [ApiVersion("1.0")] [Route("api/matchmaking")] [Authorize] public class MatchmakingController : ControllerBase { private readonly IMatchmakingService _matchmakingService; public MatchmakingController(IMatchmakingService matchmakingService) { _matchmakingService = matchmakingService; } [HttpPost("reindex")] [Authorize(Policy = Policies.AdminOnly)] public async Task> Reindex(CancellationToken cancellationToken) { var indexed = await _matchmakingService.ReindexAsync(cancellationToken); return Ok(new MatchmakingReindexResponse(indexed)); } } public sealed record MatchmakingReindexResponse(int Indexed);