diff --git a/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs b/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs index ba08003..9c91c64 100644 --- a/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs +++ b/Application/Cqrs/Schedule/Queries/GetScheduleList/GetScheduleListQueryHandler.cs @@ -11,13 +11,15 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH { public async Task Handle(GetScheduleListQuery request, CancellationToken cancellationToken) { - var query = dbContext.Lessons.Include(l => l.LessonAssociations) + 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.TypeOfOccupation) .Include(l => l.Discipline) .AsQueryable(); @@ -46,7 +48,9 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH DayOfWeek = l.DayOfWeek, PairNumber = l.PairNumber, IsEven = l.IsEven, - TypeOfOccupation = l.TypeOfOccupation!.ShortName, + TypeOfOccupations = l.LessonAssociations! + .Where(la => !string.IsNullOrEmpty(la.TypeOfOccupation?.ShortName)) + .Select(la => la.TypeOfOccupation!.ShortName), Discipline = l.Discipline!.Name, DisciplineId = l.DisciplineId, diff --git a/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs b/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs index bd3808f..6e8cc1f 100644 --- a/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs +++ b/Application/Cqrs/Schedule/Queries/GetScheduleList/ScheduleLookupDto.cs @@ -33,11 +33,6 @@ public class ScheduleLookupDto /// public required int DisciplineId { get; set; } - /// - /// Gets or sets the type of occupation. - /// - public required string TypeOfOccupation { get; set; } - /// /// Gets or sets the name of the group. /// @@ -48,6 +43,11 @@ public class ScheduleLookupDto /// public required int GroupId { get; set; } + /// + /// Gets or sets the type of occupation. + /// + public required IEnumerable TypeOfOccupations { get; set; } + /// /// Gets or sets the names of the lecture halls. ///