Staging to Production #51
@@ -1,62 +0,0 @@
|
|||||||
using CvSearch.Models.Data.Entities;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace CvSearch.Models.Data;
|
|
||||||
|
|
||||||
public sealed class CvSearchDbContext : DbContext
|
|
||||||
{
|
|
||||||
public const string SchemaName = "cvSearch";
|
|
||||||
public const string MigrationTableName = "_Migrations";
|
|
||||||
|
|
||||||
public CvSearchDbContext(DbContextOptions<CvSearchDbContext> options) : base(options) { }
|
|
||||||
|
|
||||||
public DbSet<JobSearchTokenEntity> JobSearchTokens => Set<JobSearchTokenEntity>();
|
|
||||||
public DbSet<JobSearchSessionEntity> JobSearchSessions => Set<JobSearchSessionEntity>();
|
|
||||||
public DbSet<JobSearchResultEntity> JobSearchResults => Set<JobSearchResultEntity>();
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.HasDefaultSchema(SchemaName);
|
|
||||||
|
|
||||||
modelBuilder.Entity<JobSearchTokenEntity>(entity =>
|
|
||||||
{
|
|
||||||
entity.ToTable("JobSearchTokens");
|
|
||||||
entity.HasKey(x => x.Id);
|
|
||||||
entity.Property(x => x.Id).HasMaxLength(64);
|
|
||||||
entity.Property(x => x.CvDocumentId).HasMaxLength(64).IsRequired();
|
|
||||||
entity.Property(x => x.Email).HasMaxLength(256).IsRequired();
|
|
||||||
entity.Property(x => x.Language).HasMaxLength(8).HasDefaultValue("en").IsRequired();
|
|
||||||
entity.Property(x => x.Used).HasDefaultValue(false);
|
|
||||||
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<JobSearchSessionEntity>(entity =>
|
|
||||||
{
|
|
||||||
entity.ToTable("JobSearchSessions");
|
|
||||||
entity.HasKey(x => x.Id);
|
|
||||||
entity.Property(x => x.Id).HasMaxLength(64);
|
|
||||||
entity.Property(x => x.TokenId).HasMaxLength(64).IsRequired();
|
|
||||||
entity.Property(x => x.CvDocumentId).HasMaxLength(64).IsRequired();
|
|
||||||
entity.Property(x => x.Email).HasMaxLength(256).IsRequired();
|
|
||||||
entity.Property(x => x.Status).HasMaxLength(32).IsRequired();
|
|
||||||
entity.Property(x => x.Keywords).HasMaxLength(1000);
|
|
||||||
entity.Property(x => x.ProviderConfigJson).IsRequired(false);
|
|
||||||
entity.Property(x => x.Language).HasMaxLength(8).HasDefaultValue("en").IsRequired();
|
|
||||||
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
|
||||||
entity.HasIndex(x => x.Status);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<JobSearchResultEntity>(entity =>
|
|
||||||
{
|
|
||||||
entity.ToTable("JobSearchResults");
|
|
||||||
entity.HasKey(x => x.Id);
|
|
||||||
entity.Property(x => x.Id).HasMaxLength(64);
|
|
||||||
entity.Property(x => x.SessionId).HasMaxLength(64).IsRequired();
|
|
||||||
entity.Property(x => x.ProviderName).HasMaxLength(128);
|
|
||||||
entity.Property(x => x.JobUrl).HasMaxLength(2048);
|
|
||||||
entity.Property(x => x.JobTitle).HasMaxLength(512);
|
|
||||||
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
|
||||||
entity.HasIndex(x => x.SessionId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
namespace CvSearch.Models.Data.Entities;
|
|
||||||
|
|
||||||
public sealed class JobSearchResultEntity
|
|
||||||
{
|
|
||||||
public string Id { get; set; } = string.Empty;
|
|
||||||
public string SessionId { get; set; } = string.Empty;
|
|
||||||
public string ProviderName { get; set; } = string.Empty;
|
|
||||||
public string JobUrl { get; set; } = string.Empty;
|
|
||||||
public string JobTitle { get; set; } = string.Empty;
|
|
||||||
public string JobText { get; set; } = string.Empty;
|
|
||||||
public int Score { get; set; }
|
|
||||||
public string ResultJson { get; set; } = string.Empty;
|
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
namespace CvSearch.Models.Data.Entities;
|
|
||||||
|
|
||||||
public sealed class JobSearchSessionEntity
|
|
||||||
{
|
|
||||||
public string Id { get; set; } = string.Empty;
|
|
||||||
public string TokenId { get; set; } = string.Empty;
|
|
||||||
public string CvDocumentId { get; set; } = string.Empty;
|
|
||||||
public string Email { get; set; } = string.Empty;
|
|
||||||
public string Status { get; set; } = JobSearchStatus.Pending;
|
|
||||||
public string Keywords { get; set; } = string.Empty;
|
|
||||||
public string? ProviderConfigJson { get; set; }
|
|
||||||
public string Language { get; set; } = "en";
|
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class JobSearchStatus
|
|
||||||
{
|
|
||||||
public const string Pending = "Pending";
|
|
||||||
public const string Processing = "Processing";
|
|
||||||
public const string Done = "Done";
|
|
||||||
public const string Failed = "Failed";
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace CvSearch.Models.Data.Entities;
|
|
||||||
|
|
||||||
public sealed class JobSearchTokenEntity
|
|
||||||
{
|
|
||||||
public string Id { get; set; } = string.Empty;
|
|
||||||
public string CvDocumentId { get; set; } = string.Empty;
|
|
||||||
public string Email { get; set; } = string.Empty;
|
|
||||||
public string Language { get; set; } = "en";
|
|
||||||
public DateTime ExpiresAt { get; set; }
|
|
||||||
public bool Used { get; set; }
|
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
namespace MyAi.Models.Data.Entities;
|
|
||||||
|
|
||||||
public sealed class TemplateEntity
|
|
||||||
{
|
|
||||||
public string Key { get; set; } = string.Empty;
|
|
||||||
public string Language { get; set; } = string.Empty;
|
|
||||||
public string Value { get; set; } = string.Empty;
|
|
||||||
public string Description { get; set; } = string.Empty;
|
|
||||||
public DateTime UpdatedAt { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
using MyAi.Models.Data.Entities;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace MyAi.Models.Data;
|
|
||||||
|
|
||||||
public sealed class MyAiDbContext : DbContext
|
|
||||||
{
|
|
||||||
public const string SchemaName = "myAi";
|
|
||||||
public const string MigrationTableName = "_MyAiMigrations";
|
|
||||||
|
|
||||||
public MyAiDbContext(DbContextOptions<MyAiDbContext> options) : base(options) { }
|
|
||||||
|
|
||||||
public DbSet<TemplateEntity> Templates => Set<TemplateEntity>();
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.HasDefaultSchema(SchemaName);
|
|
||||||
|
|
||||||
modelBuilder.Entity<TemplateEntity>(entity =>
|
|
||||||
{
|
|
||||||
entity.ToTable("Templates");
|
|
||||||
entity.HasKey(x => new { x.Key, x.Language });
|
|
||||||
entity.Property(x => x.Key).HasMaxLength(128);
|
|
||||||
entity.Property(x => x.Language).HasMaxLength(8);
|
|
||||||
entity.Property(x => x.Value).IsRequired();
|
|
||||||
entity.Property(x => x.Description).HasMaxLength(500).HasDefaultValue(string.Empty);
|
|
||||||
entity.Property(x => x.UpdatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user