feat: add get group by faculty id
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m41s
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m41s
This commit is contained in:
parent
ee2351b5ed
commit
5536162521
@ -80,5 +80,29 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
CourseNumber = GetCourseNumber(result.Name)
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of groups by faculty ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the faculty.</param>
|
||||
/// <returns>A list of groups belonging to the specified faculty.</returns>
|
||||
[HttpGet("{id:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
[NotFoundResponse]
|
||||
public async Task<ActionResult<List<GroupResponse>>> GetByFaculty(int id)
|
||||
{
|
||||
var result = await mediator.Send(new GetGroupListQuery());
|
||||
|
||||
return Ok(result.Groups
|
||||
.Where(g => g.FacultyId == id)
|
||||
.Select(g => new GroupResponse()
|
||||
{
|
||||
Id = g.Id,
|
||||
Name = g.Name,
|
||||
CourseNumber = GetCourseNumber(g.Name),
|
||||
FacultyId = g.FacultyId
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user