| | | 1 | | namespace Syki.Back.Features.Students.GetStudent; |
| | | 2 | | |
| | | 3 | | [ApiController, Authorize(Policies.GetStudent)] |
| | 0 | 4 | | public class GetStudentController(GetStudentService service) : ControllerBase |
| | | 5 | | { |
| | | 6 | | /// <summary>Buscar aluno</summary> |
| | | 7 | | /// <remarks>Retorna os dados de um aluno, incluindo a oferta de curso atual.</remarks> |
| | | 8 | | [HttpGet("students/{studentId:int}")] |
| | | 9 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | | 10 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | | 11 | | public async Task<IActionResult> Get([FromRoute] int studentId) |
| | | 12 | | { |
| | 0 | 13 | | var result = await service.Get(studentId); |
| | 0 | 14 | | return result.Match<IActionResult>(Ok, BadRequest); |
| | 0 | 15 | | } |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | internal class RequestExamples : ExamplesProvider<GetStudentOut>; |
| | | 19 | | internal class ResponseExamples : ExamplesProvider<GetStudentOut>; |
| | | 20 | | internal class ErrorsExamples : ErrorExamplesProvider<StudentNotFound>; |