using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using YPS.Beer.Services; namespace YPS.Beer.Controllers; [Authorize] [ApiController] [Route("[controller]")] public class BeerController : ControllerBase { private readonly IPunkService _punkService; public BeerController(IPunkService punkService) { _punkService = punkService; } [HttpGet("/{id}")] public async Task GetBeer(int id) { var beer = await _punkService.GetBeer(id); return beer is null ? NotFound() : Ok(beer); } [HttpGet] public async Task SearchBeer(string search) { return Ok(await _punkService.FindBeers(search)); } }