@@ -141,10 +141,12 @@ export const importUserExperienceWork = async ({
141141 skills,
142142 ended_at : endedAt ,
143143 location,
144+ flags,
144145 } = userExperience ;
145146
146147 const insertResult = await con . getRepository ( UserExperienceWork ) . insert (
147148 con . getRepository ( UserExperienceWork ) . create ( {
149+ flags,
148150 userId : userId ,
149151 ...( await resolveUserCompanyPart ( {
150152 name : company ,
@@ -202,10 +204,12 @@ export const importUserExperienceEducation = async ({
202204 ended_at : endedAt ,
203205 location,
204206 subtitle,
207+ flags,
205208 } = userExperience ;
206209
207210 const insertResult = await con . getRepository ( UserExperienceEducation ) . insert (
208211 con . getRepository ( UserExperienceEducation ) . create ( {
212+ flags,
209213 userId : userId ,
210214 ...( await resolveUserCompanyPart ( {
211215 name : company ,
@@ -250,12 +254,14 @@ export const importUserExperienceCertification = async ({
250254 title,
251255 started_at : startedAt ,
252256 ended_at : endedAt ,
257+ flags,
253258 } = userExperience ;
254259
255260 const insertResult = await con
256261 . getRepository ( UserExperienceCertification )
257262 . insert (
258263 con . getRepository ( UserExperienceCertification ) . create ( {
264+ flags,
259265 userId : userId ,
260266 ...( await resolveUserCompanyPart ( {
261267 name : company ,
@@ -291,10 +297,12 @@ export const importUserExperienceProject = async ({
291297 started_at : startedAt ,
292298 ended_at : endedAt ,
293299 skills,
300+ flags,
294301 } = userExperience ;
295302
296303 const insertResult = await con . getRepository ( UserExperienceProject ) . insert (
297304 con . getRepository ( UserExperienceProject ) . create ( {
305+ flags,
298306 userId : userId ,
299307 title,
300308 description,
@@ -318,10 +326,12 @@ export const importUserExperienceFromJSON = async ({
318326 con,
319327 dataJson,
320328 userId,
329+ importId,
321330} : {
322331 con : EntityManager ;
323332 dataJson : unknown ;
324333 userId : string ;
334+ importId ?: string ;
325335} ) => {
326336 if ( ! userId ) {
327337 throw new Error ( 'userId is required' ) ;
@@ -352,26 +362,31 @@ export const importUserExperienceFromJSON = async ({
352362
353363 await con . transaction ( async ( entityManager ) => {
354364 for ( const item of data ) {
355- switch ( item . type ) {
365+ const importData = {
366+ ...item ,
367+ flags : importId ? { import : importId } : undefined ,
368+ } ;
369+
370+ switch ( importData . type ) {
356371 case UserExperienceType . Work :
357372 await importUserExperienceWork ( {
358- data : item ,
373+ data : importData ,
359374 con : entityManager ,
360375 userId,
361376 } ) ;
362377
363378 break ;
364379 case UserExperienceType . Education :
365380 await importUserExperienceEducation ( {
366- data : item ,
381+ data : importData ,
367382 con : entityManager ,
368383 userId,
369384 } ) ;
370385
371386 break ;
372387 case UserExperienceType . Certification :
373388 await importUserExperienceCertification ( {
374- data : item ,
389+ data : importData ,
375390 con : entityManager ,
376391 userId,
377392 } ) ;
@@ -381,14 +396,14 @@ export const importUserExperienceFromJSON = async ({
381396 case UserExperienceType . OpenSource :
382397 case UserExperienceType . Volunteering :
383398 await importUserExperienceProject ( {
384- data : item ,
399+ data : importData ,
385400 con : entityManager ,
386401 userId,
387402 } ) ;
388403
389404 break ;
390405 default :
391- throw new Error ( `Unsupported experience type: ${ item . type } ` ) ;
406+ throw new Error ( `Unsupported experience type: ${ importData . type } ` ) ;
392407 }
393408 }
394409 } ) ;
0 commit comments