Fix the sql schema #6

Merged
Wesser merged 9 commits from refactor/domain into release/v1.0.0 2024-01-26 07:48:14 +03:00
7 changed files with 18 additions and 46 deletions
Showing only changes of commit e7c05b4a68 - Show all commits

View File

@ -3,7 +3,7 @@ using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
public interface IDayDbContext : IDbContextBase
public interface IDisciplineDbContext : IDbContextBase
{
DbSet<Day> Days { get; set; }
DbSet<Discipline> Disciplines { get; set; }
}

View File

@ -3,7 +3,7 @@ using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
public interface IProfessorToLessonDbContext : IDbContextBase
public interface ILessonAssociationDbContext : IDbContextBase
{
DbSet<ProfessorToLesson> ProfessorToLessons { get; set; }
DbSet<LessonAssociation> LessonAssociations { get; set; }
}

View File

@ -1,9 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
public interface ILessonToTypeOfOccupationDbContext : IDbContextBase
{
DbSet<LessonToTypeOfOccupation> LessonToTypeOfOccupations { get; set; }
}

View File

@ -5,13 +5,13 @@ using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
public class DayDbContext(DbContextOptions<DayDbContext> options) : DbContext(options), IDayDbContext
public class DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : DbContext(options), IDisciplineDbContext
{
public DbSet<Day> Days { get; set; } = null!;
public DbSet<Discipline> Disciplines { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new DayConfiguration());
modelBuilder.ApplyConfiguration(new DisciplineConfiguration());
base.OnModelCreating(modelBuilder);
}
}

View File

@ -5,13 +5,13 @@ using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
public class ProfessorToLessonDbContext(DbContextOptions<ProfessorToLessonDbContext> options) : DbContext(options), IProfessorToLessonDbContext
public class LessonAssociationDbContext(DbContextOptions<LessonAssociationDbContext> options) : DbContext(options), ILessonAssociationDbContext
{
public DbSet<ProfessorToLesson> ProfessorToLessons { get; set; } = null!;
public DbSet<LessonAssociation> LessonAssociations { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration());
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
base.OnModelCreating(modelBuilder);
}
}

View File

@ -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 LessonToTypeOfOccupationDbContext(DbContextOptions<LessonToTypeOfOccupationDbContext> options) : DbContext(options), ILessonToTypeOfOccupationDbContext
{
public DbSet<LessonToTypeOfOccupation> LessonToTypeOfOccupations { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration());
base.OnModelCreating(modelBuilder);
}
}

View File

@ -6,29 +6,27 @@ namespace Mirea.Api.DataAccess.Persistence;
public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(options)
{
public DbSet<Day> Days { get; set; } = null!;
public DbSet<Campus> Campuses { get; set; } = null!;
public DbSet<Discipline> Disciplines { get; set; } = null!;
public DbSet<Faculty> Faculties { get; set; } = null!;
public DbSet<Group> Groups { get; set; } = null!;
public DbSet<LectureHall> LectureHalls { get; set; } = null!;
public DbSet<LessonAssociation> LessonAssociations { get; set; } = null!;
public DbSet<Lesson> Lessons { get; set; } = null!;
public DbSet<Professor> Professors { get; set; } = null!;
public DbSet<TypeOfOccupation> TypeOfOccupations { get; set; } = null!;
public DbSet<Faculty> Faculties { get; set; } = null!;
public DbSet<Campus> Campuses { get; set; } = null!;
public DbSet<ProfessorToLesson> ProfessorToLessons { get; set; } = null!;
public DbSet<LessonToTypeOfOccupation> LessonToTypeOfOccupations { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new DayConfiguration());
modelBuilder.ApplyConfiguration(new CampusConfiguration());
modelBuilder.ApplyConfiguration(new DisciplineConfiguration());
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
modelBuilder.ApplyConfiguration(new GroupConfiguration());
modelBuilder.ApplyConfiguration(new LectureHallConfiguration());
modelBuilder.ApplyConfiguration(new LessonConfiguration());
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
modelBuilder.ApplyConfiguration(new CampusConfiguration());
modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration());
modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration());
base.OnModelCreating(modelBuilder);
}