refactor: contain backend feature mappings
Some checks failed
Backend CI/CD / build_and_deploy (push) Has been cancelled
Frontend CI/CD / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 01:14:01 -04:00
parent 121757546a
commit 20f8a14bfb
10 changed files with 308 additions and 190 deletions

View File

@@ -0,0 +1,24 @@
namespace Socialize.Modules.Comments.Data;
public static class CommentModelConfiguration
{
public static ModelBuilder ConfigureCommentsModule(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<Comment>(comment =>
{
comment.ToTable("Comments");
comment.HasKey(x => x.Id);
comment.Property(x => x.AuthorDisplayName).HasMaxLength(256).IsRequired();
comment.Property(x => x.AuthorEmail).HasMaxLength(256).IsRequired();
comment.Property(x => x.Body).HasMaxLength(4000).IsRequired();
comment.Property(x => x.CreatedAt)
.ValueGeneratedOnAdd()
.HasDefaultValueSql("CURRENT_TIMESTAMP");
comment.HasIndex(x => x.WorkspaceId);
comment.HasIndex(x => x.ContentItemId);
comment.HasIndex(x => x.ParentCommentId);
});
return modelBuilder;
}
}