mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-08 16:07:40 +00:00
fix(jobnet-search): filter search by the ESCO occupation that occupations prints (#649)
* fix(jobnet-search): filter search by the ESCO occupation that occupations prints SKILL.md and the CLI README told users to pass the conceptUriDa UUID from `occupations` to `search --occupation-area` / `--occupation-group`. Those flags take the numeric area and group codes (10000, 10060), so a UUID there returned a successful search with zero ads. The API filters one occupation through its `occupations` parameter, which returns the 830 nurse ads for the sygeplejerske UUID. Add `search --occupation`, sent as `occupations`, accepting the full conceptUriDa or its trailing UUID, and point the docs at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * changelog: place the #649 entry under [Unreleased] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Mads Lorentzen <madslorentzen_17@hotmail.com>
This commit is contained in:
5 files changed
+107
-4
No files matched your search
@@ -59,6 +59,7 @@ export interface SearchFlags {
|
||||
radius: number
|
||||
"occupation-area"?: string
|
||||
"occupation-group"?: string
|
||||
occupation?: string
|
||||
limit?: number
|
||||
}
|
||||
|
||||
@@ -80,10 +81,21 @@ export function buildSearchParams(flags: SearchFlags): Record<string, string> {
|
||||
}
|
||||
if (flags["occupation-area"]) params["occupationAreas"] = flags["occupation-area"]
|
||||
if (flags["occupation-group"]) params["occupationGroups"] = flags["occupation-group"]
|
||||
if (flags.occupation) params["occupations"] = occupationId(flags.occupation)
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* The search API filters one ESCO occupation by the UUID that ends the
|
||||
* `conceptUriDa` printed by `occupations`. Accept that full URI as well as the
|
||||
* bare UUID, so the value can be copied from either output unchanged.
|
||||
*/
|
||||
export function occupationId(value: string): string {
|
||||
const trimmed = value.trim().replace(/\/+$/, "")
|
||||
return trimmed.slice(trimmed.lastIndexOf("/") + 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the destination URL for an external ad, if it has a valid http(s)
|
||||
* jobAdUrl. Only an absolute http(s) URL is used: the value is employer-supplied
|
||||
@@ -201,6 +213,9 @@ export const search = defineCommand({
|
||||
"occupation-group": option(z.string().optional(), {
|
||||
description: "Occupation group identifier, e.g. 10060",
|
||||
}),
|
||||
occupation: option(z.string().optional(), {
|
||||
description: "ESCO occupation UUID or conceptUriDa from the occupations command",
|
||||
}),
|
||||
limit: option(z.coerce.number().int().min(1).optional(), {
|
||||
description: "Cap total results returned by CLI",
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user