| | | 1 | | namespace Syki.Back.Features.Disciplines.GetDisciplinePotentialCourses; |
| | | 2 | | |
| | | 3 | | [ApiController, Authorize(Policies.GetDisciplinePotentialCourses)] |
| | 0 | 4 | | public class GetDisciplinePotentialCoursesController(GetDisciplinePotentialCoursesService service) : ControllerBase |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Cursos disponíveis para vincular à disciplina |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// Retorna os cursos ainda não vinculados à disciplina, com suporte a pesquisa por nome. |
| | | 11 | | /// </remarks> |
| | | 12 | | [HttpGet("disciplines/{id}/potential-courses")] |
| | | 13 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | | 14 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | | 15 | | public async Task<IActionResult> Get(int id, [FromQuery] string? name) |
| | | 16 | | { |
| | 0 | 17 | | var result = await service.Get(id, name); |
| | 0 | 18 | | return result.Match<IActionResult>(Ok, BadRequest); |
| | 0 | 19 | | } |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | internal class ResponseExamples : ExamplesProvider<GetDisciplinePotentialCoursesOut>; |
| | | 23 | | internal class ErrorsExamples : ErrorExamplesProvider<DisciplineNotFound>; |