From 50a3a3d01e92a6d46fc0968339bc288041efafc4 Mon Sep 17 00:00:00 2001 From: Kevin Barnoin Date: Wed, 17 Jul 2024 10:33:53 +0200 Subject: [PATCH] feat: lbac 2357: add indexes (#1363) * feat: add index * fix: metabase collection file classification --- server/src/jobs/jobs.ts | 2 +- .../metabaseRoleManagement360.ts} | 0 shared/models/applications.model.ts | 3 +++ shared/models/appointments.model.ts | 2 +- shared/models/jobs.model.ts | 2 +- shared/models/recruiter.model.ts | 2 ++ shared/models/unsubscribedLbaCompany.model.ts | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) rename server/src/jobs/{lba_recruteur/createRoleManagement360.ts => metabase/metabaseRoleManagement360.ts} (100%) diff --git a/server/src/jobs/jobs.ts b/server/src/jobs/jobs.ts index 823cb9a7b2..203879d402 100644 --- a/server/src/jobs/jobs.ts +++ b/server/src/jobs/jobs.ts @@ -23,7 +23,6 @@ import { addJob, executeJob } from "./jobs_actions" import { createApiUser } from "./lba_recruteur/api/createApiUser" import { disableApiUser } from "./lba_recruteur/api/disableApiUser" import { resetApiKey } from "./lba_recruteur/api/resetApiKey" -import { createRoleManagement360 } from "./lba_recruteur/createRoleManagement360" import { annuleFormulaire } from "./lba_recruteur/formulaire/annuleFormulaire" import { fixJobExpirationDate } from "./lba_recruteur/formulaire/fixJobExpirationDate" import { fixJobType } from "./lba_recruteur/formulaire/fixJobType" @@ -39,6 +38,7 @@ import updateGeoLocations from "./lbb/updateGeoLocations" import updateLbaCompanies from "./lbb/updateLbaCompanies" import updateOpcoCompanies from "./lbb/updateOpcoCompanies" import { createJobsCollectionForMetabase } from "./metabase/metabaseJobsCollection" +import { createRoleManagement360 } from "./metabase/metabaseRoleManagement360" import { runGarbageCollector } from "./misc/runGarbageCollector" import { importHelloWork } from "./offrePartenaire/importHelloWork" import { exportLbaJobsToS3 } from "./partenaireExport/exportJobsToS3" diff --git a/server/src/jobs/lba_recruteur/createRoleManagement360.ts b/server/src/jobs/metabase/metabaseRoleManagement360.ts similarity index 100% rename from server/src/jobs/lba_recruteur/createRoleManagement360.ts rename to server/src/jobs/metabase/metabaseRoleManagement360.ts diff --git a/shared/models/applications.model.ts b/shared/models/applications.model.ts index 4824c6da87..7e305f299c 100644 --- a/shared/models/applications.model.ts +++ b/shared/models/applications.model.ts @@ -239,6 +239,9 @@ export default { [{ company_name: 1 }, {}], [{ company_naf: 1 }, {}], [{ job_origin: 1 }, {}], + [{ job_id: 1 }, {}], + [{ caller: 1 }, {}], + [{ created_at: 1 }, {}], ], collectionName, } as const satisfies IModelDescriptor diff --git a/shared/models/appointments.model.ts b/shared/models/appointments.model.ts index 26ee2fbf2c..69f424b0f3 100644 --- a/shared/models/appointments.model.ts +++ b/shared/models/appointments.model.ts @@ -67,6 +67,6 @@ export type IAppointmentJson = Jsonify> export default { zod: ZAppointment, - indexes: [], + indexes: [[{ applicant_id: 1 }, {}]], collectionName, } as const satisfies IModelDescriptor diff --git a/shared/models/jobs.model.ts b/shared/models/jobs.model.ts index 1767a0637e..cdfc488aa9 100644 --- a/shared/models/jobs.model.ts +++ b/shared/models/jobs.model.ts @@ -8,6 +8,6 @@ const ZJobs = z.any() export default { zod: ZJobs, - indexes: [], + indexes: [[{ jobId: 1 }, {}]], collectionName, } as const satisfies IModelDescriptor diff --git a/shared/models/recruiter.model.ts b/shared/models/recruiter.model.ts index 5f8c666947..d57ed5aba4 100644 --- a/shared/models/recruiter.model.ts +++ b/shared/models/recruiter.model.ts @@ -89,6 +89,8 @@ export default { [{ establishment_siret: 1 }, {}], [{ cfa_delegated_siret: 1 }, {}], [{ geopoint: "2dsphere" }, {}], + [{ email: 1 }, {}], + [{ establishment_enseigne: 1 }, {}], ], collectionName, } as const satisfies IModelDescriptor diff --git a/shared/models/unsubscribedLbaCompany.model.ts b/shared/models/unsubscribedLbaCompany.model.ts index 47fee7767a..ad7907c474 100644 --- a/shared/models/unsubscribedLbaCompany.model.ts +++ b/shared/models/unsubscribedLbaCompany.model.ts @@ -30,6 +30,6 @@ export type IUnsubscribedLbaCompany = z.output export default { zod: ZUnsubscribedLbaCompany, - indexes: [], + indexes: [[{ siret: 1 }, {}]], collectionName, } as const satisfies IModelDescriptor