feat(roles, visibility): refactor user roles to use flags and introduce visibility enum

This commit is contained in:
2026-03-10 03:21:13 -04:00
parent 0564d55396
commit 44d7ae8cd3
31 changed files with 732 additions and 175 deletions
@@ -15,9 +15,9 @@ namespace SharpbinV3.Server.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.HasAnnotation("ProductVersion", "10.0.3");
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.ApiKey", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.ApiKey", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
@@ -47,7 +47,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("ApiKeys");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.EmailVerificationToken", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.EmailVerificationToken", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
@@ -79,7 +79,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("EmailVerificationTokens");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.Paste", b =>
{
b.Property<int>("PID")
.ValueGeneratedOnAdd()
@@ -154,7 +154,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("Pastes");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.PasteView", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@@ -179,7 +179,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("PasteViews");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.RefreshToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -225,7 +225,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.Report", b =>
{
b.Property<int>("ReportID")
.ValueGeneratedOnAdd()
@@ -275,7 +275,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.User", b =>
{
b.Property<Guid>("UUID")
.ValueGeneratedOnAdd()
@@ -293,6 +293,9 @@ namespace SharpbinV3.Server.Migrations
b.Property<bool>("EmailVerified")
.HasColumnType("INTEGER");
b.Property<bool>("IsBanned")
.HasColumnType("INTEGER");
b.Property<long?>("LastLogin")
.HasColumnType("INTEGER");
@@ -300,9 +303,8 @@ namespace SharpbinV3.Server.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.PrimitiveCollection<string>("Roles")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Roles")
.HasColumnType("INTEGER");
b.Property<int?>("UID")
.HasColumnType("INTEGER");
@@ -324,7 +326,7 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.UserTotp", b =>
{
b.Property<Guid>("UserUUID")
.HasColumnType("TEXT");
@@ -341,9 +343,9 @@ namespace SharpbinV3.Server.Migrations
b.ToTable("UserTotps");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.ApiKey", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.ApiKey", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithMany("ApiKeys")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
@@ -352,9 +354,9 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.EmailVerificationToken", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.EmailVerificationToken", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithMany("EmailVerificationTokens")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
@@ -363,9 +365,9 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.Paste", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithMany("Pastes")
.HasForeignKey("AuthorUUID")
.OnDelete(DeleteBehavior.Cascade);
@@ -373,9 +375,9 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.PasteView", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.PasteView", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
b.HasOne("SharpbinV3.Server.Data.Enums.Paste", "Paste")
.WithMany("PasteViews")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.Cascade)
@@ -384,9 +386,9 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("Paste");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.RefreshToken", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.RefreshToken", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithMany("RefreshTokens")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.Cascade)
@@ -395,14 +397,14 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Report", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.Report", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.Paste", "Paste")
b.HasOne("SharpbinV3.Server.Data.Enums.Paste", "Paste")
.WithMany("Reports")
.HasForeignKey("PastePID")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithMany("Reports")
.HasForeignKey("UserUUID")
.OnDelete(DeleteBehavior.SetNull);
@@ -412,25 +414,25 @@ namespace SharpbinV3.Server.Migrations
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.UserTotp", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.UserTotp", b =>
{
b.HasOne("SharpbinV3.Server.Data.Entities.User", "User")
b.HasOne("SharpbinV3.Server.Data.Enums.User", "User")
.WithOne("Totp")
.HasForeignKey("SharpbinV3.Server.Data.Entities.UserTotp", "UserUUID")
.HasForeignKey("SharpbinV3.Server.Data.Enums.UserTotp", "UserUUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.Paste", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.Paste", b =>
{
b.Navigation("PasteViews");
b.Navigation("Reports");
});
modelBuilder.Entity("SharpbinV3.Server.Data.Entities.User", b =>
modelBuilder.Entity("SharpbinV3.Server.Data.Enums.User", b =>
{
b.Navigation("ApiKeys");