| 123456789101112131415161718192021222324 |
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Notifications;
- public class NotificationConfiguration : IEntityTypeConfiguration<Domain.Entities.Notifications.Notification>
- {
- public void Configure(EntityTypeBuilder<Domain.Entities.Notifications.Notification> builder)
- {
- builder.ToTable(nameof(Notification), x => x.HasComment("알림"));
- builder.HasKey(x => x.ID);
- builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.Cascade);
- builder.HasIndex(x => new { x.MemberID, x.IsRead, x.CreatedAt }).IsDescending(false, false, true);
- builder.HasIndex(x => new { x.MemberID, x.Type, x.CreatedAt }).IsDescending(false, false, true);
- builder.Property(x => x.Title).HasMaxLength(200).IsRequired();
- builder.Property(x => x.Message).HasMaxLength(500).IsRequired();
- builder.Property(x => x.ActionUrl).HasMaxLength(500);
- builder.Property(x => x.RelatedType).HasMaxLength(50);
- builder.Property(x => x.ImageUrl).HasMaxLength(500);
- }
- }
|