| | | 1 | | namespace Syki.Back.Features.Teacher.CreateClassActivity; |
| | | 2 | | |
| | | 3 | | [ApiController, AuthTeacher] |
| | | 4 | | [EnableRateLimiting("Medium")] |
| | 170 | 5 | | public class CreateClassActivityController(CreateClassActivityService service) : ControllerBase |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// Criar atividade |
| | | 9 | | /// </summary> |
| | | 10 | | /// <remarks> |
| | | 11 | | /// Cria uma atividade vinculada à turma especificada |
| | | 12 | | /// </remarks> |
| | | 13 | | [HttpPost("teacher/classes/{id}/activities")] |
| | | 14 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | | 15 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | | 16 | | public async Task<IActionResult> Create([FromRoute] Guid id, [FromBody] CreateClassActivityIn data) |
| | | 17 | | { |
| | 170 | 18 | | var result = await service.Create(User.Id, id, data); |
| | 170 | 19 | | return result.Match<IActionResult>(Ok, BadRequest); |
| | 170 | 20 | | } |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | internal class RequestExamples : ExamplesProvider<CreateClassActivityIn>; |
| | | 24 | | internal class ResponseExamples : ExamplesProvider<CreateClassActivityOut>; |
| | | 25 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | | 26 | | ClassNotFound, |
| | | 27 | | InvalidClassActivityWeight>; |