From 5811d878180a85af5c41b9cb3b8f272d589539e9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 17 Dec 2020 11:21:14 +0200 Subject: Roles are now in a seperate table, user can contain multiple roles (BUT JWT doesn't support mutiple yet), added migrations, userrepository returns user roles with the user --- .../Migrations/DevHiveContextModelSnapshot.cs | 42 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'src/DevHive.Web/Migrations/DevHiveContextModelSnapshot.cs') diff --git a/src/DevHive.Web/Migrations/DevHiveContextModelSnapshot.cs b/src/DevHive.Web/Migrations/DevHiveContextModelSnapshot.cs index 0f56ba9..c1464d4 100644 --- a/src/DevHive.Web/Migrations/DevHiveContextModelSnapshot.cs +++ b/src/DevHive.Web/Migrations/DevHiveContextModelSnapshot.cs @@ -53,6 +53,9 @@ namespace DevHive.Web.Migrations b.HasKey("Id"); + b.HasIndex("Id") + .IsUnique(); + b.HasIndex("NormalizedName") .IsUnique() .HasDatabaseName("RoleNameIndex"); @@ -66,6 +69,9 @@ namespace DevHive.Web.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("Name") + .HasColumnType("text"); + b.HasKey("Id"); b.ToTable("Technologies"); @@ -92,11 +98,9 @@ namespace DevHive.Web.Migrations .HasColumnType("boolean"); b.Property("FirstName") - .IsRequired() .HasColumnType("text"); b.Property("LastName") - .IsRequired() .HasColumnType("text"); b.Property("LockoutEnabled") @@ -125,9 +129,6 @@ namespace DevHive.Web.Migrations b.Property("ProfilePicture") .HasColumnType("text"); - b.Property("Role") - .HasColumnType("text"); - b.Property("SecurityStamp") .HasColumnType("text"); @@ -135,7 +136,6 @@ namespace DevHive.Web.Migrations .HasColumnType("boolean"); b.Property("UserName") - .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); @@ -259,6 +259,21 @@ namespace DevHive.Web.Migrations b.ToTable("AspNetUserTokens"); }); + modelBuilder.Entity("RoleUser", b => + { + b.Property("RolesId") + .HasColumnType("uuid"); + + b.Property("UsersId") + .HasColumnType("uuid"); + + b.HasKey("RolesId", "UsersId"); + + b.HasIndex("UsersId"); + + b.ToTable("RoleUser"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("DevHive.Data.Models.Role", null) @@ -309,6 +324,21 @@ namespace DevHive.Web.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("RoleUser", b => + { + b.HasOne("DevHive.Data.Models.Role", null) + .WithMany() + .HasForeignKey("RolesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DevHive.Data.Models.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); #pragma warning restore 612, 618 } } -- cgit v1.2.3