Skip to content

Commit e649fc7

Browse files
authored
feat: add some experience seeds (#3382)
1 parent 50ec685 commit e649fc7

3 files changed

Lines changed: 558 additions & 0 deletions

File tree

bin/import.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,31 @@ const start = async (): Promise<void> => {
8686
await importEntity(con, 'OpportunityKeyword');
8787
await importEntity(con, 'OpportunityUserRecruiter');
8888
await importEntity(con, 'OpportunityMatch');
89+
await importEntity(con, 'UserExperience');
90+
await importEntity(con, 'UserExperienceSkill');
8991
// Manually have to reset these as insert has a issue with `type` columns
9092
await con.query(`update post set type = 'article' where type = 'Post'`);
9193
await con.query(`update source set type = 'machine' where type = 'Source'`);
9294
await con.query(`update source set type = 'squad' where id = 'publicsquad'`);
95+
// Fix UserExperience type column (TypeORM table inheritance issue)
96+
await con.query(
97+
`update user_experience set type = 'work' where type = 'UserExperience' and "employmentType" is not null`,
98+
);
99+
await con.query(
100+
`update user_experience set type = 'education' where type = 'UserExperience' and grade is not null`,
101+
);
102+
await con.query(
103+
`update user_experience set type = 'project' where type = 'UserExperience' and url is not null and "externalReferenceId" is null`,
104+
);
105+
await con.query(
106+
`update user_experience set type = 'certification' where type = 'UserExperience' and "externalReferenceId" is not null`,
107+
);
108+
await con.query(
109+
`update user_experience set type = 'opensource' where type = 'UserExperience' and url is not null and "externalReferenceId" is null and "customCompanyName" is null`,
110+
);
111+
await con.query(
112+
`update user_experience set type = 'volunteering' where type = 'UserExperience' and "employmentType" is null and grade is null and url is null and "externalReferenceId" is null`,
113+
);
93114
await con.transaction(async (manager) => {
94115
for (const viewToRefresh of viewsToRefresh) {
95116
await manager.query(

0 commit comments

Comments
 (0)