betagouv/service-national-universel

View on GitHub
api/migrations/20240910084532-fix-young-inscriptionStep2023.js

Summary

Maintainability
A
0 mins
Test Coverage
module.exports = {
  async up(db) {
    await db.collection("youngs").updateMany(
      {
        inscriptionStep2023: "WAITING_CONSENT",
        parentAllowSNU: "true",
        $or: [{ parent1AllowSNU: "true" }, { parent2AllowSNU: "true" }],
      },
      {
        $set: { inscriptionStep2023: "DONE" },
      },
    );
    await db.collection("youngs").updateMany(
      {
        reinscriptionStep2023: "WAITING_CONSENT",
        parentAllowSNU: "true",
        $or: [{ parent1AllowSNU: "true" }, { parent2AllowSNU: "true" }],
      },
      {
        $set: { reinscriptionStep2023: "DONE" },
      },
    );
  },
};