Compare commits
No commits in common. "6716ee9cf09bfc807116f1cd759feeaba56b8394" and "ed0143cda1bfeaa5fa481ef2ba235a798215883d" have entirely different histories.
6716ee9cf0
...
ed0143cda1
@ -31,7 +31,7 @@ public class DisciplineScheduleInfo
|
|||||||
/// Gets or sets the type of occupation for the schedule entry.
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public required IEnumerable<string> TypeOfOccupation { get; set; }
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the names of the group for the schedule entry.
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
@ -39,34 +39,11 @@ 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>
|
||||||
[Required]
|
[Required]
|
||||||
public required IEnumerable<string> TypeOfOccupations { get; set; }
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the names of the lecture halls for the schedule entry.
|
/// Gets or sets the names of the lecture halls for the schedule entry.
|
||||||
|
@ -39,34 +39,11 @@ 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>
|
||||||
[Required]
|
[Required]
|
||||||
public required IEnumerable<string> TypeOfOccupations { get; set; }
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the names of the group for the schedule entry.
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
@ -39,34 +39,11 @@ 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>
|
||||||
[Required]
|
[Required]
|
||||||
public required IEnumerable<string> TypeOfOccupations { get; set; }
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the names of the group for the schedule entry.
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
@ -39,34 +39,11 @@ 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>
|
||||||
[Required]
|
[Required]
|
||||||
public required IEnumerable<string> TypeOfOccupations { get; set; }
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the group for the schedule entry.
|
/// Gets or sets the name of the group for the schedule entry.
|
||||||
|
@ -11,7 +11,15 @@ 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.Group)
|
||||||
|
.Include(l => l.TypeOfOccupation)
|
||||||
|
.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,33 +39,18 @@ 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()
|
||||||
{
|
{
|
||||||
DayOfWeek = l.DayOfWeek,
|
DayOfWeek = l.DayOfWeek,
|
||||||
PairNumber = l.PairNumber,
|
PairNumber = l.PairNumber,
|
||||||
IsEven = l.IsEven,
|
IsEven = l.IsEven,
|
||||||
TypeOfOccupations = l.LessonAssociations!
|
TypeOfOccupation = l.TypeOfOccupation!.ShortName,
|
||||||
.Where(la => !string.IsNullOrEmpty(la.TypeOfOccupation?.ShortName))
|
|
||||||
.Select(la => la.TypeOfOccupation!.ShortName),
|
|
||||||
|
|
||||||
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 +68,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),
|
||||||
|
@ -34,14 +34,9 @@ public class ScheduleLookupDto
|
|||||||
public required int DisciplineId { get; set; }
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
/// Gets or sets the type of occupation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IsExcludedWeeks { get; set; }
|
public required string TypeOfOccupation { 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.
|
||||||
@ -53,11 +48,6 @@ public class ScheduleLookupDto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public required int GroupId { get; set; }
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the type of occupation.
|
|
||||||
/// </summary>
|
|
||||||
public required IEnumerable<string> TypeOfOccupations { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the names of the lecture halls.
|
/// Gets or sets the names of the lecture halls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
|
||||||
|
|
||||||
namespace Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
|
||||||
|
|
||||||
public interface ISpecificWeekDbContext : IDbContextBase
|
|
||||||
{
|
|
||||||
DbSet<SpecificWeek> SpecificWeeks { get; set; }
|
|
||||||
}
|
|
@ -9,13 +9,13 @@ public class Lesson
|
|||||||
public bool IsEven { get; set; }
|
public bool IsEven { get; set; }
|
||||||
public DayOfWeek DayOfWeek { get; set; }
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
public int PairNumber { get; set; }
|
public int PairNumber { get; set; }
|
||||||
public bool? IsExcludedWeeks { get; set; }
|
|
||||||
|
|
||||||
public int GroupId { get; set; }
|
public int GroupId { get; set; }
|
||||||
public Group? Group { get; set; }
|
public Group? Group { get; set; }
|
||||||
|
public int TypeOfOccupationId { get; set; }
|
||||||
|
public TypeOfOccupation? TypeOfOccupation { get; set; }
|
||||||
public int DisciplineId { get; set; }
|
public int DisciplineId { get; set; }
|
||||||
public Discipline? Discipline { get; set; }
|
public Discipline? Discipline { get; set; }
|
||||||
|
|
||||||
public List<LessonAssociation>? LessonAssociations { get; set; }
|
public List<LessonAssociation>? LessonAssociations { get; set; }
|
||||||
public List<SpecificWeek>? SpecificWeeks { get; set; }
|
|
||||||
}
|
}
|
@ -5,8 +5,6 @@ public class LessonAssociation
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? LinkToMeet { get; set; }
|
public string? LinkToMeet { get; set; }
|
||||||
|
|
||||||
public int TypeOfOccupationId { get; set; }
|
|
||||||
public TypeOfOccupation? TypeOfOccupation { get; set; }
|
|
||||||
public int LessonId { get; set; }
|
public int LessonId { get; set; }
|
||||||
public Lesson? Lesson { get; set; }
|
public Lesson? Lesson { get; set; }
|
||||||
public int? ProfessorId { get; set; }
|
public int? ProfessorId { get; set; }
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
namespace Mirea.Api.DataAccess.Domain.Schedule;
|
|
||||||
|
|
||||||
public class SpecificWeek
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int WeekNumber { get; set; }
|
|
||||||
|
|
||||||
public int LessonId { get; set; }
|
|
||||||
public Lesson? Lesson { get; set; }
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ public class TypeOfOccupation
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public required string ShortName { get; set; }
|
public required string ShortName { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
|
||||||
public List<LessonAssociation>? Lessons { get; set; }
|
public List<Lesson>? Lessons { get; set; }
|
||||||
}
|
}
|
@ -27,10 +27,10 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
|||||||
public async Task<ActionResult<List<ScheduleResponse>>> Get([FromBody] ScheduleRequest request)
|
public async Task<ActionResult<List<ScheduleResponse>>> Get([FromBody] ScheduleRequest request)
|
||||||
|
|
||||||
{
|
{
|
||||||
if ((request.Groups == null || request.Groups.Length == 0) &&
|
if ((request.Groups == null || !request.Groups.Any()) &&
|
||||||
(request.Disciplines == null || request.Disciplines.Length == 0) &&
|
(request.Disciplines == null || !request.Disciplines.Any()) &&
|
||||||
(request.Professors == null || request.Professors.Length == 0) &&
|
(request.Professors == null || !request.Professors.Any()) &&
|
||||||
(request.LectureHalls == null || request.LectureHalls.Length == 0))
|
(request.LectureHalls == null || !request.LectureHalls.Any()))
|
||||||
{
|
{
|
||||||
return BadRequest(new ErrorResponse()
|
return BadRequest(new ErrorResponse()
|
||||||
{
|
{
|
||||||
@ -60,9 +60,7 @@ 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,
|
TypeOfOccupation = s.TypeOfOccupation,
|
||||||
Weeks = s.Weeks,
|
|
||||||
TypeOfOccupations = s.TypeOfOccupations,
|
|
||||||
Group = s.Group,
|
Group = s.Group,
|
||||||
GroupId = s.GroupId,
|
GroupId = s.GroupId,
|
||||||
LectureHalls = s.LectureHalls,
|
LectureHalls = s.LectureHalls,
|
||||||
@ -119,9 +117,7 @@ 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,
|
TypeOfOccupation = g.TypeOfOccupation,
|
||||||
Weeks = g.Weeks,
|
|
||||||
TypeOfOccupations = g.TypeOfOccupations,
|
|
||||||
LectureHalls = g.LectureHalls,
|
LectureHalls = g.LectureHalls,
|
||||||
LectureHallsId = g.LectureHallsId,
|
LectureHallsId = g.LectureHallsId,
|
||||||
Professors = g.Professors,
|
Professors = g.Professors,
|
||||||
@ -180,9 +176,7 @@ 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,
|
TypeOfOccupation = p.TypeOfOccupation,
|
||||||
Weeks = p.Weeks,
|
|
||||||
TypeOfOccupations = p.TypeOfOccupations,
|
|
||||||
Group = p.Group,
|
Group = p.Group,
|
||||||
GroupId = p.GroupId,
|
GroupId = p.GroupId,
|
||||||
LectureHalls = p.LectureHalls,
|
LectureHalls = p.LectureHalls,
|
||||||
@ -241,9 +235,7 @@ 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,
|
TypeOfOccupation = l.TypeOfOccupation,
|
||||||
Weeks = l.Weeks,
|
|
||||||
TypeOfOccupations = l.TypeOfOccupations,
|
|
||||||
Group = l.Group,
|
Group = l.Group,
|
||||||
GroupId = l.GroupId,
|
GroupId = l.GroupId,
|
||||||
Professors = l.Professors,
|
Professors = l.Professors,
|
||||||
@ -281,7 +273,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
|||||||
IsEven = isEven,
|
IsEven = isEven,
|
||||||
DisciplineIds = [id],
|
DisciplineIds = [id],
|
||||||
GroupIds = groups,
|
GroupIds = groups,
|
||||||
LectureHallIds = lectureHalls,
|
LectureHallIds = [id],
|
||||||
ProfessorIds = professors
|
ProfessorIds = professors
|
||||||
})).Schedules;
|
})).Schedules;
|
||||||
|
|
||||||
@ -296,7 +288,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
|||||||
DayOfWeek = d.DayOfWeek,
|
DayOfWeek = d.DayOfWeek,
|
||||||
PairNumber = d.PairNumber,
|
PairNumber = d.PairNumber,
|
||||||
IsEven = d.IsEven,
|
IsEven = d.IsEven,
|
||||||
TypeOfOccupation = d.TypeOfOccupations,
|
TypeOfOccupation = d.TypeOfOccupation,
|
||||||
Group = d.Group,
|
Group = d.Group,
|
||||||
GroupId = d.GroupId,
|
GroupId = d.GroupId,
|
||||||
LectureHalls = d.LectureHalls,
|
LectureHalls = d.LectureHalls,
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
|
||||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
|
||||||
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
|
||||||
|
|
||||||
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
|
||||||
|
|
||||||
public class SpecificWeekDbContext(DbContextOptions<SpecificWeekDbContext> options) : DbContext(options), ISpecificWeekDbContext
|
|
||||||
{
|
|
||||||
public DbSet<SpecificWeek> SpecificWeeks { get; set; } = null!;
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.ApplyConfiguration(new SpecificWeekConfiguration());
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
@ -43,7 +43,6 @@ public static class DependencyInjection
|
|||||||
services.AddDbContext<ProfessorDbContext>(dbConfig);
|
services.AddDbContext<ProfessorDbContext>(dbConfig);
|
||||||
services.AddDbContext<LessonDbContext>(dbConfig);
|
services.AddDbContext<LessonDbContext>(dbConfig);
|
||||||
services.AddDbContext<TypeOfOccupationDbContext>(dbConfig);
|
services.AddDbContext<TypeOfOccupationDbContext>(dbConfig);
|
||||||
services.AddDbContext<SpecificWeekDbContext>(dbConfig);
|
|
||||||
|
|
||||||
services.AddDbContext<UberDbContext>(dbConfig);
|
services.AddDbContext<UberDbContext>(dbConfig);
|
||||||
}
|
}
|
||||||
@ -59,7 +58,6 @@ public static class DependencyInjection
|
|||||||
services.AddScoped<IProfessorDbContext>(provider => provider.GetService<ProfessorDbContext>()!);
|
services.AddScoped<IProfessorDbContext>(provider => provider.GetService<ProfessorDbContext>()!);
|
||||||
services.AddScoped<ILessonDbContext>(provider => provider.GetService<LessonDbContext>()!);
|
services.AddScoped<ILessonDbContext>(provider => provider.GetService<LessonDbContext>()!);
|
||||||
services.AddScoped<ITypeOfOccupationDbContext>(provider => provider.GetService<TypeOfOccupationDbContext>()!);
|
services.AddScoped<ITypeOfOccupationDbContext>(provider => provider.GetService<TypeOfOccupationDbContext>()!);
|
||||||
services.AddScoped<ISpecificWeekDbContext>(provider => provider.GetService<SpecificWeekDbContext>()!);
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ public class LessonAssociationConfiguration : IEntityTypeConfiguration<LessonAss
|
|||||||
builder.Property(l => l.LessonId).HasColumnType("INTEGER").IsRequired();
|
builder.Property(l => l.LessonId).HasColumnType("INTEGER").IsRequired();
|
||||||
builder.Property(l => l.ProfessorId).HasColumnType("INTEGER");
|
builder.Property(l => l.ProfessorId).HasColumnType("INTEGER");
|
||||||
builder.Property(l => l.LectureHallId).HasColumnType("INTEGER");
|
builder.Property(l => l.LectureHallId).HasColumnType("INTEGER");
|
||||||
builder.Property(l => l.TypeOfOccupationId).HasColumnType("INTEGER").IsRequired();
|
|
||||||
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.HasOne(l => l.Lesson)
|
.HasOne(l => l.Lesson)
|
||||||
@ -38,11 +36,5 @@ public class LessonAssociationConfiguration : IEntityTypeConfiguration<LessonAss
|
|||||||
.WithMany(l => l.LessonAssociations)
|
.WithMany(l => l.LessonAssociations)
|
||||||
.HasForeignKey(l => l.LectureHallId)
|
.HasForeignKey(l => l.LectureHallId)
|
||||||
.OnDelete(DeleteBehavior.SetNull);
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
builder
|
|
||||||
.HasOne(l => l.TypeOfOccupation)
|
|
||||||
.WithMany(t => t.Lessons)
|
|
||||||
.HasForeignKey(d => d.TypeOfOccupationId)
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,20 +13,27 @@ 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.GroupId).HasColumnType("INTEGER").IsRequired();
|
builder.Property(l => l.GroupId).HasColumnType("INTEGER").IsRequired();
|
||||||
|
builder.Property(l => l.TypeOfOccupationId).HasColumnType("INTEGER").IsRequired();
|
||||||
builder.Property(l => l.DisciplineId).HasColumnType("INTEGER").IsRequired();
|
builder.Property(l => l.DisciplineId).HasColumnType("INTEGER").IsRequired();
|
||||||
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.HasOne(l => l.Group)
|
.HasOne(l => l.Group)
|
||||||
.WithMany(g => g.Lessons)
|
.WithMany(g => g.Lessons)
|
||||||
.HasForeignKey(d => d.GroupId)
|
.HasForeignKey(d => d.GroupId)
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(l => l.TypeOfOccupation)
|
||||||
|
.WithMany(t => t.Lessons)
|
||||||
|
.HasForeignKey(d => d.TypeOfOccupationId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.HasOne(l => l.Discipline)
|
.HasOne(l => l.Discipline)
|
||||||
.WithMany(d => d.Lessons)
|
.WithMany(d => d.Lessons)
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
|
||||||
|
|
||||||
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
|
||||||
|
|
||||||
public class SpecificWeekConfiguration : IEntityTypeConfiguration<SpecificWeek>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<SpecificWeek> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable(nameof(SpecificWeek));
|
|
||||||
builder.HasKey(s => s.Id);
|
|
||||||
builder.HasIndex(s => s.Id).IsUnique();
|
|
||||||
builder.Property(s => s.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
builder.Property(s => s.WeekNumber).HasColumnType("INTEGER").IsRequired();
|
|
||||||
|
|
||||||
builder.Property(s => s.LessonId).HasColumnType("INTEGER").IsRequired();
|
|
||||||
|
|
||||||
builder
|
|
||||||
.HasOne(s => s.Lesson)
|
|
||||||
.WithMany(l => l.SpecificWeeks)
|
|
||||||
.HasForeignKey(s => s.LessonId)
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,5 +14,6 @@ public class TypeOfOccupationConfiguration : IEntityTypeConfiguration<TypeOfOccu
|
|||||||
builder.Property(t => t.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
|
builder.Property(t => t.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
|
||||||
|
|
||||||
builder.Property(t => t.ShortName).HasColumnType("TEXT").IsRequired().HasMaxLength(16);
|
builder.Property(t => t.ShortName).HasColumnType("TEXT").IsRequired().HasMaxLength(16);
|
||||||
|
builder.Property(t => t.FullName).HasColumnType("TEXT").HasMaxLength(64);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,6 @@ public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(
|
|||||||
public DbSet<Lesson> Lessons { get; set; } = null!;
|
public DbSet<Lesson> Lessons { get; set; } = null!;
|
||||||
public DbSet<Professor> Professors { get; set; } = null!;
|
public DbSet<Professor> Professors { get; set; } = null!;
|
||||||
public DbSet<TypeOfOccupation> TypeOfOccupations { get; set; } = null!;
|
public DbSet<TypeOfOccupation> TypeOfOccupations { get; set; } = null!;
|
||||||
public DbSet<SpecificWeek> SpecificWeeks { get; set; } = null!;
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -28,7 +27,6 @@ public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(
|
|||||||
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
|
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
|
||||||
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
|
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
|
||||||
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
|
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
|
||||||
modelBuilder.ApplyConfiguration(new SpecificWeekConfiguration());
|
|
||||||
|
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user