Skip to content

Commit 538f5f9

Browse files
committed
PostAutomatedSolution: валидация агента
1 parent 1d97c51 commit 538f5f9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

HwProj.APIGateway/HwProj.APIGateway.API/Controllers/SolutionsController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ public async Task<IActionResult> PostAutomatedSolution(PostAutomatedSolutionMode
331331
{
332332
var course = await _coursesServiceClient.GetCourseById(courseId);
333333
if (course is null) return BadRequest($"Курс с Id {courseId} не найден");
334+
if (!course.MentorIds.Contains(UserId))
335+
return BadRequest("Добавлять автоматизированные решения могут только зарегистрированные на курс агенты");
334336

335337
var tasks = course.Homeworks.SelectMany(t => t.Tasks);
336338
var task = model.TaskIdType switch

0 commit comments

Comments
 (0)