2026-07-26 20:45:35 +00:00
|
|
|
using Heimdall.Domain.Entities;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
|
|
|
|
|
|
public class UserNotificationConfigConfiguration : IEntityTypeConfiguration<UserNotificationConfig>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<UserNotificationConfig> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("user_notification_configs");
|
|
|
|
|
|
|
|
|
|
builder.HasKey(c => c.Id);
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.EmailAddress)
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
2026-07-27 04:56:16 +00:00
|
|
|
builder.Property(c => c.NtfyUrl)
|
2026-07-26 20:45:35 +00:00
|
|
|
.HasMaxLength(500);
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.Language)
|
|
|
|
|
.HasMaxLength(10)
|
|
|
|
|
.HasDefaultValue("fr");
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.SubscribedEventsJson)
|
|
|
|
|
.HasColumnName("subscribed_events")
|
|
|
|
|
.HasColumnType("jsonb");
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.CreatedAt)
|
|
|
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.UpdatedAt)
|
|
|
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
|
|
|
|
|
|
// Indexes
|
|
|
|
|
builder.HasIndex(c => c.UserId).IsUnique();
|
|
|
|
|
}
|
|
|
|
|
}
|