Fix role fuckup

This commit is contained in:
Fergal Moran
2024-03-22 20:07:29 +00:00
parent 8da0d43f23
commit 4cfa7d5385
13 changed files with 230 additions and 262 deletions

View File

@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace TvNoms.Core.Entities;
public interface IEntity {
public Guid Id { get; }
Guid Id { get; }
}
public class BaseEntity : IEntity {

View File

@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Identity;
namespace TvNoms.Core.Entities;
public class Role : IdentityRole<Guid>, IEntity {
public Role() {
}
public Role(string roleName) : base(roleName) {
}
public const string Admin = nameof(Admin);
public const string Member = nameof(Member);
public static IEnumerable<string> All => new[] { Admin, Member };
}

View File

@@ -11,7 +11,6 @@ public class User : IdentityUser<Guid>, IEntity {
public string? Location { get; set; }
public bool Active { get; set; }
public DateTimeOffset LastActiveAt { get; set; }
public virtual ICollection<UserRole> Roles { get; set; } = new List<UserRole>();
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
@@ -19,9 +18,6 @@ public class User : IdentityUser<Guid>, IEntity {
public bool PhoneNumberRequired { get; set; }
}
public class UserRole : IdentityUserRole<Guid>, IEntity {
Guid IEntity.Id { get; }
}
public class UserSession : IEntity {
public Guid Id { get; set; }
@@ -35,19 +31,3 @@ public class UserSession : IEntity {
public string RefreshTokenHash { get; set; } = default!;
public DateTimeOffset RefreshTokenExpiresAt { get; set; }
}
public class Role : IdentityRole<Guid>, IEntity {
public Role() {
}
public Role(string roleName) : base(roleName) {
}
public virtual ICollection<UserRole> Users { get; set; } = new List<UserRole>();
public const string Admin = nameof(Admin);
public const string Member = nameof(Member);
public static IEnumerable<string> All => new[] { Admin, Member };
}

View File

@@ -3,7 +3,7 @@
namespace TvNoms.Core.Models.Medias;
public class DeleteMediaForm {
public long Id { get; set; }
public Guid Id { get; set; }
}
public class DeleteMediaFormValidator : AbstractValidator<DeleteMediaForm> {

View File

@@ -4,7 +4,7 @@ using AbstractProfile = AutoMapper.Profile;
namespace TvNoms.Core.Models.Medias;
public class MediaModel {
public long Id { get; set; }
public Guid Id { get; set; }
public string Path { get; set; } = default!;

View File

@@ -16,7 +16,7 @@ public class EditUserForm {
public string? PhoneNumber { get; set; } = default!;
public long? AvatarId { get; set; }
public Guid? AvatarId { get; set; }
public string? Bio { get; set; }
}

View File

@@ -4,7 +4,7 @@ using AbstractProfile = AutoMapper.Profile;
namespace TvNoms.Core.Models.Users;
public class UserModel {
public long Id { get; set; }
public Guid Id { get; set; }
public string? UserName { get; set; }
@@ -20,7 +20,7 @@ public class UserModel {
public bool PhoneNumberRequired { get; set; }
public long? AvatarId { get; set; }
public Guid? AvatarId { get; set; }
public string? AvatarUrl { get; set; }

View File

@@ -1,4 +1,5 @@
namespace TvNoms.Core.Utilities {
namespace TvNoms.Core.Utilities;
public static class ReflectionExtensions {
public static bool IsCompatibleWith(this Type type, Type otherType) {
return otherType.IsGenericTypeDefinition
@@ -8,13 +9,15 @@
private static bool IsAssignableToGenericTypeDefinition(this Type type, Type genericType) {
foreach (var interfaceType in type.GetInterfaces()) {
if (interfaceType.IsGenericType) {
if (!interfaceType.IsGenericType) {
continue;
}
var genericTypeDefinition = interfaceType.GetGenericTypeDefinition();
if (genericTypeDefinition == genericType) {
return true;
}
}
}
if (type.IsGenericType) {
var genericTypeDefinition = type.GetGenericTypeDefinition();
@@ -24,11 +27,6 @@
}
var baseType = type.BaseType;
if (baseType is null) {
return false;
}
return baseType.IsAssignableToGenericTypeDefinition(genericType);
}
return baseType is not null && baseType.IsAssignableToGenericTypeDefinition(genericType);
}
}

View File

@@ -9,8 +9,7 @@ using TvNoms.Server.Data.Extensions;
namespace TvNoms.Server.Data;
public class AppDbContext(IConfiguration configuration) :
IdentityDbContext<User, Role, Guid, IdentityUserClaim<Guid>,
UserRole, IdentityUserLogin<Guid>, IdentityRoleClaim<Guid>, IdentityUserToken<Guid>> {
IdentityDbContext<User, IdentityRole<Guid>, Guid> {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));

View File

@@ -8,8 +8,10 @@ namespace TvNoms.Server.Data.Extensions;
public static class DbContextExtensions {
public static ModelBuilder ApplyEntities(this ModelBuilder modelBuilder, IEnumerable<Assembly> assemblies,
Func<Type, bool>? predicate = null) {
var entityTypes = assemblies.SelectMany(_ => _.DefinedTypes).Select(_ => _.AsType())
.Where(type => type.IsClass && !type.IsAbstract && !type.IsGenericType &&
var entityTypes = assemblies
.SelectMany(_ => _.DefinedTypes)
.Select(_ => _.AsType())
.Where(type => type is { IsClass: true, IsAbstract: false, IsGenericType: false } &&
type.IsCompatibleWith(typeof(IEntity)) && (predicate?.Invoke(type) ?? true));
foreach (var entityType in entityTypes) {
@@ -21,20 +23,27 @@ public static class DbContextExtensions {
public static ModelBuilder ApplyConfigurations(this ModelBuilder modelBuilder, IEnumerable<Assembly> assemblies,
Func<Type, bool>? predicate = null) {
var entityTypeConfigurationTypes = assemblies.SelectMany(_ => _.DefinedTypes).Select(_ => _.AsType())
.Where(type => type.IsClass && !type.IsAbstract && !type.IsGenericType &&
type.IsCompatibleWith(typeof(IEntityTypeConfiguration<>)) && (predicate?.Invoke(type) ?? true));
var entityTypeConfigurationTypes = assemblies
.SelectMany(_ => _.DefinedTypes)
.Select(_ => _.AsType())
.Where(type =>
type is { IsClass: true, IsAbstract: false, IsGenericType: false } &&
type.IsCompatibleWith(typeof(IEntityTypeConfiguration<>)) &&
(predicate?.Invoke(type) ?? true));
var applyEntityConfigurationMethod = typeof(ModelBuilder)
.GetMethods()
.Single(
e => e.Name == nameof(ModelBuilder.ApplyConfiguration)
&& e.ContainsGenericParameters
&& e.GetParameters().SingleOrDefault()?.ParameterType.GetGenericTypeDefinition()
== typeof(IEntityTypeConfiguration<>));
e =>
e is { Name: nameof(ModelBuilder.ApplyConfiguration), ContainsGenericParameters: true } &&
e
.GetParameters()
.SingleOrDefault()?.ParameterType
.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>));
foreach (var entityTypeConfigurationType in entityTypeConfigurationTypes) {
// Only accept types that contain a parameterless constructor, are not abstract and satisfy a predicate if it was used.
// Only accept types that contain a parameterless constructor,
// are not abstract and satisfy a predicate if it was used.
if (entityTypeConfigurationType.GetConstructor(Type.EmptyTypes) == null
|| (!predicate?.Invoke(entityTypeConfigurationType) ?? false)) {
continue;
@@ -45,10 +54,15 @@ public static class DbContextExtensions {
continue;
}
if (@interface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>)) {
var target = applyEntityConfigurationMethod.MakeGenericMethod(@interface.GenericTypeArguments[0]);
target.Invoke(modelBuilder, new[] { Activator.CreateInstance(entityTypeConfigurationType) });
if (@interface.GetGenericTypeDefinition() != typeof(IEntityTypeConfiguration<>)) {
continue;
}
var target = applyEntityConfigurationMethod
.MakeGenericMethod(@interface.GenericTypeArguments[0]);
target.Invoke(modelBuilder, [
Activator.CreateInstance(entityTypeConfigurationType)
]);
}
}

View File

@@ -12,7 +12,7 @@ using TvNoms.Server.Data;
namespace TvNoms.Server.Data.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240322193356_Initial")]
[Migration("20240322200711_Initial")]
partial class Initial
{
/// <inheritdoc />
@@ -25,6 +25,42 @@ namespace TvNoms.Server.Data.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("character varying(21)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityRole<Guid>");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
@@ -94,6 +130,21 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
@@ -141,33 +192,6 @@ namespace TvNoms.Server.Data.Migrations
b.UseTphMappingStrategy();
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
{
b.Property<Guid>("Id")
@@ -264,31 +288,6 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.Property<Guid?>("RoleId1")
.HasColumnType("uuid");
b.Property<Guid?>("UserId1")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.HasIndex("RoleId1");
b.HasIndex("UserId1");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
{
b.Property<Guid>("Id")
@@ -319,6 +318,13 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("UserSession");
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>");
b.HasDiscriminator().HasValue("Role");
});
modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
{
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
@@ -417,7 +423,7 @@ namespace TvNoms.Server.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("TvNoms.Core.Entities.Role", null)
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
@@ -442,6 +448,21 @@ namespace TvNoms.Server.Data.Migrations
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("TvNoms.Core.Entities.User", null)
@@ -460,29 +481,6 @@ namespace TvNoms.Server.Data.Migrations
b.Navigation("Avatar");
});
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
{
b.HasOne("TvNoms.Core.Entities.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.Role", null)
.WithMany("Users")
.HasForeignKey("RoleId1");
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany("Roles")
.HasForeignKey("UserId1");
});
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
{
b.HasOne("TvNoms.Core.Entities.User", "User")
@@ -503,16 +501,9 @@ namespace TvNoms.Server.Data.Migrations
b.Navigation("User");
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
{
b.Navigation("Clients");
b.Navigation("Roles");
});
#pragma warning restore 612, 618
}

View File

@@ -19,7 +19,8 @@ namespace TvNoms.Server.Data.Migrations
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
Discriminator = table.Column<string>(type: "character varying(21)", maxLength: 21, nullable: false)
},
constraints: table =>
{
@@ -81,9 +82,7 @@ namespace TvNoms.Server.Data.Migrations
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
RoleId1 = table.Column<Guid>(type: "uuid", nullable: true),
UserId1 = table.Column<Guid>(type: "uuid", nullable: true)
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
@@ -94,11 +93,6 @@ namespace TvNoms.Server.Data.Migrations
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId1",
column: x => x.RoleId1,
principalTable: "AspNetRoles",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
@@ -240,16 +234,6 @@ namespace TvNoms.Server.Data.Migrations
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId1",
table: "AspNetUserRoles",
column: "RoleId1");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_UserId1",
table: "AspNetUserRoles",
column: "UserId1");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
@@ -300,13 +284,6 @@ namespace TvNoms.Server.Data.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId1",
table: "AspNetUserRoles",
column: "UserId1",
principalTable: "AspNetUsers",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUsers_BaseEntity_AvatarId",
table: "AspNetUsers",

View File

@@ -22,6 +22,42 @@ namespace TvNoms.Server.Data.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("character varying(21)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityRole<Guid>");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
@@ -91,6 +127,21 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
@@ -138,33 +189,6 @@ namespace TvNoms.Server.Data.Migrations
b.UseTphMappingStrategy();
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
{
b.Property<Guid>("Id")
@@ -261,31 +285,6 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.Property<Guid?>("RoleId1")
.HasColumnType("uuid");
b.Property<Guid?>("UserId1")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.HasIndex("RoleId1");
b.HasIndex("UserId1");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
{
b.Property<Guid>("Id")
@@ -316,6 +315,13 @@ namespace TvNoms.Server.Data.Migrations
b.ToTable("UserSession");
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>");
b.HasDiscriminator().HasValue("Role");
});
modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
{
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
@@ -414,7 +420,7 @@ namespace TvNoms.Server.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("TvNoms.Core.Entities.Role", null)
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
@@ -439,6 +445,21 @@ namespace TvNoms.Server.Data.Migrations
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("TvNoms.Core.Entities.User", null)
@@ -457,29 +478,6 @@ namespace TvNoms.Server.Data.Migrations
b.Navigation("Avatar");
});
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
{
b.HasOne("TvNoms.Core.Entities.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.Role", null)
.WithMany("Users")
.HasForeignKey("RoleId1");
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TvNoms.Core.Entities.User", null)
.WithMany("Roles")
.HasForeignKey("UserId1");
});
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
{
b.HasOne("TvNoms.Core.Entities.User", "User")
@@ -500,16 +498,9 @@ namespace TvNoms.Server.Data.Migrations
b.Navigation("User");
});
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
{
b.Navigation("Clients");
b.Navigation("Roles");
});
#pragma warning restore 612, 618
}