Skip to content

Commit

Permalink
fix: mise a jour de la récupération des users du cfa
Browse files Browse the repository at this point in the history
  • Loading branch information
Pomarom committed Dec 17, 2024
1 parent 9260335 commit 501ce96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion server/src/common/actions/effectifs/effectifs.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ export const getPaginatedEffectifsByMissionLocaleId = async (
annee_scolaire: { $in: getAnneesScolaireListFromDate(new Date()) },
},
},
{ $addFields: { stringify_organisme_id: { $toString: "$organisme_id" } } },
{
$lookup: {
from: "organisations",
localField: "organisme_id",
localField: "stringify_organisme_id",
foreignField: "organisme_id",
as: "organisation",
},
Expand Down
5 changes: 4 additions & 1 deletion server/src/jobs/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ export async function setupJobProcessor() {
const orga = organisations[i] as IOrganisationOrganismeFormation;
const organisme = await organismesDb().findOne({ siret: orga.siret, uai: orga.uai ?? undefined });
if (organisme) {
await organisationsDb().updateOne({ _id: orga._id }, { $set: { organisme_id: organisme._id } });
await organisationsDb().updateOne(
{ _id: orga._id },
{ $set: { organisme_id: organisme._id.toString() } }
);
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion shared/models/data/organisations.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const zOrganisationOrganismeCreate = z.object({
})
.regex(UAI_REGEX)
.nullable(),
organisme_id: zObjectId.describe("Identifiant de l'organisme").optional(),
organisme_id: z.string({ description: "Identifiant de l'organisme" }).optional(),
});

const zOrganisationReaseauCreate = z.object({
Expand Down

0 comments on commit 501ce96

Please sign in to comment.