feat(cv-search-data): add JobProviders table to cvSearch schema
New JobProviderEntity persists provider config (name, URL template, link filter, initial keywords, max results, display order) in the DB instead of appsettings. Migration seeds three disabled defaults: ejobs.ro, bestjobs.eu, and linkedin.com. Closes #35 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ public sealed class CvSearchDbContext : DbContext
|
||||
public DbSet<JobSearchTokenEntity> JobSearchTokens => Set<JobSearchTokenEntity>();
|
||||
public DbSet<JobSearchSessionEntity> JobSearchSessions => Set<JobSearchSessionEntity>();
|
||||
public DbSet<JobSearchResultEntity> JobSearchResults => Set<JobSearchResultEntity>();
|
||||
public DbSet<JobProviderEntity> JobProviders => Set<JobProviderEntity>();
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -65,5 +66,18 @@ public sealed class CvSearchDbContext : DbContext
|
||||
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
||||
entity.HasIndex(x => x.SessionId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<JobProviderEntity>(entity =>
|
||||
{
|
||||
entity.ToTable("JobProviders");
|
||||
entity.HasKey(x => x.Id);
|
||||
entity.Property(x => x.Id).UseIdentityColumn();
|
||||
entity.Property(x => x.Name).HasMaxLength(128).IsRequired();
|
||||
entity.Property(x => x.SearchUrlTemplate).HasMaxLength(1024).IsRequired();
|
||||
entity.Property(x => x.JobLinkContains).HasMaxLength(256).IsRequired();
|
||||
entity.Property(x => x.InitialKeywordsJson).HasMaxLength(2000).HasDefaultValue("[]").IsRequired();
|
||||
entity.Property(x => x.MaxResults).HasDefaultValue(20);
|
||||
entity.Property(x => x.DisplayOrder).HasDefaultValue(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace CvSearch.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Persisted job-board provider configuration. Stored in <c>cvSearch.JobProviders</c>.
|
||||
/// Providers are loaded from here at session-creation time and snapshotted into
|
||||
/// <c>JobSearchSessionEntity.ProviderConfigJson</c> so runtime config changes do not
|
||||
/// affect already-queued sessions.
|
||||
/// </summary>
|
||||
public sealed class JobProviderEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>Display name (e.g. "ejobs.ro").</summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>When false the provider is skipped at session-creation and the job-search link is hidden.</summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>URL template with <c>{keywords}</c> placeholder (URL-encoded keywords are substituted at runtime).</summary>
|
||||
public string SearchUrlTemplate { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Substring that must appear in an anchor href to pass the stage-1 link filter.</summary>
|
||||
public string JobLinkContains { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>JSON array of baseline keywords merged with CV keywords before building the search URL.</summary>
|
||||
public string InitialKeywordsJson { get; set; } = "[]";
|
||||
|
||||
/// <summary>Maximum number of job URLs to collect from this provider per session.</summary>
|
||||
public int MaxResults { get; set; } = 20;
|
||||
|
||||
/// <summary>Controls display ordering in future admin UIs.</summary>
|
||||
public int DisplayOrder { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user