using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Nuuru.Server.Models; using Nuuru.Server.Services.Search; namespace Nuuru.Server.Data.EntityConfigurations { public class UserSettingsConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasKey(s => s.UserId); builder.HasOne(s => s.User) .WithOne() .HasForeignKey(s => s.UserId) .OnDelete(DeleteBehavior.Cascade); builder.Property(s => s.Theme).HasMaxLength(10); builder.Property(s => s.DefaultSearchQuery).HasMaxLength(2000).HasDefaultValue(SearchDefaults.DefaultQuery); builder.Property(s => s.AutoWatchOwnPosts).HasDefaultValue(true); builder.Property(s => s.AutoWatchOnForumThreadCreate).HasDefaultValue(true); builder.Property(s => s.FloatingCommentEditor).HasDefaultValue(true); } } }