Compare commits

..

No commits in common. "0d3461b76956fd9be18d87e6cd889a44c04264ce" and "d8f2f51cd713c96a62b1a23ce11ab88d3f84cb60" have entirely different histories.

8 changed files with 14 additions and 126 deletions

View File

@ -39,29 +39,6 @@ public class GroupScheduleInfo
[Required] [Required]
public required int DisciplineId { get; set; } public required int DisciplineId { get; set; }
/// <summary>
/// Gets or sets exclude or include weeks for a specific discipline.
/// </summary>
/// <remarks>
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
/// <br/>
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
/// <br/>
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
/// </remarks>
///
public bool? IsExcludedWeeks { get; set; }
/// <summary>
/// The week numbers required for the correct display of the schedule.
/// <br/>
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
/// </summary>
/// <remarks>
/// To get the current week's number, use other queries.
/// </remarks>
public IEnumerable<int>? Weeks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of occupation for the schedule entry. /// Gets or sets the type of occupation for the schedule entry.
/// </summary> /// </summary>

View File

@ -39,29 +39,6 @@ public class LectureHallScheduleInfo
[Required] [Required]
public required int DisciplineId { get; set; } public required int DisciplineId { get; set; }
/// <summary>
/// Gets or sets exclude or include weeks for a specific discipline.
/// </summary>
/// <remarks>
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
/// <br/>
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
/// <br/>
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
/// </remarks>
///
public bool? IsExcludedWeeks { get; set; }
/// <summary>
/// The week numbers required for the correct display of the schedule.
/// <br/>
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
/// </summary>
/// <remarks>
/// To get the current week's number, use other queries.
/// </remarks>
public IEnumerable<int>? Weeks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of occupation for the schedule entry. /// Gets or sets the type of occupation for the schedule entry.
/// </summary> /// </summary>

View File

@ -39,29 +39,6 @@ public class ProfessorScheduleInfo
[Required] [Required]
public required int DisciplineId { get; set; } public required int DisciplineId { get; set; }
/// <summary>
/// Gets or sets exclude or include weeks for a specific discipline.
/// </summary>
/// <remarks>
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
/// <br/>
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
/// <br/>
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
/// </remarks>
///
public bool? IsExcludedWeeks { get; set; }
/// <summary>
/// The week numbers required for the correct display of the schedule.
/// <br/>
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
/// </summary>
/// <remarks>
/// To get the current week's number, use other queries.
/// </remarks>
public IEnumerable<int>? Weeks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of occupation for the schedule entry. /// Gets or sets the type of occupation for the schedule entry.
/// </summary> /// </summary>

View File

@ -39,29 +39,6 @@ public class ScheduleResponse
[Required] [Required]
public required int DisciplineId { get; set; } public required int DisciplineId { get; set; }
/// <summary>
/// Gets or sets exclude or include weeks for a specific discipline.
/// </summary>
/// <remarks>
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
/// <br/>
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
/// <br/>
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
/// </remarks>
///
public bool? IsExcludedWeeks { get; set; }
/// <summary>
/// The week numbers required for the correct display of the schedule.
/// <br/>
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
/// </summary>
/// <remarks>
/// To get the current week's number, use other queries.
/// </remarks>
public IEnumerable<int>? Weeks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of occupation for the schedule entry. /// Gets or sets the type of occupation for the schedule entry.
/// </summary> /// </summary>

View File

@ -11,7 +11,17 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
{ {
public async Task<ScheduleListVm> Handle(GetScheduleListQuery request, CancellationToken cancellationToken) public async Task<ScheduleListVm> Handle(GetScheduleListQuery request, CancellationToken cancellationToken)
{ {
var query = dbContext.Lessons.AsQueryable(); 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();
if (request.IsEven != null) if (request.IsEven != null)
query = query.Where(l => l.IsEven == request.IsEven); query = query.Where(l => l.IsEven == request.IsEven);
@ -31,17 +41,7 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
l.LessonAssociations!.Any(la => l.LessonAssociations!.Any(la =>
la.ProfessorId != null && request.ProfessorIds.Contains(la.ProfessorId.Value))); la.ProfessorId != null && request.ProfessorIds.Contains(la.ProfessorId.Value)));
var data = await query var data = await query.ToArrayAsync(cancellationToken);
.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() var result = data.Select(l => new ScheduleLookupDto()
{ {
@ -55,9 +55,6 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
Discipline = l.Discipline!.Name, Discipline = l.Discipline!.Name,
DisciplineId = l.DisciplineId, DisciplineId = l.DisciplineId,
IsExcludedWeeks = l.IsExcludedWeeks,
Weeks = l.SpecificWeeks?.Select(w => w.WeekNumber),
Group = l.Group!.Name, Group = l.Group!.Name,
GroupId = l.GroupId, GroupId = l.GroupId,
@ -75,6 +72,7 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
.Where(la => la.LectureHall?.Campus != null) .Where(la => la.LectureHall?.Campus != null)
.Select(la => la.LectureHall?.CampusId), .Select(la => la.LectureHall?.CampusId),
Professors = l.LessonAssociations! Professors = l.LessonAssociations!
.Where(la => !string.IsNullOrEmpty(la.Professor?.Name)) .Where(la => !string.IsNullOrEmpty(la.Professor?.Name))
.Select(la => la.Professor?.Name), .Select(la => la.Professor?.Name),

View File

@ -33,16 +33,6 @@ public class ScheduleLookupDto
/// </summary> /// </summary>
public required int DisciplineId { get; set; } public required int DisciplineId { get; set; }
/// <summary>
/// Gets or sets exclude or include weeks for a specific discipline.
/// </summary>
public bool? IsExcludedWeeks { get; set; }
/// <summary>
/// The week numbers required for the correct display of the schedule.
/// </summary>
public IEnumerable<int>? Weeks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name of the group. /// Gets or sets the name of the group.
/// </summary> /// </summary>

View File

@ -60,8 +60,6 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
IsEven = s.IsEven, IsEven = s.IsEven,
Discipline = s.Discipline, Discipline = s.Discipline,
DisciplineId = s.DisciplineId, DisciplineId = s.DisciplineId,
IsExcludedWeeks = s.IsExcludedWeeks,
Weeks = s.Weeks,
TypeOfOccupations = s.TypeOfOccupations, TypeOfOccupations = s.TypeOfOccupations,
Group = s.Group, Group = s.Group,
GroupId = s.GroupId, GroupId = s.GroupId,
@ -119,8 +117,6 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
IsEven = g.IsEven, IsEven = g.IsEven,
Discipline = g.Discipline, Discipline = g.Discipline,
DisciplineId = g.DisciplineId, DisciplineId = g.DisciplineId,
IsExcludedWeeks = g.IsExcludedWeeks,
Weeks = g.Weeks,
TypeOfOccupations = g.TypeOfOccupations, TypeOfOccupations = g.TypeOfOccupations,
LectureHalls = g.LectureHalls, LectureHalls = g.LectureHalls,
LectureHallsId = g.LectureHallsId, LectureHallsId = g.LectureHallsId,
@ -180,8 +176,6 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
IsEven = p.IsEven, IsEven = p.IsEven,
Discipline = p.Discipline, Discipline = p.Discipline,
DisciplineId = p.DisciplineId, DisciplineId = p.DisciplineId,
IsExcludedWeeks = p.IsExcludedWeeks,
Weeks = p.Weeks,
TypeOfOccupations = p.TypeOfOccupations, TypeOfOccupations = p.TypeOfOccupations,
Group = p.Group, Group = p.Group,
GroupId = p.GroupId, GroupId = p.GroupId,
@ -241,8 +235,6 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
IsEven = l.IsEven, IsEven = l.IsEven,
Discipline = l.Discipline, Discipline = l.Discipline,
DisciplineId = l.DisciplineId, DisciplineId = l.DisciplineId,
IsExcludedWeeks = l.IsExcludedWeeks,
Weeks = l.Weeks,
TypeOfOccupations = l.TypeOfOccupations, TypeOfOccupations = l.TypeOfOccupations,
Group = l.Group, Group = l.Group,
GroupId = l.GroupId, GroupId = l.GroupId,

View File

@ -13,7 +13,7 @@ public class LessonConfiguration : IEntityTypeConfiguration<Lesson>
builder.HasIndex(l => l.Id).IsUnique(); builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd(); builder.Property(l => l.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.IsEven).HasColumnType("BOOLEAN").IsRequired(); builder.Property(l => l.IsEven).HasColumnType("BIT").IsRequired();
builder.Property(l => l.DayOfWeek).HasColumnType("INTEGER").IsRequired(); builder.Property(l => l.DayOfWeek).HasColumnType("INTEGER").IsRequired();
builder.Property(l => l.PairNumber).HasColumnType("INTEGER").IsRequired(); builder.Property(l => l.PairNumber).HasColumnType("INTEGER").IsRequired();
builder.Property(l => l.IsExcludedWeeks).HasColumnType("BOOLEAN"); builder.Property(l => l.IsExcludedWeeks).HasColumnType("BOOLEAN");