| | 1 | | namespace Syki.Back.Features.Academic.CreateClass; |
| | 2 | |
|
| | 3 | | [ApiController, AuthAcademic] |
| | 4 | | [EnableRateLimiting("Medium")] |
| 608 | 5 | | public class CreateClassController(CreateClassService service) : ControllerBase |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Criar turma |
| | 9 | | /// </summary> |
| | 10 | | /// <remarks> |
| | 11 | | /// Cria uma nova turma. |
| | 12 | | /// </remarks> |
| | 13 | | [HttpPost("academic/classes")] |
| | 14 | | [DbContextTransactionFilter] |
| | 15 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | 16 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | 17 | | public async Task<IActionResult> Create([FromBody] CreateClassIn data) |
| | 18 | | { |
| 608 | 19 | | var result = await service.Create(User.InstitutionId, data); |
| 608 | 20 | | return result.Match<IActionResult>(Ok, BadRequest); |
| 608 | 21 | | } |
| | 22 | | } |
| | 23 | |
|
| | 24 | | internal class RequestExamples : ExamplesProvider<CreateClassIn>; |
| | 25 | | internal class ResponseExamples : ExamplesProvider<ClassOut>; |
| | 26 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | 27 | | DisciplineNotFound, |
| | 28 | | TeacherNotFound, |
| | 29 | | AcademicPeriodNotFound, |
| | 30 | | InvalidDay, |
| | 31 | | InvalidHour, |
| | 32 | | InvalidSchedule, |
| | 33 | | ConflictingSchedules>; |