Backend login and register

This commit is contained in:
2026-02-19 13:49:01 +01:00
parent 0b6bb019b6
commit 93a78e4614
62 changed files with 11588 additions and 13 deletions

View File

@@ -0,0 +1,25 @@
using Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Infrastructure.Configuration;
public class UserRoleConfiguration : IEntityTypeConfiguration<UserRole>
{
public void Configure(EntityTypeBuilder<UserRole> builder)
{
builder.ToTable("UserRoles", "auth");
builder.HasKey(x => new { x.UserId, x.RoleId });
builder.HasOne(x => x.User)
.WithMany(x => x.UserRoles)
.HasForeignKey(x => x.UserId);
builder.HasOne(x => x.Role)
.WithMany(x => x.UserRoles)
.HasForeignKey(x => x.RoleId);
builder.HasData(
new UserRole { UserId = 1, RoleId = 1 },
new UserRole { UserId = 2, RoleId = 2 });
}
}