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]
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>
/// Gets or sets the type of occupation for the schedule entry.
/// </summary>

View File

@ -39,29 +39,6 @@ public class LectureHallScheduleInfo
[Required]
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>
/// Gets or sets the type of occupation for the schedule entry.
/// </summary>

View File

@ -39,29 +39,6 @@ public class ProfessorScheduleInfo
[Required]
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>
/// Gets or sets the type of occupation for the schedule entry.
/// </summary>

View File

@ -39,29 +39,6 @@ public class ScheduleResponse
[Required]
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>
/// Gets or sets the type of occupation for the schedule entry.
/// </summary>

View File

@ -11,7 +11,17 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
{
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)
query = query.Where(l => l.IsEven == request.IsEven);
@ -31,17 +41,7 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
l.LessonAssociations!.Any(la =>
la.ProfessorId != null && request.ProfessorIds.Contains(la.ProfessorId.Value)));
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 data = await query.ToArrayAsync(cancellationToken);
var result = data.Select(l => new ScheduleLookupDto()
{
@ -55,9 +55,6 @@ 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,
@ -75,6 +72,7 @@ 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),

View File

@ -33,16 +33,6 @@ public class ScheduleLookupDto
/// </summary>
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>
/// Gets or sets the name of the group.
/// </summary>

View File

@ -60,8 +60,6 @@ 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,
@ -119,8 +117,6 @@ 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,
@ -180,8 +176,6 @@ 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,
@ -241,8 +235,6 @@ 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,

View File

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