Add canonical CV artifact pipeline
This commit is contained in:
@@ -22,6 +22,8 @@ namespace JobTrackerApi.Data
|
||||
public DbSet<UserRuleSettings> UserRuleSettings => Set<UserRuleSettings>();
|
||||
public DbSet<SystemEmailSettings> SystemEmailSettings => Set<SystemEmailSettings>();
|
||||
public DbSet<JobEvent> JobEvents => Set<JobEvent>();
|
||||
public DbSet<CvUploadArtifact> CvUploadArtifacts => Set<CvUploadArtifact>();
|
||||
public DbSet<CvExtractionRun> CvExtractionRuns => Set<CvExtractionRun>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -81,6 +83,24 @@ namespace JobTrackerApi.Data
|
||||
.WithMany(j => j.Events)
|
||||
.HasForeignKey(e => e.JobApplicationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<CvUploadArtifact>()
|
||||
.HasQueryFilter(x => CurrentUserId == null || x.OwnerUserId == CurrentUserId);
|
||||
|
||||
modelBuilder.Entity<CvUploadArtifact>()
|
||||
.HasIndex(x => new { x.OwnerUserId, x.UploadedAtUtc });
|
||||
|
||||
modelBuilder.Entity<CvExtractionRun>()
|
||||
.HasQueryFilter(x => CurrentUserId == null || x.OwnerUserId == CurrentUserId);
|
||||
|
||||
modelBuilder.Entity<CvExtractionRun>()
|
||||
.HasIndex(x => new { x.OwnerUserId, x.StartedAtUtc });
|
||||
|
||||
modelBuilder.Entity<CvExtractionRun>()
|
||||
.HasOne(x => x.Artifact)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ArtifactId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user