Add a Persistence layer #3

Merged
Wesser merged 4 commits from feat/persistence into release/v1.0.0 2024-01-08 23:22:35 +03:00
Showing only changes of commit f9a04ee84a - Show all commits

View File

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore;
using Mirea.Api.DataAccess.Domain.Schedule;
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
namespace Mirea.Api.DataAccess.Persistence;
public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(options)
{
public DbSet<Day> Days { get; set; } = null!;
public DbSet<Group> Groups { get; set; } = null!;
public DbSet<LectureHall> LectureHalls { 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 GroupConfiguration());
modelBuilder.ApplyConfiguration(new LectureHallConfiguration());
modelBuilder.ApplyConfiguration(new LessonConfiguration());
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
modelBuilder.ApplyConfiguration(new CampusConfiguration());
modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration());
modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration());
base.OnModelCreating(modelBuilder);
}
}