Добавил слой Infrastructure

This commit is contained in:
2026-04-28 15:52:19 +03:00
parent 25d617639c
commit df0e30a1ae
32 changed files with 4139 additions and 0 deletions
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using UniVerse.Domain.Entities;
namespace UniVerse.Infrastructure.Data.Configurations;
public class TeacherProfileConfiguration : IEntityTypeConfiguration<TeacherProfile>
{
public void Configure(EntityTypeBuilder<TeacherProfile> builder)
{
builder.ToTable("teacher_profiles");
builder.HasKey(t => t.Id);
builder.Property(t => t.Id).HasColumnName("id");
builder.Property(t => t.UserId).HasColumnName("user_id");
builder.Property(t => t.Department).HasColumnName("department").HasMaxLength(255);
builder.Property(t => t.Title).HasColumnName("title").HasMaxLength(255);
builder.Property(t => t.Bio).HasColumnName("bio");
builder.Property(t => t.ModeusId).HasColumnName("modeus_id").HasMaxLength(255);
builder.HasOne(t => t.User)
.WithOne(u => u.TeacherProfile)
.HasForeignKey<TeacherProfile>(t => t.UserId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(t => t.UserId).IsUnique();
}
}