Добавил слой 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,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using UniVerse.Domain.Entities;
namespace UniVerse.Infrastructure.Data.Configurations;
public class CourseConfiguration : IEntityTypeConfiguration<Course>
{
public void Configure(EntityTypeBuilder<Course> builder)
{
builder.ToTable("courses");
builder.HasKey(c => c.Id);
builder.Property(c => c.Id).HasColumnName("id");
builder.Property(c => c.Name).HasColumnName("name").HasMaxLength(500).IsRequired();
builder.Property(c => c.Description).HasColumnName("description");
builder.Property(c => c.ExternalId).HasColumnName("external_id").HasMaxLength(255);
builder.Property(c => c.IsSynced).HasColumnName("is_synced").HasDefaultValue(false);
builder.Property(c => c.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("NOW()");
builder.Property(c => c.UpdatedAt).HasColumnName("updated_at").HasDefaultValueSql("NOW()");
builder.HasIndex(c => c.ExternalId).IsUnique().HasFilter("external_id IS NOT NULL");
}
}