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,37 @@
namespace Socialize.Modules.Workspaces.Data;
public static class WorkspaceModelConfiguration
{
public static ModelBuilder ConfigureWorkspacesModule(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<Workspace>(workspace =>
{
workspace.ToTable("Workspaces");
workspace.HasKey(x => x.Id);
workspace.Property(x => x.Name).HasMaxLength(256).IsRequired();
workspace.Property(x => x.Slug).HasMaxLength(128).IsRequired();
workspace.Property(x => x.TimeZone).HasMaxLength(128).IsRequired();
workspace.Property(x => x.CreatedAt)
.ValueGeneratedOnAdd()
.HasDefaultValueSql("CURRENT_TIMESTAMP");
workspace.HasIndex(x => x.Slug).IsUnique();
workspace.HasIndex(x => x.OwnerUserId);
});
modelBuilder.Entity<WorkspaceInvite>(workspaceInvite =>
{
workspaceInvite.ToTable("WorkspaceInvites");
workspaceInvite.HasKey(x => x.Id);
workspaceInvite.Property(x => x.Email).HasMaxLength(256).IsRequired();
workspaceInvite.Property(x => x.Role).HasMaxLength(64).IsRequired();
workspaceInvite.Property(x => x.Status).HasMaxLength(64).IsRequired();
workspaceInvite.Property(x => x.CreatedAt)
.ValueGeneratedOnAdd()
.HasDefaultValueSql("CURRENT_TIMESTAMP");
workspaceInvite.HasIndex(x => x.WorkspaceId);
workspaceInvite.HasIndex(x => new { x.WorkspaceId, x.Email, x.Status });
});
return modelBuilder;
}
}