| | 1 | | namespace Syki.Back.Features.Academic.CreateTeacher; |
| | 2 | |
|
| | 3 | | [ApiController, AuthAcademic] |
| | 4 | | [EnableRateLimiting("Medium")] |
| 264 | 5 | | public class CreateTeacherController(CreateTeacherService service) : ControllerBase |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Criar professor |
| | 9 | | /// </summary> |
| | 10 | | /// <remarks> |
| | 11 | | /// Cria um novo professor. |
| | 12 | | /// Um link para redefinição de senha será enviado pro email informado. |
| | 13 | | /// </remarks> |
| | 14 | | [HttpPost("academic/teachers")] |
| | 15 | | [DbContextTransactionFilter] |
| | 16 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | 17 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | 18 | | public async Task<IActionResult> Create([FromBody] CreateTeacherIn data) |
| | 19 | | { |
| 264 | 20 | | var result = await service.Create(User.InstitutionId, data); |
| 264 | 21 | | return result.Match<IActionResult>(Ok, BadRequest); |
| 264 | 22 | | } |
| | 23 | | } |
| | 24 | |
|
| | 25 | | internal class RequestExamples : ExamplesProvider<CreateTeacherIn>; |
| | 26 | | internal class ResponseExamples : ExamplesProvider<TeacherOut>; |
| | 27 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | 28 | | InvalidEmail, |
| | 29 | | EmailAlreadyUsed, |
| | 30 | | WeakPassword>; |