Skip to content

Commit 5f6a965

Browse files
committed
feat: support employment type
1 parent eb87795 commit 5f6a965

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/common/profile/import.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Company } from '../../../src/entity/Company';
1111
import { UserExperienceWork } from '../../../src/entity/user/experiences/UserExperienceWork';
1212
import { insertOrIgnoreUserExperienceSkills } from '../../../src/entity/user/experiences/UserExperienceSkill';
1313
import { textFromEnumValue } from '../../../src/common';
14-
import { LocationType } from '@dailydotdev/schema';
14+
import { EmploymentType, LocationType } from '@dailydotdev/schema';
1515
import { DatasetLocation } from '../../../src/entity/dataset/DatasetLocation';
1616
import { UserExperienceEducation } from '../../../src/entity/user/experiences/UserExperienceEducation';
1717
import { UserExperienceCertification } from '../../../src/entity/user/experiences/UserExperienceCertification';
@@ -149,6 +149,7 @@ export const importUserExperienceWork = async ({
149149
ended_at: endedAt,
150150
location,
151151
flags,
152+
employment_type: employmentType,
152153
} = userExperience;
153154

154155
const insertResult = await con.getRepository(UserExperienceWork).insert(
@@ -166,7 +167,6 @@ export const importUserExperienceWork = async ({
166167
locationType: locationType
167168
? (Object.entries(LocationType).find(([, value]) => {
168169
return (
169-
// TODO cv-parsing remove this replace when cv is adjusted to not use prefix
170170
locationType.replace('LOCATION_TYPE_', '') ===
171171
textFromEnumValue(LocationType, value)
172172
);
@@ -176,6 +176,14 @@ export const importUserExperienceWork = async ({
176176
location,
177177
con: con,
178178
})),
179+
employmentType: employmentType
180+
? (Object.entries(EmploymentType).find(([, value]) => {
181+
return (
182+
employmentType.replace('EMPLOYMENT_TYPE_', '') ===
183+
textFromEnumValue(EmploymentType, value)
184+
);
185+
})?.[1] as EmploymentType)
186+
: undefined,
179187
}),
180188
);
181189

@@ -201,7 +209,6 @@ export const importUserExperienceEducation = async ({
201209
}): Promise<{ experienceId: string }> => {
202210
const userExperience = userExperienceEducationImportSchema.parse(data);
203211

204-
// TODO cv-parsing potentially won't be needed once cv is adjusted to use camelCase
205212
const {
206213
company,
207214
title,

src/common/schema/profile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const userExperienceWorkImportSchema = z.object({
122122
})
123123
.nullish(),
124124
flags: z.object({ import: z.string() }).partial().optional(),
125+
employment_type: z.string().nullish(),
125126
});
126127

127128
export const userExperienceEducationImportSchema = z.object({

0 commit comments

Comments
 (0)