-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stages): ajout de la transformation hellowork
- Loading branch information
1 parent
a43f56f
commit e47ace0
Showing
9 changed files
with
951 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/stages/src/transformation/application-service/transformer-flux-hellowork.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Usecase } from "@shared/src/application-service/usecase"; | ||
|
||
import { UnJeune1Solution } from "@stages/src/transformation/domain/model/1jeune1solution"; | ||
import { FluxTransformation } from "@stages/src/transformation/domain/model/flux"; | ||
import { Hellowork } from "@stages/src/transformation/domain/model/hellowork"; | ||
import { Convertir } from "@stages/src/transformation/domain/service/hellowork/convertir.domain-service"; | ||
import { OffreDeStageRepository } from "@stages/src/transformation/domain/service/offre-de-stage.repository"; | ||
|
||
export class TransformerFluxHellowork implements Usecase { | ||
constructor( | ||
private readonly offreDeStageRepository: OffreDeStageRepository, | ||
private readonly convertirOffreDeStage: Convertir, | ||
) { | ||
} | ||
|
||
public async executer(flux: FluxTransformation): Promise<void> { | ||
const contenuDuFlux = await this.offreDeStageRepository.recuperer<Hellowork.Contenu>(flux); | ||
|
||
const contenuTransforme: Array<UnJeune1Solution.OffreDeStage> | ||
= contenuDuFlux.source.job.map((job: Hellowork.OffreDeStage) => this.convertirOffreDeStage.depuisHellowork(job)); | ||
|
||
await this.offreDeStageRepository.sauvegarder(contenuTransforme, flux); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
apps/stages/src/transformation/domain/model/hellowork/domaine.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export enum Domaine { | ||
MARKETING = "Marketing", | ||
INFORMATIQUE = "Informatique", | ||
RESSOURCES_HUMAINES = "Ressources_Humaines", | ||
COMMERCE = "Commerce", | ||
NULL = "NULL", | ||
COMMUNICATION = "Communication", | ||
JURIDIQUE = "Juridique", | ||
FINANCE = "Finance", | ||
BTP = "Btp", | ||
LOGISTIQUE = "Logistique", | ||
INGENIERIE = "Ingenierie", | ||
SECRETARIAT = "Secretariat", | ||
QUALITE = "Qualite", | ||
AUDIT = "Audit", | ||
GESTION = "Gestion", | ||
PRODUCTION = "Production", | ||
RECHERCHE = "Recherche", | ||
VENTE = "Vente", | ||
ACHAT = "Achat", | ||
COMPTABILITE = "Comptabilite", | ||
SANTE = "Sante", | ||
IMMOBILIER = "Immobilier", | ||
INDUSTRIE = "Industrie", | ||
GRAPHISME = "Graphisme", | ||
DISTRIBUTION = "Distribution", | ||
ADMINISTRATIF = "Administratif", | ||
SAV = "Sav", | ||
SECURITE = "Securite", | ||
ENVIRONNEMENT = "Environnement", | ||
DIRECTION = "Direction", | ||
BANQUE = "Banque", | ||
FORMATION = "Formation", | ||
AUTOMOBILE = "Automobile", | ||
EDITION = "Edition", | ||
RESTAURATION = "Restauration", | ||
TELECOM = "Telecom", | ||
PUB = "Pub", | ||
ELECTRONIQUE = "Electronique", | ||
HOTELLERIE = "Hotellerie", | ||
SERVICE_PUBLIC = "Service_Public", | ||
ARCHITECTURE = "Architecture", | ||
HOSPITALIER = "Hospitalier", | ||
CHIMIE = "Chimie", | ||
TRANSPORT = "Transport", | ||
TOURISME = "Tourisme", | ||
SERVICE = "Service", | ||
AGRICOLE = "Agricole", | ||
AUDIOVISUEL = "Audiovisuel", | ||
NETTOYAGE = "Nettoyage", | ||
AGROALIMENTAIRE = "Agroalimentaire", | ||
SOCIAL = "Social", | ||
BEAUTE = "Beaute", | ||
ARTISANAT = "Artisanat", | ||
CULTURE = "Culture", | ||
ENSEIGNEMENT = "Enseignement", | ||
BIOTECHNOLOGIE = "Biotechnologie", | ||
ASSURANCE = "Assurance", | ||
AERONAUTIQUE = "Aeronautique", | ||
NAUTISME = "Nautisme", | ||
DEFENSE = "Defense", | ||
FERROVIAIRE = "Ferroviaire" | ||
} |
35 changes: 35 additions & 0 deletions
35
apps/stages/src/transformation/domain/model/hellowork/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Domaine as _Domaine } from "@stages/src/transformation/domain/model/hellowork/domaine"; | ||
|
||
export namespace Hellowork { | ||
export type Contenu ={ | ||
source: { | ||
job: Array<OffreDeStage> | ||
} | ||
} | ||
|
||
export import Domaine = _Domaine | ||
|
||
export type OffreDeStage = { | ||
id: string; | ||
reference?: string | ||
// TODO (BRUJ 29-09-2023): format de la date | ||
date: string | ||
title: string | ||
link: string | ||
compagny: string | ||
logo?: string | ||
publisher?: string | ||
city?: string | ||
postalcode?: string | ||
inseecode?: string | ||
country?: string | ||
geoloc?: string | ||
description?: string | ||
jobtype?: string | ||
function?: string | ||
seodomain?: _Domaine | ||
category?: string | ||
education?: string | ||
salary?: string | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
apps/stages/src/transformation/domain/service/hellowork/convertir.domain-service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { DateService } from "@shared/src/domain/service/date.service"; | ||
import { Pays } from "@shared/src/domain/service/pays"; | ||
|
||
import { UnJeune1Solution } from "@stages/src/transformation/domain/model/1jeune1solution"; | ||
import { Hellowork } from "@stages/src/transformation/domain/model/hellowork"; | ||
|
||
export class Convertir { | ||
private readonly correspondanceDomaines: Map<Hellowork.Domaine, UnJeune1Solution.Domaine>; | ||
|
||
constructor( | ||
private readonly dateService: DateService, | ||
private readonly pays: Pays, | ||
) { | ||
this.correspondanceDomaines = new Map(); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.MARKETING, UnJeune1Solution.Domaine.MARKETING); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.INFORMATIQUE, UnJeune1Solution.Domaine.INFORMATIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.RESSOURCES_HUMAINES, UnJeune1Solution.Domaine.RH); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.COMMERCE, UnJeune1Solution.Domaine.COMMERCE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.NULL, UnJeune1Solution.Domaine.NON_APPLICABLE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.COMMUNICATION, UnJeune1Solution.Domaine.COMMUNICATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.JURIDIQUE, UnJeune1Solution.Domaine.JURIDIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.FINANCE, UnJeune1Solution.Domaine.FISCALITE_FINANCE_ASSURANCE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.IMMOBILIER, UnJeune1Solution.Domaine.ARCHITECTURE_URBANISME_IMMOBILIER); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.LOGISTIQUE, UnJeune1Solution.Domaine.LOGISTIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.INGENIERIE, UnJeune1Solution.Domaine.CONCEPTION_GENIE_CIVIL_INDUSTRIEL); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SECRETARIAT, UnJeune1Solution.Domaine.DIRECTION_ENTREPRISE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.QUALITE, UnJeune1Solution.Domaine.QUALITE_MAINTENANCE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AUDIT, UnJeune1Solution.Domaine.AUDIT); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.GESTION, UnJeune1Solution.Domaine.GESTION_PROJET); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.PRODUCTION, UnJeune1Solution.Domaine.PRODUCTION_FABRICATION_EXPLOITATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.RECHERCHE, UnJeune1Solution.Domaine.DATA); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.VENTE, UnJeune1Solution.Domaine.VENTES); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ACHAT, UnJeune1Solution.Domaine.ACHATS); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.COMPTABILITE, UnJeune1Solution.Domaine.COMPTABILITE_CONTROLE_GESTION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SANTE, UnJeune1Solution.Domaine.SANTE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.IMMOBILIER, UnJeune1Solution.Domaine.ARCHITECTURE_URBANISME_IMMOBILIER); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.INDUSTRIE, UnJeune1Solution.Domaine.PRODUCTION_FABRICATION_EXPLOITATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.GRAPHISME, UnJeune1Solution.Domaine.GRAPHISME); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.DISTRIBUTION, UnJeune1Solution.Domaine.ACHATS); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ADMINISTRATIF, UnJeune1Solution.Domaine.SECTEUR_PUBLIC); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SAV, UnJeune1Solution.Domaine.SUPPORT); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SECURITE, UnJeune1Solution.Domaine.SANTE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ENVIRONNEMENT, UnJeune1Solution.Domaine.ENVIRONNEMENT); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.DIRECTION, UnJeune1Solution.Domaine.DIRECTION_ENTREPRISE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.BANQUE, UnJeune1Solution.Domaine.FISCALITE_FINANCE_ASSURANCE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.FORMATION, UnJeune1Solution.Domaine.RH); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AUTOMOBILE, UnJeune1Solution.Domaine.PRODUCTION_FABRICATION_EXPLOITATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.EDITION, UnJeune1Solution.Domaine.NON_APPLICABLE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.RESTAURATION, UnJeune1Solution.Domaine.SECTEUR_PUBLIC); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.TELECOM, UnJeune1Solution.Domaine.LOGISTIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.PUB, UnJeune1Solution.Domaine.HOTELLERIE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ELECTRONIQUE, UnJeune1Solution.Domaine.ENERGIE_MATERIAUX_MECANIQUE_ELECTRONIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.HOTELLERIE, UnJeune1Solution.Domaine.HOTELLERIE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SERVICE_PUBLIC, UnJeune1Solution.Domaine.SECTEUR_PUBLIC); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ARCHITECTURE, UnJeune1Solution.Domaine.ARCHITECTURE_URBANISME_IMMOBILIER); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.HOSPITALIER, UnJeune1Solution.Domaine.SANTE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.CHIMIE, UnJeune1Solution.Domaine.CHIMIE_BIOLOGIE_AGRONOMIE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.TRANSPORT, UnJeune1Solution.Domaine.LOGISTIQUE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.TOURISME, UnJeune1Solution.Domaine.HOTELLERIE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SERVICE, UnJeune1Solution.Domaine.NON_APPLICABLE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AGRICOLE, UnJeune1Solution.Domaine.AGRICULTURE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AUDIOVISUEL, UnJeune1Solution.Domaine.JOURNALISME_RP_MEDIAS); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.NETTOYAGE, UnJeune1Solution.Domaine.SANTE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AGROALIMENTAIRE, UnJeune1Solution.Domaine.AGRICULTURE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.SOCIAL, UnJeune1Solution.Domaine.ACTIVITES_SOCIALES_CULTURELLES); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.BEAUTE, UnJeune1Solution.Domaine.SANTE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ARTISANAT, UnJeune1Solution.Domaine.PRODUCTION_FABRICATION_EXPLOITATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.CULTURE, UnJeune1Solution.Domaine.ACTIVITES_SOCIALES_CULTURELLES); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ENSEIGNEMENT, UnJeune1Solution.Domaine.ENSEIGNEMENT); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.BIOTECHNOLOGIE, UnJeune1Solution.Domaine.CHIMIE_BIOLOGIE_AGRONOMIE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.ASSURANCE, UnJeune1Solution.Domaine.FISCALITE_FINANCE_ASSURANCE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.AERONAUTIQUE, UnJeune1Solution.Domaine.PRODUCTION_FABRICATION_EXPLOITATION); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.NAUTISME, UnJeune1Solution.Domaine.NON_APPLICABLE); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.DEFENSE, UnJeune1Solution.Domaine.SECTEUR_PUBLIC); | ||
this.correspondanceDomaines.set(Hellowork.Domaine.FERROVIAIRE, UnJeune1Solution.Domaine.LOGISTIQUE); | ||
} | ||
|
||
public depuisHellowork(offreDeStage: Hellowork.OffreDeStage): UnJeune1Solution.OffreDeStage { | ||
const maintenant = this.dateService.maintenant().toISOString(); | ||
|
||
return { | ||
// TODO (BRUJ 29-09-2023): changer dateDeDebutMax/Min | ||
dateDeDebutMax: "", | ||
dateDeDebutMin: "", | ||
description: offreDeStage.description, | ||
domaines: [{ nom: this.traduireDomaine(offreDeStage.seodomain) }], | ||
employeur: { | ||
nom: offreDeStage.compagny, | ||
logoUrl: offreDeStage.logo, | ||
}, | ||
identifiantSource: offreDeStage.id, | ||
localisation: this.recupererLaLocalisation(offreDeStage), | ||
// TODO (BRUJ 29-09-2023): rajouter la rémunération en string | ||
source: UnJeune1Solution.Source.HELLOWORK, | ||
sourceCreatedAt: offreDeStage.date, | ||
sourceUpdatedAt: offreDeStage.date, | ||
sourcePublishedAt: maintenant, | ||
titre: offreDeStage.title, | ||
urlDeCandidature: offreDeStage.link, | ||
}; | ||
} | ||
|
||
private traduireDomaine(domaine: Hellowork.Domaine): UnJeune1Solution.Domaine { | ||
const traductionDomaine = this.correspondanceDomaines.get(domaine); | ||
return traductionDomaine || UnJeune1Solution.Domaine.NON_APPLICABLE; | ||
} | ||
|
||
private recupererLaLocalisation(offreDeStage: Hellowork.OffreDeStage): UnJeune1Solution.Localisation { | ||
return { | ||
ville: offreDeStage.city, | ||
codePostal: offreDeStage.postalcode, | ||
pays: this.pays.versFormatISOAlpha2(offreDeStage.country), | ||
latitude: Number(offreDeStage.geoloc.split(",")[0]), | ||
longitude: Number(offreDeStage.geoloc.split(",")[1]), | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.