Compare commits
No commits in common. "97d2fae79e0f897b9aab87f3df8763a0259339f6" and "ed0143cda1bfeaa5fa481ef2ba235a798215883d" have entirely different histories.
97d2fae79e
...
ed0143cda1
@ -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; }
|
||||||
}
|
}
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,17 +16,24 @@ public class LessonConfiguration : IEntityTypeConfiguration<Lesson>
|
|||||||
builder.Property(l => l.IsEven).HasColumnType("BIT").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