Fix frontend build for CV profile and draft types
This commit is contained in:
@@ -213,6 +213,7 @@ export const translations = {
|
|||||||
profileCvStructuredEditorHelp: "Edit reusable CV data directly so generators and matching can work from stable fields instead of raw text alone.",
|
profileCvStructuredEditorHelp: "Edit reusable CV data directly so generators and matching can work from stable fields instead of raw text alone.",
|
||||||
profileCvExtractionHistory: "Extraction history",
|
profileCvExtractionHistory: "Extraction history",
|
||||||
profileCvExtractionHistoryHelp: "See which parser run produced the current structured profile and reprocess from the stored source artifact when needed.",
|
profileCvExtractionHistoryHelp: "See which parser run produced the current structured profile and reprocess from the stored source artifact when needed.",
|
||||||
|
profileCvExtractionHistoryEmpty: "No extraction runs yet.",
|
||||||
profileCvProfileVersion: "Profile v{count}",
|
profileCvProfileVersion: "Profile v{count}",
|
||||||
profileCvCurrentRun: "Current run",
|
profileCvCurrentRun: "Current run",
|
||||||
profileCvNoStoredArtifact: "No stored artifact",
|
profileCvNoStoredArtifact: "No stored artifact",
|
||||||
@@ -1113,6 +1114,7 @@ export const translations = {
|
|||||||
profileCvStructuredEditorHelp: "Rediger gjenbrukbare CV-data direkte slik at generatorer og matching kan jobbe fra stabile felt i stedet for bare råtekst.",
|
profileCvStructuredEditorHelp: "Rediger gjenbrukbare CV-data direkte slik at generatorer og matching kan jobbe fra stabile felt i stedet for bare råtekst.",
|
||||||
profileCvExtractionHistory: "Ekstraksjonshistorikk",
|
profileCvExtractionHistory: "Ekstraksjonshistorikk",
|
||||||
profileCvExtractionHistoryHelp: "Se hvilken parserkjøring som produserte den nåværende strukturerte profilen, og kjør på nytt fra det lagrede kildeartefaktet ved behov.",
|
profileCvExtractionHistoryHelp: "Se hvilken parserkjøring som produserte den nåværende strukturerte profilen, og kjør på nytt fra det lagrede kildeartefaktet ved behov.",
|
||||||
|
profileCvExtractionHistoryEmpty: "Ingen ekstraksjonskjøringer ennå.",
|
||||||
profileCvProfileVersion: "Profil v{count}",
|
profileCvProfileVersion: "Profil v{count}",
|
||||||
profileCvCurrentRun: "Gjeldende kjøring",
|
profileCvCurrentRun: "Gjeldende kjøring",
|
||||||
profileCvNoStoredArtifact: "Ingen lagret kildefil",
|
profileCvNoStoredArtifact: "Ingen lagret kildefil",
|
||||||
|
|||||||
@@ -35,14 +35,26 @@ function formatDateRange(start?: string | null, end?: string | null, isCurrent?:
|
|||||||
|
|
||||||
export function renderTailoredCvDraftText(source?: Partial<TailoredCvDraft> | null) {
|
export function renderTailoredCvDraftText(source?: Partial<TailoredCvDraft> | null) {
|
||||||
const draft = emptyTailoredCvDraft();
|
const draft = emptyTailoredCvDraft();
|
||||||
|
const sourceSummary = source?.summary;
|
||||||
|
const sourceSelectedSkills = source?.selectedSkills;
|
||||||
|
const sourceExperience = source?.experience;
|
||||||
|
const sourceEducation = source?.education;
|
||||||
|
const sourceCustomSections = source?.customSections;
|
||||||
|
|
||||||
|
const summary = Array.isArray(sourceSummary) ? sourceSummary.filter(Boolean) : [];
|
||||||
|
const selectedSkills = Array.isArray(sourceSelectedSkills) ? sourceSelectedSkills.filter(Boolean) : [];
|
||||||
|
const experience = Array.isArray(sourceExperience) ? sourceExperience.filter(Boolean) : [];
|
||||||
|
const education = Array.isArray(sourceEducation) ? sourceEducation.filter(Boolean) : [];
|
||||||
|
const customSections = Array.isArray(sourceCustomSections) ? sourceCustomSections.filter(Boolean) : [];
|
||||||
|
|
||||||
const normalized = {
|
const normalized = {
|
||||||
...draft,
|
...draft,
|
||||||
...source,
|
...source,
|
||||||
summary: Array.isArray(source?.summary) ? source.summary.filter(Boolean) : [],
|
summary,
|
||||||
selectedSkills: Array.isArray(source?.selectedSkills) ? source.selectedSkills.filter(Boolean) : [],
|
selectedSkills,
|
||||||
experience: Array.isArray(source?.experience) ? source.experience.filter(Boolean) : [],
|
experience,
|
||||||
education: Array.isArray(source?.education) ? source.education.filter(Boolean) : [],
|
education,
|
||||||
customSections: Array.isArray(source?.customSections) ? source.customSections.filter(Boolean) : [],
|
customSections,
|
||||||
};
|
};
|
||||||
|
|
||||||
const sections: string[] = [];
|
const sections: string[] = [];
|
||||||
@@ -88,39 +100,47 @@ export function renderTailoredCvDraftText(source?: Partial<TailoredCvDraft> | nu
|
|||||||
|
|
||||||
export function normalizeTailoredCvDraft(source?: Partial<TailoredCvDraft> | null): TailoredCvDraft {
|
export function normalizeTailoredCvDraft(source?: Partial<TailoredCvDraft> | null): TailoredCvDraft {
|
||||||
const empty = emptyTailoredCvDraft();
|
const empty = emptyTailoredCvDraft();
|
||||||
|
const sourceSummary = source?.summary;
|
||||||
|
const sourceSelectedSkills = source?.selectedSkills;
|
||||||
|
const sourceExperience = source?.experience;
|
||||||
|
const sourceEducation = source?.education;
|
||||||
|
const sourceCustomSections = source?.customSections;
|
||||||
|
const sourceRenderOptions = source?.renderOptions;
|
||||||
|
const sourceSectionOrder = sourceRenderOptions?.sectionOrder;
|
||||||
|
|
||||||
const normalized: TailoredCvDraft = {
|
const normalized: TailoredCvDraft = {
|
||||||
...empty,
|
...empty,
|
||||||
...source,
|
...source,
|
||||||
templateId: source?.templateId?.trim() || empty.templateId,
|
templateId: source?.templateId?.trim() || empty.templateId,
|
||||||
headline: source?.headline ?? "",
|
headline: source?.headline ?? "",
|
||||||
summary: Array.isArray(source?.summary) ? source!.summary.filter(Boolean) : [],
|
summary: Array.isArray(sourceSummary) ? sourceSummary.filter(Boolean) : [],
|
||||||
selectedSkills: Array.isArray(source?.selectedSkills) ? source!.selectedSkills.filter(Boolean) : [],
|
selectedSkills: Array.isArray(sourceSelectedSkills) ? sourceSelectedSkills.filter(Boolean) : [],
|
||||||
experience: Array.isArray(source?.experience) ? source!.experience.map((item) => ({
|
experience: Array.isArray(sourceExperience) ? sourceExperience.map((item) => ({
|
||||||
title: item?.title ?? "",
|
title: item?.title ?? "",
|
||||||
company: item?.company ?? "",
|
company: item?.company ?? "",
|
||||||
location: item?.location ?? "",
|
location: item?.location ?? "",
|
||||||
start: item?.start ?? "",
|
start: item?.start ?? "",
|
||||||
end: item?.end ?? "",
|
end: item?.end ?? "",
|
||||||
isCurrent: Boolean(item?.isCurrent),
|
isCurrent: Boolean(item?.isCurrent),
|
||||||
bullets: Array.isArray(item?.bullets) ? item!.bullets.filter(Boolean) : [],
|
bullets: Array.isArray(item?.bullets) ? item.bullets.filter(Boolean) : [],
|
||||||
})) : [],
|
})) : [],
|
||||||
education: Array.isArray(source?.education) ? source!.education.map((item) => ({
|
education: Array.isArray(sourceEducation) ? sourceEducation.map((item) => ({
|
||||||
qualification: item?.qualification ?? "",
|
qualification: item?.qualification ?? "",
|
||||||
institution: item?.institution ?? "",
|
institution: item?.institution ?? "",
|
||||||
location: item?.location ?? "",
|
location: item?.location ?? "",
|
||||||
start: item?.start ?? "",
|
start: item?.start ?? "",
|
||||||
end: item?.end ?? "",
|
end: item?.end ?? "",
|
||||||
details: Array.isArray(item?.details) ? item!.details.filter(Boolean) : [],
|
details: Array.isArray(item?.details) ? item.details.filter(Boolean) : [],
|
||||||
})) : [],
|
})) : [],
|
||||||
customSections: Array.isArray(source?.customSections) ? source!.customSections.map((item) => ({
|
customSections: Array.isArray(sourceCustomSections) ? sourceCustomSections.map((item) => ({
|
||||||
title: item?.title ?? "",
|
title: item?.title ?? "",
|
||||||
items: Array.isArray(item?.items) ? item!.items.filter(Boolean) : [],
|
items: Array.isArray(item?.items) ? item.items.filter(Boolean) : [],
|
||||||
})) : [],
|
})) : [],
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
...empty.renderOptions,
|
...empty.renderOptions,
|
||||||
...source?.renderOptions,
|
...sourceRenderOptions,
|
||||||
sectionOrder: Array.isArray(source?.renderOptions?.sectionOrder) && source.renderOptions.sectionOrder.length > 0
|
sectionOrder: Array.isArray(sourceSectionOrder) && sourceSectionOrder.length > 0
|
||||||
? source.renderOptions.sectionOrder.filter(Boolean)
|
? sourceSectionOrder.filter(Boolean)
|
||||||
: DEFAULT_SECTION_ORDER,
|
: DEFAULT_SECTION_ORDER,
|
||||||
},
|
},
|
||||||
status: source?.status?.trim() || empty.status,
|
status: source?.status?.trim() || empty.status,
|
||||||
|
|||||||
Reference in New Issue
Block a user