diff --git a/ApiDto/Responses/Schedule/GroupScheduleResponse.cs b/ApiDto/Responses/Schedule/GroupScheduleResponse.cs index c85778c..c0a7f42 100644 --- a/ApiDto/Responses/Schedule/GroupScheduleResponse.cs +++ b/ApiDto/Responses/Schedule/GroupScheduleResponse.cs @@ -39,6 +39,29 @@ public class GroupScheduleInfo [Required] public required int DisciplineId { get; set; } + /// + /// Gets or sets exclude or include weeks for a specific discipline. + /// + /// + /// If is , then the values in show the weeks when there will be no discipline. + ///
+ /// If is , then the values in indicate the weeks during which a particular discipline will be studied. + ///
+ /// If is , then there are no specific + ///
+ /// + + public bool? IsExcludedWeeks { get; set; } + /// + /// The week numbers required for the correct display of the schedule. + ///
+ /// Whether there will be during the week or not depends on the property. + ///
+ /// + /// To get the current week's number, use other queries. + /// + public IEnumerable? Weeks { get; set; } + /// /// Gets or sets the type of occupation for the schedule entry. /// diff --git a/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs b/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs index 294876f..84adb3c 100644 --- a/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs +++ b/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs @@ -39,6 +39,29 @@ public class LectureHallScheduleInfo [Required] public required int DisciplineId { get; set; } + /// + /// Gets or sets exclude or include weeks for a specific discipline. + /// + /// + /// If is , then the values in show the weeks when there will be no discipline. + ///
+ /// If is , then the values in indicate the weeks during which a particular discipline will be studied. + ///
+ /// If is , then there are no specific + ///
+ /// + + public bool? IsExcludedWeeks { get; set; } + /// + /// The week numbers required for the correct display of the schedule. + ///
+ /// Whether there will be during the week or not depends on the property. + ///
+ /// + /// To get the current week's number, use other queries. + /// + public IEnumerable? Weeks { get; set; } + /// /// Gets or sets the type of occupation for the schedule entry. /// diff --git a/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs b/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs index 07a7471..b25711e 100644 --- a/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs +++ b/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs @@ -39,6 +39,29 @@ public class ProfessorScheduleInfo [Required] public required int DisciplineId { get; set; } + /// + /// Gets or sets exclude or include weeks for a specific discipline. + /// + /// + /// If is , then the values in show the weeks when there will be no discipline. + ///
+ /// If is , then the values in indicate the weeks during which a particular discipline will be studied. + ///
+ /// If is , then there are no specific + ///
+ /// + + public bool? IsExcludedWeeks { get; set; } + /// + /// The week numbers required for the correct display of the schedule. + ///
+ /// Whether there will be during the week or not depends on the property. + ///
+ /// + /// To get the current week's number, use other queries. + /// + public IEnumerable? Weeks { get; set; } + /// /// Gets or sets the type of occupation for the schedule entry. /// diff --git a/ApiDto/Responses/Schedule/ScheduleResponse.cs b/ApiDto/Responses/Schedule/ScheduleResponse.cs index 8698ed7..599cc3e 100644 --- a/ApiDto/Responses/Schedule/ScheduleResponse.cs +++ b/ApiDto/Responses/Schedule/ScheduleResponse.cs @@ -39,6 +39,29 @@ public class ScheduleResponse [Required] public required int DisciplineId { get; set; } + /// + /// Gets or sets exclude or include weeks for a specific discipline. + /// + /// + /// If is , then the values in show the weeks when there will be no discipline. + ///
+ /// If is , then the values in indicate the weeks during which a particular discipline will be studied. + ///
+ /// If is , then there are no specific + ///
+ /// + + public bool? IsExcludedWeeks { get; set; } + /// + /// The week numbers required for the correct display of the schedule. + ///
+ /// Whether there will be during the week or not depends on the property. + ///
+ /// + /// To get the current week's number, use other queries. + /// + public IEnumerable? Weeks { get; set; } + /// /// Gets or sets the type of occupation for the schedule entry. /// diff --git a/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs b/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs index 9c91c64..63a8a4d 100644 --- a/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs +++ b/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs @@ -11,17 +11,7 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH { public async Task Handle(GetScheduleListQuery request, CancellationToken cancellationToken) { - var query = dbContext.Lessons - .Include(l => l.LessonAssociations) - .ThenInclude(la => la.LectureHall) - .ThenInclude(lh => lh!.Campus) - .Include(l => l.LessonAssociations) - .ThenInclude(la => la.Professor) - .Include(l => l.LessonAssociations) - .ThenInclude(la => la.TypeOfOccupation) - .Include(l => l.Group) - .Include(l => l.Discipline) - .AsQueryable(); + var query = dbContext.Lessons.AsQueryable(); if (request.IsEven != null) query = query.Where(l => l.IsEven == request.IsEven); @@ -41,7 +31,17 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH l.LessonAssociations!.Any(la => la.ProfessorId != null && request.ProfessorIds.Contains(la.ProfessorId.Value))); - var data = await query.ToArrayAsync(cancellationToken); + var data = await query + .Include(lesson => lesson.Discipline!) + .Include(lesson => lesson.SpecificWeeks) + .Include(lesson => lesson.Group!) + .Include(lesson => lesson.LessonAssociations!) + .ThenInclude(lessonAssociation => lessonAssociation.TypeOfOccupation!) + .Include(lesson => lesson.LessonAssociations!) + .ThenInclude(lessonAssociation => lessonAssociation.Professor) + .Include(lesson => lesson.LessonAssociations!) + .ThenInclude(lessonAssociation => lessonAssociation.LectureHall) + .ThenInclude(lectureHall => lectureHall!.Campus).ToListAsync(cancellationToken); var result = data.Select(l => new ScheduleLookupDto() { @@ -55,6 +55,9 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH Discipline = l.Discipline!.Name, DisciplineId = l.DisciplineId, + IsExcludedWeeks = l.IsExcludedWeeks, + Weeks = l.SpecificWeeks?.Select(w => w.WeekNumber), + Group = l.Group!.Name, GroupId = l.GroupId, @@ -72,7 +75,6 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH .Where(la => la.LectureHall?.Campus != null) .Select(la => la.LectureHall?.CampusId), - Professors = l.LessonAssociations! .Where(la => !string.IsNullOrEmpty(la.Professor?.Name)) .Select(la => la.Professor?.Name), diff --git a/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs b/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs index 6e8cc1f..b7a3802 100644 --- a/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs +++ b/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs @@ -33,6 +33,16 @@ public class ScheduleLookupDto /// public required int DisciplineId { get; set; } + /// + /// Gets or sets exclude or include weeks for a specific discipline. + /// + public bool? IsExcludedWeeks { get; set; } + + /// + /// The week numbers required for the correct display of the schedule. + /// + public IEnumerable? Weeks { get; set; } + /// /// Gets or sets the name of the group. /// diff --git a/Endpoint/Controllers/V1/ScheduleController.cs b/Endpoint/Controllers/V1/ScheduleController.cs index 3e9a5ed..1500efa 100644 --- a/Endpoint/Controllers/V1/ScheduleController.cs +++ b/Endpoint/Controllers/V1/ScheduleController.cs @@ -60,6 +60,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1 IsEven = s.IsEven, Discipline = s.Discipline, DisciplineId = s.DisciplineId, + IsExcludedWeeks = s.IsExcludedWeeks, + Weeks = s.Weeks, TypeOfOccupations = s.TypeOfOccupations, Group = s.Group, GroupId = s.GroupId, @@ -117,6 +119,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1 IsEven = g.IsEven, Discipline = g.Discipline, DisciplineId = g.DisciplineId, + IsExcludedWeeks = g.IsExcludedWeeks, + Weeks = g.Weeks, TypeOfOccupations = g.TypeOfOccupations, LectureHalls = g.LectureHalls, LectureHallsId = g.LectureHallsId, @@ -176,6 +180,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1 IsEven = p.IsEven, Discipline = p.Discipline, DisciplineId = p.DisciplineId, + IsExcludedWeeks = p.IsExcludedWeeks, + Weeks = p.Weeks, TypeOfOccupations = p.TypeOfOccupations, Group = p.Group, GroupId = p.GroupId, @@ -235,6 +241,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1 IsEven = l.IsEven, Discipline = l.Discipline, DisciplineId = l.DisciplineId, + IsExcludedWeeks = l.IsExcludedWeeks, + Weeks = l.Weeks, TypeOfOccupations = l.TypeOfOccupations, Group = l.Group, GroupId = l.GroupId,