Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix: Unresolved jobType from job discovery automation

Khuram Niaz2a9ac25fb4e0
diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsx
index b6c29a2..6676677 100644
--- a/src/components/ComboBox.tsx
+++ b/src/components/ComboBox.tsx
@@ -100,9 +100,11 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
!field.value && "text-muted-foreground"
)}
>
- {field.value
- ? options.find((option) => option.id === field.value)?.label
- : `Select ${field.name}`}
+ <span className="min-w-0 truncate">
+ {field.value
+ ? options.find((option) => option.id === field.value)?.label
+ : `Select ${field.name}`}
+ </span>
{isPending ? (
<Loader className="h-4 w-4 shrink-0 spinner" />
diff --git a/src/lib/scraper/jsearch/index.ts b/src/lib/scraper/jsearch/index.ts
index 797e6e7..2e7cab8 100644
--- a/src/lib/scraper/jsearch/index.ts
+++ b/src/lib/scraper/jsearch/index.ts
@@ -190,6 +190,7 @@ export async function searchJSearchJobs(
url: job.job_apply_link,
postedDate: job.job_posted_at_datetime_utc,
salary: formatSalary(job),
+ employmentType: job.job_employment_type,
}));
return { success: true, data: jobs };
diff --git a/src/lib/scraper/mapper.ts b/src/lib/scraper/mapper.ts
index 3725e1e..81782f6 100644
--- a/src/lib/scraper/mapper.ts
+++ b/src/lib/scraper/mapper.ts
@@ -2,6 +2,25 @@ import type { ScrapedJobData, DiscoveryStatus } from "@/models/automation.model"
import db from "@/lib/db";
import { normalizeForSearch, extractKeywords, extractCityName } from "./utils";
+// Maps source employment-type strings (JSearch's "FULLTIME"/"CONTRACTOR",
+// Greenhouse's absence of the field, etc.) to JOB_TYPES enum keys. Defaults
+// to full-time when the source doesn't expose employment type at all.
+const JOB_TYPE_ALIASES: Record<string, string> = {
+ fulltime: "FT",
+ parttime: "PT",
+ contractor: "C",
+ contract: "C",
+ temporary: "C",
+ intern: "C",
+ internship: "C",
+};
+
+function normalizeJobType(employmentType?: string): string {
+ if (!employmentType) return "FT";
+ const key = employmentType.toLowerCase().replace(/[^a-z]/g, "");
+ return JOB_TYPE_ALIASES[key] ?? "FT";
+}
+
interface MapperInput {
scrapedJob: ScrapedJobData;
userId: string;
@@ -45,7 +64,7 @@ export async function mapScrapedJobToJobRecord(
automationId,
jobUrl: scrapedJob.sourceUrl,
description: scrapedJob.description,
- jobType: "full-time",
+ jobType: normalizeJobType(scrapedJob.employmentType),
createdAt: new Date(),
applied: false,
statusId,
diff --git a/src/lib/scraper/runner.ts b/src/lib/scraper/runner.ts
index 7f4a8bb..c1d409b 100644
--- a/src/lib/scraper/runner.ts
+++ b/src/lib/scraper/runner.ts
@@ -486,6 +486,7 @@ export async function runAutomation(
description: job.description,
sourceUrl: normalizeJobUrl(job.url),
sourceBoard: automation.jobBoard as JobBoard,
+ employmentType: job.employmentType,
};
const jobRecord = await mapScrapedJobToJobRecord({
@@ -703,6 +704,7 @@ async function persistDiscoveredJob(
description: job.description,
sourceUrl: normalizeJobUrl(job.url),
sourceBoard: automation.jobBoard,
+ employmentType: job.employmentType,
};
const jobRecord = await mapScrapedJobToJobRecord({
diff --git a/src/lib/scraper/types.ts b/src/lib/scraper/types.ts
index 1b51002..81a07f1 100644
--- a/src/lib/scraper/types.ts
+++ b/src/lib/scraper/types.ts
@@ -14,6 +14,7 @@ export interface JobDetails {
url: string;
postedDate?: string;
salary?: string;
+ employmentType?: string;
}
export type ScraperError =
diff --git a/src/models/automation.model.ts b/src/models/automation.model.ts
index 0d74267..3dd0359 100644
--- a/src/models/automation.model.ts
+++ b/src/models/automation.model.ts
@@ -110,4 +110,5 @@ export interface ScrapedJobData {
description: string;
sourceUrl: string;
sourceBoard: JobBoard;
+ employmentType?: string;
}