using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Serwer.Infrastructure.Services; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Serwer.Api.Controllers { [Route("api/[controller]")] [ApiController] public class SearchController : ControllerBase { private readonly ISearchService _searchService; public SearchController(ISearchService searchService) { _searchService = searchService; } [Authorize] [HttpGet("{query}")] public async Task Search(string query) { var id = User.Identity.Name; var results = await _searchService.Search(Guid.Parse(id), query); return Ok(results); } } }