| | | 1 | | namespace Estud.Back.Features.Periods.CreateEnrollmentPeriod; |
| | | 2 | | |
| | | 3 | | [ApiController, Authorize(Policies.CreateEnrollmentPeriod)] |
| | 14 | 4 | | public class CreateEnrollmentPeriodController(CreateEnrollmentPeriodService service) : ControllerBase |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Criar período de matrícula |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// Cria um novo período de matrícula. |
| | | 11 | | /// </remarks> |
| | | 12 | | [HttpPost("periods/enrollment")] |
| | | 13 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | | 14 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | | 15 | | public async Task<IActionResult> Create([FromBody] CreateEnrollmentPeriodIn data) |
| | | 16 | | { |
| | 14 | 17 | | var result = await service.Create(data); |
| | 14 | 18 | | return result.Match<IActionResult>(Ok, BadRequest); |
| | 14 | 19 | | } |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | internal class RequestExamples : ExamplesProvider<CreateEnrollmentPeriodIn> { } |
| | | 23 | | internal class ResponseExamples : ExamplesProvider<CreateEnrollmentPeriodOut> { } |
| | | 24 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | | 25 | | InvalidEnrollmentPeriodDates, |
| | | 26 | | EnrollmentPeriodAlreadyExists |
| | | 27 | | >; |