Skip to content

Commit

Permalink
feat: index sur code_rome
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlr committed Apr 29, 2024
1 parent 6ae96f9 commit 0f00d62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ const mobiliteSchema = new Schema<IRomeMobilite>(
{ _id: false, versionKey: false }
)

const codeRomeSchema = new Schema<string>(
{ code_rome: { type: String, index: true }, intitule: { type: String }, code_ogr: { type: String } },
{
_id: false,
versionKey: false,
}
)

export const referentielRomeSchema = new Schema<IReferentielRome>(
{
numero: {
type: String,
description: "Numéro d'identification de la fiche emploi",
},
rome: {
code_rome: String,
intitule: String,
code_ogr: String,
},
rome: codeRomeSchema,
appellations: {
type: Array,
items: {
Expand Down Expand Up @@ -52,6 +56,4 @@ export const referentielRomeSchema = new Schema<IReferentielRome>(
{ versionKey: false }
)

referentielRomeSchema.index({ "rome.rome_code": 1 })

export default model<IReferentielRome>("referentielRomes", referentielRomeSchema)
2 changes: 0 additions & 2 deletions server/src/jobs/seed/referentielRome/referentielRome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { ReferentielRome } from "../../../common/model/index.js"
import { asyncForEach } from "../../../common/utils/asyncUtils.js"

const formatRawData = ({ appellations, competences, contextes_travail, mobilites, numero, rome, definition, acces_metier }) => {
console.log("Appellations", appellations)

return {
numero,
rome,
Expand Down
1 change: 1 addition & 0 deletions shared/models/rome.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@ export const ZReferentielRome = z
})
.strict()

export type IRome = z.output<typeof ZRome>
export type IRomeMobilite = z.output<typeof ZRomeMobilite>
export type IReferentielRome = z.output<typeof ZReferentielRome>

0 comments on commit 0f00d62

Please sign in to comment.