Add PairingCode entity + migration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using backend.Auth;
|
||||
using backend.Devices;
|
||||
using backend.Pairing;
|
||||
using backend.Settings;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
@@ -13,6 +14,7 @@ public class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
public DbSet<Device> Devices => Set<Device>();
|
||||
public DbSet<DeviceConfig> DeviceConfigs => Set<DeviceConfig>();
|
||||
public DbSet<SystemSettings> SystemSettings => Set<SystemSettings>();
|
||||
public DbSet<PairingCode> PairingCodes => Set<PairingCode>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder b)
|
||||
{
|
||||
@@ -32,5 +34,7 @@ public class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
b.Entity<DeviceConfig>().HasKey(c => c.DeviceId);
|
||||
b.Entity<SystemSettings>().HasKey(s => s.Id);
|
||||
b.Entity<SystemSettings>().Property(s => s.Id).ValueGeneratedNever();
|
||||
b.Entity<PairingCode>().HasKey(p => p.Code);
|
||||
b.Entity<PairingCode>().HasIndex(p => p.ExpiresAt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user