From f94692210d7284a0b7319c6841bbc9e7ebf0527e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Pailharey?= <rpailharey@grandlyon.com> Date: Thu, 29 Jun 2023 13:45:25 +0200 Subject: [PATCH] feat(carto): removed "equipmentsServices" category --- scripts/data/categoriesData.js | 19 ----------- ...29200204-delete-other-services-category.ts | 33 +++++++++++++++++++ .../services-config.json | 4 +-- 3 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 src/migrations/scripts/1688029200204-delete-other-services-category.ts diff --git a/scripts/data/categoriesData.js b/scripts/data/categoriesData.js index 34f2d66cd..4f3c6b8e5 100644 --- a/scripts/data/categoriesData.js +++ b/scripts/data/categoriesData.js @@ -365,24 +365,5 @@ module.exports = { theme: 'Public', id: 'publicOthers', }, - { - modules: [ - { - id: 'donDeMateriels', - name: 'Prêt / don de matériels', - }, - { - id: 'reconditionnementsDeMateriel', - name: 'Reconditionnements de matériel', - }, - { - id: 'accesLivresInformatiques', - name: 'Accès à des revues ou livres informatiques et numériques', - }, - ], - name: 'Autres services', - theme: 'Matériel et wifi', - id: 'equipmentsServices', - }, ], }; diff --git a/src/migrations/scripts/1688029200204-delete-other-services-category.ts b/src/migrations/scripts/1688029200204-delete-other-services-category.ts new file mode 100644 index 000000000..3347dd0d1 --- /dev/null +++ b/src/migrations/scripts/1688029200204-delete-other-services-category.ts @@ -0,0 +1,33 @@ +import { Db } from 'mongodb'; +import { getDb } from '../migrations-utils/db'; + +export const up = async () => { + const db: Db = await getDb(); + await db.collection('structures').updateMany({}, { $unset: { 'categories.equipmentsServices': 1 } }); + await db.collection('categories').deleteOne({ id: 'equipmentsServices' }); + console.log('Updated : category "Autres services" removed'); +}; + +export const down = async () => { + const db: Db = await getDb(); + await db.collection('categories').insertOne({ + modules: [ + { + id: 'donDeMateriels', + name: 'Prêt / don de matériels', + }, + { + id: 'reconditionnementsDeMateriel', + name: 'Reconditionnements de matériel', + }, + { + id: 'accesLivresInformatiques', + name: 'Accès à des revues ou livres informatiques et numériques', + }, + ], + name: 'Autres services', + theme: 'Matériel et wifi', + id: 'equipmentsServices', + }); + console.log('Downgraded : category "Autres services" added'); +}; diff --git a/src/structures/services/structures-export-configs/services-config.json b/src/structures/services/structures-export-configs/services-config.json index 573960a8b..a1285ad6a 100644 --- a/src/structures/services/structures-export-configs/services-config.json +++ b/src/structures/services/structures-export-configs/services-config.json @@ -72,8 +72,8 @@ "values": ["computer", "printer", "scanner"] }, "S’équiper en matériel informatique": { - "categories": ["equipmentsServices", "solidarityMaterial"], - "values": ["donDeMateriels", "computer", "tablette", "smartphone", "telecom", "4g"] + "categories": ["solidarityMaterial"], + "values": ["computer", "tablette", "smartphone", "telecom", "4g"] }, "Créer et développer mon entreprise": { "categories": [], -- GitLab