Skip to content
Snippets Groups Projects
Commit a63445fc authored by Adel LAKHDAR's avatar Adel LAKHDAR
Browse files

change(structure): Change mairie struct type to commune

parent 09cd190d
No related branches found
No related tags found
2 merge requests!420V3.2.0,!400change(structure): Change mairie struct type to commune
......@@ -55,7 +55,7 @@ module.exports = {
},
{
_id: mongoose.Types.ObjectId('627b6ca899862168705ca831'),
name: 'Mairie',
name: 'Commune',
validated: true,
},
{
......
......@@ -62,7 +62,7 @@ module.exports = {
nbComputers: 5,
nbPrinters: 1,
nbScanners: 1,
structureType: 'mairie',
structureType: 'commune',
hours: {
monday: {
open: true,
......
......@@ -7,7 +7,7 @@ module.exports = {
_id: mongoose.Types.ObjectId('601c223d3f612000068d4366'),
name: 'Publique',
values: [
'mairie',
'commune',
'CAF',
'CCAS',
'CARSAT',
......
import { Db } from 'mongodb';
import { getDb } from '../migrations-utils/db';
export const up = async () => {
try {
const db: Db = await getDb();
await db.collection('structuretype').updateOne(
{ value: 'mairie' },
{ $set: { value: 'commune', name: 'Commune' } }
);
console.log('Update done in structuretype: "mairie" -> "commune"');
await db.collection('employers').updateMany(
{ name: 'Mairie' },
{ $set: { name: 'Commune' } }
);
console.log('Update done in employers: "Mairie" -> "Commune"');
await db.collection('structures').updateMany(
{ structureType: 'mairie' },
{ $set: { structureType: 'commune' } }
);
console.log('Update done in structures: "mairie" -> "Commune"');
} catch (error) {
console.error(`Error during the migration: ${error}`);
}
};
export const down = async () => {
try {
const db: Db = await getDb();
await db.collection('structuretype').updateOne(
{ value: 'commune' },
{ $set: { value: 'mairie', name: 'mairie' } }
);
console.log('Revert done in structType: "commune" -> "mairie"');
await db.collection('employers').updateMany(
{ name: 'Commune' },
{ $set: { name: 'Mairie' } }
);
console.log('Revert done in employers: "Commune" -> "Mairie"');
await db.collection('structures').updateMany(
{ structureType: 'commune' },
{ $set: { structureType: 'mairie' } }
);
console.log('Revert done in structures: "commune" -> "mairie"');
} catch (error) {
console.error(`Error during the rollback: ${error}`);
}
};
......@@ -35,7 +35,7 @@ export class StructuresForSearchServiceMock {
{
_id: '60b4b0836a9d4500313b8661',
structureName: 'Mairie (La Tour de Salvagny)',
structureType: 'mairie',
structureType: 'commune',
address: {
numero: null,
street: 'Place de la Mairie',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment