feat/Update_Controllers_to_Allow_for_Premium_Membership
This commit is contained in:
@@ -59,11 +59,31 @@ namespace JobTrackerApi.Data
|
||||
public DbSet<ApplicationChecklistItem> ApplicationChecklistItems => Set<ApplicationChecklistItem>();
|
||||
public DbSet<CoverLetterVersion> CoverLetterVersions => Set<CoverLetterVersion>();
|
||||
public DbSet<InterviewPrepItem> InterviewPrepItems => Set<InterviewPrepItem>();
|
||||
public DbSet<UserOperation> UserOperations => Set<UserOperation>();
|
||||
public DbSet<UserNotification> UserNotifications => Set<UserNotification>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<ApplicationUser>()
|
||||
.Property(x => x.PendingEmail)
|
||||
.HasMaxLength(320);
|
||||
|
||||
modelBuilder.Entity<ApplicationUser>()
|
||||
.Property(x => x.MicrosoftTenantId)
|
||||
.HasMaxLength(36);
|
||||
|
||||
modelBuilder.Entity<ApplicationUser>()
|
||||
.Property(x => x.MicrosoftObjectId)
|
||||
.HasMaxLength(36);
|
||||
|
||||
// Both supported databases allow multiple NULL values in a unique index, so legacy
|
||||
// rows remain unassigned while each proven tenant/object pair has exactly one owner.
|
||||
modelBuilder.Entity<ApplicationUser>()
|
||||
.HasIndex(x => new { x.MicrosoftTenantId, x.MicrosoftObjectId })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<Company>()
|
||||
.HasQueryFilter(c => CurrentUserId != null && c.OwnerUserId == CurrentUserId);
|
||||
|
||||
@@ -198,6 +218,47 @@ namespace JobTrackerApi.Data
|
||||
.HasForeignKey(x => x.ArtifactId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
modelBuilder.Entity<UserOperation>()
|
||||
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.OwnerUserId).HasMaxLength(255);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.TaskType).HasMaxLength(64);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.IdempotencyKey).HasMaxLength(128);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.Status).HasMaxLength(32);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.EntitlementDecision).HasMaxLength(32);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.PrivacyPolicy).HasMaxLength(32);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.SubjectType).HasMaxLength(64);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.SubjectId).HasMaxLength(128);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.Provider).HasMaxLength(128);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.Model).HasMaxLength(128);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.LeaseToken).HasMaxLength(32);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.ProgressStage).HasMaxLength(64);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.FailureCategory).HasMaxLength(64);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.FailureMessage).HasMaxLength(512);
|
||||
modelBuilder.Entity<UserOperation>().Property(x => x.ResultReference).HasMaxLength(256);
|
||||
modelBuilder.Entity<UserOperation>()
|
||||
.HasIndex(x => new { x.OwnerUserId, x.TaskType, x.IdempotencyKey })
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<UserOperation>()
|
||||
.HasIndex(x => new { x.Status, x.AvailableAtUtc, x.Priority });
|
||||
|
||||
modelBuilder.Entity<UserNotification>()
|
||||
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
|
||||
modelBuilder.Entity<UserNotification>().Property(x => x.OwnerUserId).HasMaxLength(255);
|
||||
modelBuilder.Entity<UserNotification>().Property(x => x.Kind).HasMaxLength(64);
|
||||
modelBuilder.Entity<UserNotification>().Property(x => x.Title).HasMaxLength(160);
|
||||
modelBuilder.Entity<UserNotification>().Property(x => x.Message).HasMaxLength(512);
|
||||
modelBuilder.Entity<UserNotification>().Property(x => x.LinkPath).HasMaxLength(256);
|
||||
modelBuilder.Entity<UserNotification>()
|
||||
.HasIndex(x => x.OperationId)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<UserNotification>()
|
||||
.HasIndex(x => new { x.OwnerUserId, x.DismissedAtUtc, x.ReadAtUtc, x.CreatedAtUtc });
|
||||
modelBuilder.Entity<UserNotification>()
|
||||
.HasOne(x => x.Operation)
|
||||
.WithOne()
|
||||
.HasForeignKey<UserNotification>(x => x.OperationId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
modelBuilder.Entity<TailoredCvDraft>()
|
||||
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user