Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using MemeVault.Domain.Aggregates.BotUser;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace MemeVault.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public sealed class BotUserConfiguration : IEntityTypeConfiguration<BotUser>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BotUser> builder)
|
||||
{
|
||||
builder.ToTable("bot_users");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Id).HasColumnName("id");
|
||||
|
||||
builder.Property(x => x.TelegramId)
|
||||
.HasColumnName("telegram_id")
|
||||
.IsRequired();
|
||||
|
||||
builder.HasIndex(x => x.TelegramId)
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_bot_users_telegram_id");
|
||||
|
||||
builder.Property(x => x.Username)
|
||||
.HasColumnName("username")
|
||||
.HasMaxLength(64)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.FirstName)
|
||||
.HasColumnName("first_name")
|
||||
.HasMaxLength(64);
|
||||
|
||||
builder.Property(x => x.CreatedAt).HasColumnName("created_at");
|
||||
builder.Property(x => x.LastSeenAt).HasColumnName("last_seen_at");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user