Инициализировать репозиторий «Дейл»
Первый коммит: модульный монолит ядра (.NET 10) и gRPC-сервисы ai/ml/telegram, фронтенд Vue 3/Vite/Tailwind, документация (ТЗ, инструкция пользователя, техдокументация, код-стайл), бэклог, скрипты развёртывания и архив прототипа LeadRadar.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Deal.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Deal.Infrastructure.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// EF-конфигурация пользователя: таблица users в схеме public.
|
||||
/// </summary>
|
||||
public sealed class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
{
|
||||
private const int LoginMaxLength = 200;
|
||||
|
||||
public void Configure(EntityTypeBuilder<UserEntity> builder)
|
||||
{
|
||||
builder.ToTable("users", "public");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Login).HasMaxLength(LoginMaxLength).IsRequired();
|
||||
builder.Property(x => x.PasswordHash).IsRequired();
|
||||
builder.Property(x => x.Status).IsRequired().HasDefaultValue("active");
|
||||
builder.Property(x => x.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
||||
|
||||
builder.HasIndex(x => x.Login).IsUnique();
|
||||
builder.HasIndex(x => x.TenantId);
|
||||
|
||||
builder.HasOne<TenantEntity>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.TenantId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user