add group moderation and banning functionality to api (#13)

* add group moderation and banning functionality to api

* set moderator to false on group migration

* send IsModerator in addition on group join

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2022-10-06 15:50:15 +02:00
committed by GitHub
parent 6ffad7f723
commit a45a923260
12 changed files with 1297 additions and 42 deletions

View File

@@ -1,4 +1,5 @@
using MareSynchronosShared.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace MareSynchronosShared.Data;
@@ -41,6 +42,7 @@ public class MareDbContext : DbContext
public DbSet<BannedRegistrations> BannedRegistrations { get; set; }
public DbSet<Group> Groups { get; set; }
public DbSet<GroupPair> GroupPairs { get; set; }
public DbSet<GroupBan> GroupBans { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -63,5 +65,9 @@ public class MareDbContext : DbContext
modelBuilder.Entity<GroupPair>().HasKey(u => new { u.GroupGID, u.GroupUserUID });
modelBuilder.Entity<GroupPair>().HasIndex(c => c.GroupUserUID);
modelBuilder.Entity<GroupPair>().HasIndex(c => c.GroupGID);
modelBuilder.Entity<GroupBan>().ToTable("group_bans");
modelBuilder.Entity<GroupBan>().HasKey(u => new { u.GroupGID, u.BannedUserUID });
modelBuilder.Entity<GroupBan>().HasIndex(c => c.BannedUserUID);
modelBuilder.Entity<GroupBan>().HasIndex(c => c.GroupGID);
}
}