Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server
1 result
Show changes
Commits on Source (2)
import { Db } from 'mongodb';
import { getDb } from '../migrations-utils/db';
export const up = async () => {
try {
const db: Db = await getDb();
// Define the fields to be removed
const fieldsToRemove = [
'equipmentsAndServices',
'digitalCultureSecurity',
'parentingHelp',
'socialAndProfessional',
'accessRight',
'baseSkills',
'proceduresAccompaniment',
'publicsAccompaniment',
'publics',
'labelsQualifications',
'accessModality',
'autresAccompagnements',
'nbNumericTerminal',
'equipmentsServices',
'jaccompagneLesUsagersDansLeursDemarchesEnLigne',
'numero',
'nbTablets',
'remoteAccompaniment',
];
// Construct the update operation
const updateOperation = {
$unset: {},
};
fieldsToRemove.forEach((field) => {
updateOperation.$unset[field] = 1;
});
// Perform bulk update using updateMany
await db.collection('structures').updateMany({}, updateOperation);
console.log("Structures' data has been cleaned up");
} catch (error) {
console.error(`Migration up failed due to ${error}`);
}
};
export const down = async () => {
console.log('No downgrade possible. Erased data cannot be recreated.');
};
......@@ -14,7 +14,6 @@ export type StructureDocument = Structure & Document;
export class Structure {
constructor(data: Partial<Structure> = {}) {
this.structureName = data.structureName;
this.numero = data.numero;
this.structureType = data.structureType;
this.description = data.description;
this.address = data.address;
......@@ -46,9 +45,6 @@ export class Structure {
this.hasUserWithAppointmentDN = data.hasUserWithAppointmentDN;
}
@Prop()
numero: string;
@Prop()
@IsNotEmpty()
structureName: string;
......
......@@ -169,7 +169,6 @@ export class StructuresImportService {
exceptionalClosures: null,
facebook: null,
instagram: null,
numero: '',
twitter: null,
personalOffers: [],
otherDescription: null,
......
......@@ -55,15 +55,6 @@ const mockStructuresSearchService = {
_id: '6903ba0e2ab5775cfc01ed4d',
structureId: '6903ba0e2ab5775cfc01ed4d',
structureType: null,
digitalCultureSecurity: ['2', '5', '9', '28', '34', '39', '42', '51', '52', '54', '65', '96', '97', '98'],
parentingHelp: ['3', '22', '82', '94'],
socialAndProfessional: ['6', '20', '66', '67', '68', '69', '124', '125', '127'],
accessRight: ['84', '85', '86', '87', '88', '89', '93', '95'],
baseSkills: ['260', '1', '11', '38', '48', '74', '77'],
proceduresAccompaniment: ['impots', 'carsat', 'poleEmploi'],
publics: ['toutPublic'],
labelsQualifications: ['passNumerique', 'espacePublicNumeriqueepn'],
accessModality: ['accesLibre', 'telephoneVisio', 'surRdv'],
freeWorkShop: 'Non',
createdAt: '2020-11-16T09:30:00.000Z',
updatedAt: '2021-04-12T08:48:00.000Z',
......@@ -78,13 +69,10 @@ const mockStructuresSearchService = {
instagram: null,
pmrAccess: true,
exceptionalClosures: '',
jaccompagneLesUsagersDansLeursDemarchesEnLigne: true,
publicsAccompaniment: [],
autresAccompagnements: '',
nbComputers: 16,
nbPrinters: 1,
nbTablets: 1,
nbNumericTerminal: 1,
hours: {
monday: {
open: true,
......@@ -296,15 +284,6 @@ describe('StructuresService', () => {
structureName: "L'Atelier Numérique",
structureId: '6903ba0e2ab5775cfc01ed4d',
structureType: null,
digitalCultureSecurity: ['2', '5', '9', '28', '34', '39', '42', '51', '52', '54', '65', '96', '97', '98'],
parentingHelp: ['3', '22', '82', '94'],
socialAndProfessional: ['6', '20', '66', '67', '68', '69', '124', '125', '127'],
accessRight: ['84', '85', '86', '87', '88', '89', '93', '95'],
baseSkills: ['260', '1', '11', '38', '48', '74', '77'],
proceduresAccompaniment: ['impots', 'carsat', 'poleEmploi'],
publics: ['toutPublic'],
labelsQualifications: ['passNumerique', 'espacePublicNumeriqueepn'],
accessModality: ['accesLibre', 'telephoneVisio', 'surRdv'],
freeWorkShop: 'Non',
createdAt: '2020-11-16T09:30:00.000Z',
updatedAt: '2021-04-12T08:48:00.000Z',
......@@ -318,12 +297,8 @@ describe('StructuresService', () => {
instagram: null,
pmrAccess: true,
exceptionalClosures: '',
publicsAccompaniment: [],
autresAccompagnements: '',
nbComputers: 16,
nbPrinters: 1,
nbTablets: 1,
nbNumericTerminal: 1,
hours: {
monday: {
open: true,
......
......@@ -144,7 +144,6 @@ export const mockGouvStructureToResinFormat = new Structure({
exceptionalClosures: null,
facebook: null,
instagram: null,
numero: '',
twitter: null,
otherDescription: null,
linkedin: null,
......
......@@ -62,8 +62,6 @@ export const structuresDocumentDataMock: StructureDocument[] = [
otherDescription: null,
nbComputers: 1,
nbPrinters: 1,
nbTablets: 1,
nbNumericTerminal: 1,
nbScanners: 1,
freeWorkShop: 'Non',
accountVerified: true,
......@@ -76,16 +74,6 @@ export const structuresDocumentDataMock: StructureDocument[] = [
{
_id: '6093ba0e2ab5775cfc01ed3e',
coord: [4.8498155, 45.7514817],
digitalCultureSecurity: [],
parentingHelp: [],
socialAndProfessional: [],
accessRight: [],
baseSkills: [],
proceduresAccompaniment: [],
publicsAccompaniment: [],
publics: ['adultes'],
labelsQualifications: [],
accessModality: ['telephoneVisio'],
structureType: null,
structureName: 'a',
description: null,
......@@ -138,8 +126,6 @@ export const structuresDocumentDataMock: StructureDocument[] = [
otherDescription: null,
nbComputers: 1,
nbPrinters: 1,
nbTablets: 1,
nbNumericTerminal: 1,
nbScanners: 1,
freeWorkShop: 'Non',
accountVerified: true,
......@@ -331,7 +317,6 @@ export const mockStructureDocument = ({
accountVerified: true,
createdAt: new Date('2021-05-06T09:42:38.000Z'),
updatedAt: new Date('2021-05-06T09:42:38.000Z'),
numero: null,
remoteAccompaniment: null,
deletedAt: null,
dataShareConsentDate: null,
......@@ -340,7 +325,6 @@ export const mockStructureDocument = ({
export const mockStructure: Structure = {
coord: [4.8498155, 45.7514817],
numero: '',
createdAt: null,
dataShareConsentDate: null,
deletedAt: null,
......@@ -448,7 +432,6 @@ export const mockDeletedStructure: Structure = {
categoriesWithPersonalOffers: {},
dataShareConsentDate: new Date(2023, 1, 1),
remoteAccompaniment: true,
numero: '',
hours: {
monday: {
open: false,
......
......@@ -165,8 +165,6 @@ export class StructuresServiceMock {
instagram: null,
pmrAccess: true,
exceptionalClosures: '',
publicsAccompaniment: [],
autresAccompagnements: '',
nbComputers: 16,
nbPrinters: 1,
hours: {
......@@ -312,8 +310,6 @@ export class StructuresServiceMock {
instagram: null,
pmrAccess: true,
exceptionalClosures: '',
publicsAccompaniment: [],
autresAccompagnements: '',
nbComputers: 16,
nbPrinters: 1,
__v: 0,
......@@ -395,8 +391,6 @@ export class StructuresServiceMock {
instagram: null,
pmrAccess: true,
exceptionalClosures: '',
publicsAccompaniment: [],
autresAccompagnements: '',
nbComputers: 16,
nbPrinters: 1,
hours: {
......@@ -1115,16 +1109,6 @@ export class StructuresServiceMock {
return {
_id: '6093ba0e2ab5775cfc01ed3e',
coord: [4.8498155, 45.7514817],
digitalCultureSecurity: [],
parentingHelp: [],
socialAndProfessional: [],
accessRight: [],
baseSkills: ['260', '1', '11', '38', '48', '74', '77'],
proceduresAccompaniment: [],
publicsAccompaniment: [],
publics: ['adultes'],
labelsQualifications: [],
accessModality: ['telephoneVisio'],
structureType: null,
structureName: 'a',
description: null,
......@@ -1177,8 +1161,6 @@ export class StructuresServiceMock {
otherDescription: null,
nbComputers: 1,
nbPrinters: 1,
nbTablets: 1,
nbNumericTerminal: 1,
nbScanners: 1,
freeWorkShop: 'Non',
accountVerified: true,
......@@ -1295,7 +1277,6 @@ export class StructuresServiceMock {
personalOffers: [personalOfferDocument],
createdAt: new Date('2021-05-06T09:42:38.000Z'),
updatedAt: new Date('2021-05-06T09:42:50.000Z'),
numero: '0606060606',
remoteAccompaniment: true,
deletedAt: null,
dataShareConsentDate: null,
......@@ -1560,7 +1541,6 @@ export const mockResinStructures: Array<Structure> = [
accountVerified: true,
createdAt: new Date('2021-05-06T09:42:38.000Z'),
updatedAt: new Date('2021-05-06T09:42:50.000Z'),
numero: '',
remoteAccompaniment: false,
deletedAt: new Date('2121-05-06T09:42:38.000Z'),
dataShareConsentDate: new Date('2021-05-06T09:42:38.000Z'),
......@@ -1665,7 +1645,6 @@ export const mockResinStructures: Array<Structure> = [
personalOffers: [],
createdAt: new Date('2021-05-06T09:42:38.000Z'),
updatedAt: new Date('2021-05-06T09:42:50.000Z'),
numero: '',
remoteAccompaniment: false,
deletedAt: new Date('2121-05-06T09:42:38.000Z'),
dataShareConsentDate: new Date('2021-05-06T09:42:38.000Z'),
......@@ -1769,7 +1748,6 @@ export const mockResinStructures: Array<Structure> = [
personalOffers: [],
createdAt: new Date('2021-05-06T09:42:38.000Z'),
updatedAt: new Date('2021-05-06T09:42:50.000Z'),
numero: '',
remoteAccompaniment: false,
deletedAt: new Date('2121-05-06T09:42:38.000Z'),
dataShareConsentDate: new Date('2021-05-06T09:42:38.000Z'),
......