Merge pull request 'Link pageFetcher.PageFetches to cvSearch.JobSearchSessions' (#50) from feature/page-fetch-session-link into main
Build and Push Docker Images Staging / build (push) Successful in 17m39s
Build and Push Docker Images Staging / build (push) Successful in 17m39s
Merge PR #50: Link pageFetcher.PageFetches to cvSearch.JobSearchSessions
This commit was merged in pull request #50.
This commit is contained in:
@@ -17,4 +17,10 @@ public sealed class FetchPageRequest
|
|||||||
/// Identifies the calling service for audit purposes (e.g. <c>cv-matcher-api</c>, <c>cv-search-job</c>).
|
/// Identifies the calling service for audit purposes (e.g. <c>cv-matcher-api</c>, <c>cv-search-job</c>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CallerService { get; set; } = string.Empty;
|
public string CallerService { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional reference to the job search session that triggered this fetch.
|
||||||
|
/// Stored on <c>pageFetcher.PageFetches</c> for cross-schema audit queries.
|
||||||
|
/// </summary>
|
||||||
|
public string? JobSearchSessionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public sealed class PageFetcherService
|
|||||||
Id = Guid.NewGuid().ToString("N"),
|
Id = Guid.NewGuid().ToString("N"),
|
||||||
Url = request.Url,
|
Url = request.Url,
|
||||||
CallerService = request.CallerService ?? string.Empty,
|
CallerService = request.CallerService ?? string.Empty,
|
||||||
|
JobSearchSessionId = request.JobSearchSessionId,
|
||||||
HttpStatusCode = statusCode,
|
HttpStatusCode = statusCode,
|
||||||
Html = html,
|
Html = html,
|
||||||
Text = text,
|
Text = text,
|
||||||
|
|||||||
@@ -31,4 +31,10 @@ public sealed class PageFetchEntity : BaseEntity
|
|||||||
|
|
||||||
/// <summary>Exception message when <see cref="Success"/> is <c>false</c>.</summary>
|
/// <summary>Exception message when <see cref="Success"/> is <c>false</c>.</summary>
|
||||||
public string? ErrorMessage { get; set; }
|
public string? ErrorMessage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional reference to the <c>cvSearch.JobSearchSessions</c> row that triggered this fetch.
|
||||||
|
/// Null for fetches not originating from a job search session (e.g. direct CV-to-job matches).
|
||||||
|
/// </summary>
|
||||||
|
public string? JobSearchSessionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using PageFetcher.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PageFetcher.Data.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(PageFetchDbContext))]
|
||||||
|
[Migration("20260608165542_AddJobSearchSessionId")]
|
||||||
|
partial class AddJobSearchSessionId
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasDefaultSchema("pageFetcher")
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("PageFetcher.Data.Entities.PageFetchEntity", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
|
b.Property<string>("CallerService")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("datetime2")
|
||||||
|
.HasDefaultValueSql("SYSUTCDATETIME()");
|
||||||
|
|
||||||
|
b.Property<long>("DurationMs")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorMessage")
|
||||||
|
.HasMaxLength(2000)
|
||||||
|
.HasColumnType("nvarchar(2000)");
|
||||||
|
|
||||||
|
b.Property<string>("Html")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("HttpStatusCode")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("JobSearchSessionId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
|
b.Property<bool>("Success")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(2000)
|
||||||
|
.HasColumnType("nvarchar(2000)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreatedAt");
|
||||||
|
|
||||||
|
b.HasIndex("JobSearchSessionId");
|
||||||
|
|
||||||
|
b.HasIndex("Url");
|
||||||
|
|
||||||
|
b.ToTable("PageFetches", "pageFetcher");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using PageFetcher.Data;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PageFetcher.Data.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddJobSearchSessionId : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "JobSearchSessionId",
|
||||||
|
schema: MigrationConstants.SchemaName,
|
||||||
|
table: "PageFetches",
|
||||||
|
type: "nvarchar(64)",
|
||||||
|
maxLength: 64,
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PageFetches_JobSearchSessionId",
|
||||||
|
schema: MigrationConstants.SchemaName,
|
||||||
|
table: "PageFetches",
|
||||||
|
column: "JobSearchSessionId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PageFetches_JobSearchSessionId",
|
||||||
|
schema: MigrationConstants.SchemaName,
|
||||||
|
table: "PageFetches");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "JobSearchSessionId",
|
||||||
|
schema: MigrationConstants.SchemaName,
|
||||||
|
table: "PageFetches");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,10 @@ namespace PageFetcher.Data.Migrations
|
|||||||
b.Property<int?>("HttpStatusCode")
|
b.Property<int?>("HttpStatusCode")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("JobSearchSessionId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
b.Property<bool>("Success")
|
b.Property<bool>("Success")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
@@ -69,6 +73,8 @@ namespace PageFetcher.Data.Migrations
|
|||||||
|
|
||||||
b.HasIndex("CreatedAt");
|
b.HasIndex("CreatedAt");
|
||||||
|
|
||||||
|
b.HasIndex("JobSearchSessionId");
|
||||||
|
|
||||||
b.HasIndex("Url");
|
b.HasIndex("Url");
|
||||||
|
|
||||||
b.ToTable("PageFetches", "pageFetcher");
|
b.ToTable("PageFetches", "pageFetcher");
|
||||||
|
|||||||
@@ -36,8 +36,11 @@ public sealed class PageFetchDbContext : DbContext
|
|||||||
entity.Property(x => x.Html).IsRequired();
|
entity.Property(x => x.Html).IsRequired();
|
||||||
entity.Property(x => x.Text).IsRequired();
|
entity.Property(x => x.Text).IsRequired();
|
||||||
entity.Property(x => x.ErrorMessage).HasMaxLength(2000);
|
entity.Property(x => x.ErrorMessage).HasMaxLength(2000);
|
||||||
|
entity.Property(x => x.JobSearchSessionId).HasMaxLength(64);
|
||||||
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
entity.Property(x => x.CreatedAt).HasDefaultValueSql("SYSUTCDATETIME()");
|
||||||
|
|
||||||
|
entity.HasIndex(x => x.JobSearchSessionId);
|
||||||
|
|
||||||
entity.HasIndex(x => x.Url);
|
entity.HasIndex(x => x.Url);
|
||||||
entity.HasIndex(x => x.CreatedAt);
|
entity.HasIndex(x => x.CreatedAt);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ public sealed class CvSearchJobTask : IJobTask
|
|||||||
{
|
{
|
||||||
Url = url,
|
Url = url,
|
||||||
WaitFor = "domcontentloaded",
|
WaitFor = "domcontentloaded",
|
||||||
CallerService = "cv-search-job"
|
CallerService = "cv-search-job",
|
||||||
|
JobSearchSessionId = session.Id
|
||||||
}, ct);
|
}, ct);
|
||||||
|
|
||||||
if (!fetchResponse.Success || string.IsNullOrWhiteSpace(fetchResponse.Text))
|
if (!fetchResponse.Success || string.IsNullOrWhiteSpace(fetchResponse.Text))
|
||||||
|
|||||||
Reference in New Issue
Block a user