feat: persist job source and market
This commit is contained in:
@@ -102,7 +102,9 @@ namespace JobTrackerApi.Controllers
|
||||
string? CoverLetterText,
|
||||
string? JobUrl,
|
||||
DateTime? DateApplied,
|
||||
DateTime? FeedbackRequestedAt
|
||||
DateTime? FeedbackRequestedAt,
|
||||
string? Source = null,
|
||||
string? CountryCode = null
|
||||
);
|
||||
|
||||
public sealed record UpdateJobApplicationRequest(
|
||||
|
||||
@@ -762,6 +762,28 @@ Canonical profile:
|
||||
ResponseDate = null,
|
||||
};
|
||||
|
||||
var source = string.IsNullOrWhiteSpace(request.Source) ? null : request.Source.Trim().ToLowerInvariant();
|
||||
if (source?.Length > 32) source = source[..32];
|
||||
var countryCode = string.IsNullOrWhiteSpace(request.CountryCode) ? null : request.CountryCode.Trim().ToUpperInvariant();
|
||||
if (countryCode?.Length != 2) countryCode = null;
|
||||
job.Job = new Job
|
||||
{
|
||||
OwnerUserId = job.OwnerUserId,
|
||||
CompanyId = job.CompanyId,
|
||||
JobTitle = job.JobTitle,
|
||||
Location = job.Location,
|
||||
JobUrl = job.JobUrl,
|
||||
Description = job.Description,
|
||||
TranslatedDescription = job.TranslatedDescription,
|
||||
DescriptionLanguage = job.DescriptionLanguage,
|
||||
Tags = job.Tags,
|
||||
Deadline = job.Deadline,
|
||||
Salary = job.Salary,
|
||||
Source = source,
|
||||
CountryCode = countryCode,
|
||||
SavedAt = job.SavedAt,
|
||||
};
|
||||
|
||||
// A job created straight into a pre-application stage has not been applied to, so it
|
||||
// must not carry an applied date. SyncAppliedDate also covers the reverse: a create
|
||||
// that omits DateApplied but names a real stage still gets stamped.
|
||||
@@ -769,12 +791,17 @@ Canonical profile:
|
||||
|
||||
(job.SalaryMin, job.SalaryMax, job.SalaryCurrency, job.SalaryPeriod) =
|
||||
NormalizeSalary(request.SalaryMin, request.SalaryMax, request.SalaryCurrency, request.SalaryPeriod);
|
||||
job.Job.SalaryMin = job.SalaryMin;
|
||||
job.Job.SalaryMax = job.SalaryMax;
|
||||
job.Job.SalaryCurrency = job.SalaryCurrency;
|
||||
job.Job.SalaryPeriod = job.SalaryPeriod;
|
||||
|
||||
// Generate and persist a short summary at creation time to avoid repeated model calls.
|
||||
try
|
||||
{
|
||||
var shortSum = await _summarizer.SummarizeAsync(BuildSummarySource(job), 160, 60);
|
||||
job.ShortSummary = shortSum;
|
||||
job.Job.ShortSummary = shortSum;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@ public sealed record JobImportResult
|
||||
public string? Language { get; init; } // ISO-ish, e.g. "en", "no"
|
||||
public string[] Tags { get; init; } = Array.Empty<string>();
|
||||
public string SourceUrl { get; init; } = "";
|
||||
public string? Source { get; init; }
|
||||
public string? CountryCode { get; init; }
|
||||
public DateTime? Deadline { get; init; }
|
||||
|
||||
public bool Success { get; init; }
|
||||
|
||||
@@ -21,6 +21,8 @@ public sealed class FinnPlugin : IJobSitePlugin
|
||||
Location = meta.TryGetValue("job:location", out var loc) ? loc : null,
|
||||
Description = HtmlExtract.ToPlainText(desc),
|
||||
Parser = "finn",
|
||||
Source = "finn",
|
||||
CountryCode = "NO",
|
||||
Success = !string.IsNullOrWhiteSpace(title) && !string.IsNullOrWhiteSpace(desc),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ public sealed class JobbnorgePlugin : IJobSitePlugin
|
||||
Title = title,
|
||||
Description = HtmlExtract.ToPlainText(desc),
|
||||
Parser = "jobbnorge",
|
||||
Source = "jobbnorge",
|
||||
CountryCode = "NO",
|
||||
Success = !string.IsNullOrWhiteSpace(title) && !string.IsNullOrWhiteSpace(desc),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public sealed class LinkedInPlugin : IJobSitePlugin
|
||||
Company = meta.TryGetValue("og:site_name", out var sn) ? sn : null,
|
||||
Description = HtmlExtract.ToPlainText(desc),
|
||||
Parser = "linkedin",
|
||||
Source = "linkedin",
|
||||
Success = !string.IsNullOrWhiteSpace(title) && !string.IsNullOrWhiteSpace(desc),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public sealed class NavPlugin : IJobSitePlugin
|
||||
Company = siteName, // better than nothing; universal parser often gets this anyway.
|
||||
Description = HtmlExtract.ToPlainText(desc),
|
||||
Parser = "nav",
|
||||
Source = "nav",
|
||||
CountryCode = "NO",
|
||||
Success = !string.IsNullOrWhiteSpace(title) && !string.IsNullOrWhiteSpace(desc),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user