mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
was added firebase nitifying
This commit is contained in:
@@ -9,7 +9,7 @@ public class FriendshipConfiguration : IEntityTypeConfiguration<Friendship>
|
||||
public void Configure(EntityTypeBuilder<Friendship> builder)
|
||||
{
|
||||
builder.HasKey(f => f.Id);
|
||||
|
||||
|
||||
builder.HasOne(f => f.Requester)
|
||||
.WithMany(u => u.SentFriendRequests)
|
||||
.HasForeignKey(f => f.RequesterId)
|
||||
|
||||
@@ -9,6 +9,9 @@ public class MessagesConfiguration : IEntityTypeConfiguration<Message>
|
||||
public void Configure(EntityTypeBuilder<Message> builder)
|
||||
{
|
||||
builder.HasKey(m => m.Id);
|
||||
|
||||
// Просто индекс, без unique
|
||||
builder.HasIndex(m => m.RecipientId);
|
||||
|
||||
builder.HasMany(m => m.Reactions)
|
||||
.WithOne(r => r.Message)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using Govor.Core.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Govor.Data.Configurations;
|
||||
|
||||
public class PrivateChatsConfiguration : IEntityTypeConfiguration<PrivateChat>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PrivateChat> builder)
|
||||
{
|
||||
builder.HasKey(us => us.Id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Govor.Core.Models.Users;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Govor.Data.Configurations;
|
||||
|
||||
public class UserPushTokenConfiguration : IEntityTypeConfiguration<UserPushToken>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserPushToken> builder)
|
||||
{
|
||||
builder.HasKey(t => t.Id);
|
||||
|
||||
builder.HasIndex(x => x.Token).IsUnique();
|
||||
builder.HasIndex(x => x.UserSessionId).IsUnique();
|
||||
builder.HasIndex(x => x.UserId).IsUnique();
|
||||
builder.HasIndex(x => new { x.UserId, x.IsActive });
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,14 @@ public class UserSessionConfiguration : IEntityTypeConfiguration<UserSession>
|
||||
{
|
||||
builder.HasKey(us => us.Id);
|
||||
|
||||
builder.HasIndex(us => us.Id)
|
||||
.IsUnique();
|
||||
|
||||
builder.HasIndex(us => us.UserId);
|
||||
|
||||
builder.HasIndex(s => s.RefreshTokenHash)
|
||||
.IsUnique();
|
||||
|
||||
builder.Property(us => us.RefreshTokenHash)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user