Добавил слой 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,29 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using UniVerse.Domain.Entities;
namespace UniVerse.Infrastructure.Data.Configurations;
public class StudentProfileConfiguration : IEntityTypeConfiguration<StudentProfile>
{
public void Configure(EntityTypeBuilder<StudentProfile> builder)
{
builder.ToTable("student_profiles");
builder.HasKey(s => s.Id);
builder.Property(s => s.Id).HasColumnName("id");
builder.Property(s => s.UserId).HasColumnName("user_id");
builder.Property(s => s.StudentId).HasColumnName("student_id").HasMaxLength(50);
builder.Property(s => s.GroupName).HasColumnName("group_name").HasMaxLength(100);
builder.Property(s => s.EnrollmentYear).HasColumnName("enrollment_year");
builder.Property(s => s.Faculty).HasColumnName("faculty").HasMaxLength(255);
builder.Property(s => s.Specialty).HasColumnName("specialty").HasMaxLength(255);
builder.HasOne(s => s.User)
.WithOne(u => u.StudentProfile)
.HasForeignKey<StudentProfile>(s => s.UserId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(s => s.UserId).IsUnique();
}
}