| | 1 | | namespace Syki.Back.Features.Academic.CreateCourseOffering; |
| | 2 | |
|
| | 3 | | [ApiController, AuthAcademic] |
| | 4 | | [EnableRateLimiting("Medium")] |
| 516 | 5 | | public class CreateCourseOfferingController(CreateCourseOfferingService service) : ControllerBase |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Criar oferta de curso |
| | 9 | | /// </summary> |
| | 10 | | /// <remarks> |
| | 11 | | /// Cria uma nova oferta de curso. |
| | 12 | | /// </remarks> |
| | 13 | | [HttpPost("academic/course-offerings")] |
| | 14 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | 15 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | 16 | | public async Task<IActionResult> Create([FromBody] CreateCourseOfferingIn data) |
| | 17 | | { |
| 516 | 18 | | var result = await service.Create(User.InstitutionId, data); |
| 516 | 19 | | return result.Match<IActionResult>(Ok, BadRequest); |
| 516 | 20 | | } |
| | 21 | | } |
| | 22 | |
|
| | 23 | | internal class RequestExamples : ExamplesProvider<CreateCourseOfferingIn>; |
| | 24 | | internal class ResponseExamples : ExamplesProvider<CourseOfferingOut>; |
| | 25 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | 26 | | CampusNotFound, |
| | 27 | | CourseNotFound, |
| | 28 | | CourseCurriculumNotFound, |
| | 29 | | AcademicPeriodNotFound, |
| | 30 | | InvalidShift>; |