diff --git a/ApiDto/Requests/ScheduleRequest.cs b/ApiDto/Requests/ScheduleRequest.cs
index 476d8f3..dc5dbb6 100644
--- a/ApiDto/Requests/ScheduleRequest.cs
+++ b/ApiDto/Requests/ScheduleRequest.cs
@@ -8,30 +8,30 @@ public class ScheduleRequest
///
/// Gets or sets an array of group IDs.
///
- /// This array can contain null values.
public int[]? Groups { get; set; } = null;
///
/// Gets or sets a value indicating whether to retrieve schedules for even weeks.
///
- /// This property can contain null.
public bool? IsEven { get; set; } = null;
///
/// Gets or sets an array of discipline IDs.
///
- /// This array can contain null values.
public int[]? Disciplines { get; set; } = null;
///
/// Gets or sets an array of professor IDs.
///
- /// This array can contain null values.
public int[]? Professors { get; set; } = null;
///
/// Gets or sets an array of lecture hall IDs.
///
- /// This array can contain null values.
public int[]? LectureHalls { get; set; } = null;
+
+ ///
+ /// Gets or sets an array of lesson type IDs.
+ ///
+ public int[]? LessonType { get; set; } = null;
}
diff --git a/Endpoint/Controllers/V1/ImportController.cs b/Endpoint/Controllers/V1/ImportController.cs
index 7b76fef..835b86a 100644
--- a/Endpoint/Controllers/V1/ImportController.cs
+++ b/Endpoint/Controllers/V1/ImportController.cs
@@ -48,7 +48,8 @@ public class ImportController(IMediator mediator, IOptionsSnapshotAn array of discipline IDs.
/// An array of professor IDs.
/// An array of lecture hall IDs.
+ /// An array of type of occupation IDs.
/// A response containing schedules for the specified group.
[HttpGet("GetByGroup/{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@@ -110,14 +112,16 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot
+ [FromQuery] int[]? lectureHalls = null,
+ [FromQuery] int[]? lessonType = null) =>
await Get(new ScheduleRequest
{
Disciplines = disciplines,
IsEven = isEven,
Groups = [id],
Professors = professors,
- LectureHalls = lectureHalls
+ LectureHalls = lectureHalls,
+ LessonType = lessonType
});
///
@@ -128,6 +132,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of discipline IDs.
/// An array of group IDs.
/// An array of lecture hall IDs.
+ /// An array of type of occupation IDs.
/// A response containing schedules for the specified professor.
[HttpGet("GetByProfessor/{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@@ -137,14 +142,16 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot
+ [FromQuery] int[]? lectureHalls = null,
+ [FromQuery] int[]? lessonType = null) =>
await Get(new ScheduleRequest
{
Disciplines = disciplines,
IsEven = isEven,
Groups = groups,
Professors = [id],
- LectureHalls = lectureHalls
+ LectureHalls = lectureHalls,
+ LessonType = lessonType
});
///
@@ -155,6 +162,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of discipline IDs.
/// An array of professor IDs.
/// An array of group IDs.
+ /// An array of type of occupation IDs.
/// A response containing schedules for the specified lecture hall.
[HttpGet("GetByLectureHall/{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@@ -164,14 +172,16 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot
+ [FromQuery] int[]? professors = null,
+ [FromQuery] int[]? lessonType = null) =>
await Get(new ScheduleRequest
{
Disciplines = disciplines,
IsEven = isEven,
Groups = groups,
Professors = professors,
- LectureHalls = [id]
+ LectureHalls = [id],
+ LessonType = lessonType
});
///
@@ -182,6 +192,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of group IDs.
/// An array of professor IDs.
/// An array of lecture hall IDs.
+ /// An array of type of occupation IDs.
/// A response containing schedules for the specified discipline.
[HttpGet("GetByDiscipline/{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@@ -191,13 +202,15 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot
+ [FromQuery] int[]? lectureHalls = null,
+ [FromQuery] int[]? lessonType = null) =>
await Get(new ScheduleRequest
{
Disciplines = [id],
IsEven = isEven,
Groups = groups,
Professors = professors,
- LectureHalls = lectureHalls
+ LectureHalls = lectureHalls,
+ LessonType = lessonType
});
}
\ No newline at end of file
diff --git a/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQuery.cs b/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQuery.cs
index 939e1c6..dd42846 100644
--- a/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQuery.cs
+++ b/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQuery.cs
@@ -8,5 +8,6 @@ public class GetScheduleListQuery : IRequest
public int[]? DisciplineIds { get; set; }
public int[]? LectureHallIds { get; set; }
public int[]? ProfessorIds { get; set; }
+ public int[]? LessonTypeIds { get; set; }
public bool? IsEven { get; set; }
}
\ No newline at end of file
diff --git a/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs b/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs
index 626bee5..646109c 100644
--- a/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs
+++ b/SqlData/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs
@@ -16,6 +16,9 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
if (request.IsEven != null)
query = query.Where(l => l.IsEven == request.IsEven);
+ if (request.LessonTypeIds != null && request.LessonTypeIds.Length != 0)
+ query = query.Where(l => l.LessonAssociations!.Any(la => request.LessonTypeIds.Contains(la.TypeOfOccupationId)));
+
if (request.GroupIds != null && request.GroupIds.Length != 0)
query = query.Where(l => request.GroupIds.Contains(l.GroupId));