Skip to content

Commit

Permalink
fix(lbac-2114): fix workplace_address_label, ajout created_at (#1663)
Browse files Browse the repository at this point in the history
  • Loading branch information
remy-auricoste authored Nov 25, 2024
1 parent d95e5d3 commit 33d5a2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Infos complémentaires : Nous vous proposons :<br><br>Un poste en alternance ouv
"partner_job_id": "913079004",
"partner_label": "RH Alternance",
"validated": false,
"workplace_address_label": "TOURLAVILLE 420 RUE DE LA PYROTECHNIE 50100 CHERBOURG-EN-COTENTIN",
"workplace_address_label": "34280 La Grande-Motte",
"workplace_name": "GRAND LARGE YACHTING",
"workplace_siret": "44537545400037",
"workplace_website": "https://rhalternance.com/companies/grand-large-yachting-mediterranee",
Expand Down
5 changes: 3 additions & 2 deletions server/src/jobs/offrePartenaire/importRHAlternance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const rawRhAlternanceToComputedMapper =
(now: Date) =>
({
jobCode,
companyAddress,
companyName,
companySiret,
companyUrl,
Expand All @@ -94,6 +93,8 @@ export const rawRhAlternanceToComputedMapper =
jobSubmitDateTime,
jobType,
jobUrl,
jobCity,
jobPostalCode,
}: IRawRHAlternance["job"]): IComputedJobsPartners => {
const offer_creation = jobSubmitDateTime ? dayjs.tz(jobSubmitDateTime).toDate() : now
const isValid: boolean = jobType === "Alternance"
Expand All @@ -114,7 +115,7 @@ export const rawRhAlternanceToComputedMapper =
workplace_siret: companySiret,
workplace_name: companyName,
workplace_website: companyUrl,
workplace_address_label: companyAddress,
workplace_address_label: [jobPostalCode, jobCity].flatMap((x) => (x ? [x] : [])).join(" ") || null,
apply_url: jobUrl,
errors: [],
validated: false,
Expand Down
2 changes: 2 additions & 0 deletions server/src/jobs/offrePartenaire/rawToComputedJobsPartners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const rawToComputedJobsPartners = async <ZodInput extends AnyZodObject>({
logger.info(`suppression de ${deletedCount} documents dans computed_jobs_partners pour partner_label=${partnerLabel}`)
await getDbCollection("computed_jobs_partners").deleteMany({ partner_label: partnerLabel })
const counters = { total: 0, success: 0, error: 0 }
const importDate = new Date()
await oleoduc(
getDbCollection(collectionSource).find({}).stream(),
writeData(
Expand All @@ -41,6 +42,7 @@ export const rawToComputedJobsPartners = async <ZodInput extends AnyZodObject>({
...computedJobPartner,
partner_label: partnerLabel,
validated: ZJobsPartnersOfferPrivate.safeParse(computedJobPartner).success,
created_at: importDate,
})
counters.success++
} catch (err) {
Expand Down
2 changes: 2 additions & 0 deletions shared/models/rawRHAlternance.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const ZRawRHAlternance = z.object({
jobCode: z.string(),
jobType: z.string().nullish(),
jobTitle: z.string().nullish(),
jobCity: z.string().nullish(),
jobPostalCode: z.string().nullish(),
jobDescription: z
.array(
z.object({
Expand Down

0 comments on commit 33d5a2d

Please sign in to comment.