mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Registration rework
+ InvitesRepository + AdminsRepository + rework jwt
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using Govor.Core.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Govor.Data.Configurations;
|
||||
|
||||
public class AdminConfiguration : IEntityTypeConfiguration<Admin>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Admin> builder)
|
||||
{
|
||||
builder.HasKey(a => a.UserId);
|
||||
|
||||
builder.HasOne(a => a.User)
|
||||
.WithOne()
|
||||
.HasForeignKey<Admin>(a => a.UserId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Govor.Core.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Govor.Data.Configurations;
|
||||
|
||||
public class InvitationConfiguration : IEntityTypeConfiguration<Invitation>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Invitation> builder)
|
||||
{
|
||||
builder.HasKey(i => i.Id);
|
||||
|
||||
builder.HasMany(i => i.Users)
|
||||
.WithOne(u => u.Invite)
|
||||
.HasForeignKey(u => u.InviteId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,9 @@ public class UserConfiguration : IEntityTypeConfiguration<User>
|
||||
public void Configure(EntityTypeBuilder<User> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.HasOne(u => u.Invite)
|
||||
.WithMany(i => i.Users)
|
||||
.HasForeignKey(u => u.InviteId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user