last ...
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xIdentityModels;
|
||||
using xIdentityModels.Models;
|
||||
using xIdentityModels.Navigations;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
|
||||
namespace xIds.DbContext
|
||||
{
|
||||
@@ -13,7 +13,10 @@ namespace xIds.DbContext
|
||||
#region Props/DbSets ...
|
||||
public DbSet<XToken> Tokens { get; set; }
|
||||
public DbSet<XDevice> Devices { get; set; }
|
||||
public DbSet<XApiKey> ApiKeys { get; set; }
|
||||
public DbSet<XProfileImage> Avatars { get; set; }
|
||||
public DbSet<XApiKeyUsage> ApiKeyUsage { get; set; }
|
||||
public DbSet<XApplication> Applications { get; set; }
|
||||
public DbSet<XBannedDevice> BannedDevices { get; set; }
|
||||
public DbSet<XFriendshipFollower> Followers { get; set; }
|
||||
public DbSet<XFriendshipFollowing> Followings { get; set; }
|
||||
@@ -52,6 +55,24 @@ namespace xIds.DbContext
|
||||
.HasForeignKey(ur => ur.UserId)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
//
|
||||
// Configure XApplication ...
|
||||
modelBuilder.Entity<XApplication>(e =>
|
||||
{
|
||||
e.HasIndex(a => a.Name).IsUnique();
|
||||
e.HasMany(a => a.ApiKeys)
|
||||
.WithOne(k => k.Application)
|
||||
.HasForeignKey(k => k.ApplicationId);
|
||||
});
|
||||
|
||||
//
|
||||
// Configure XApiKey ...
|
||||
modelBuilder.Entity<XApiKey>(e =>
|
||||
{
|
||||
e.HasIndex(k => k.KeyHash).IsUnique();
|
||||
e.HasIndex(k => k.ExpiresAt);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user