diff --git a/.vscode/settings.json b/.vscode/settings.json index 19d56e124274e6e4bfec25d7285c8e83756fde44..48a0ad264f26a4e7356332e050af6401acb8aed3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -45,6 +45,7 @@ "aptic", "cnfs", "courriel", + "cpam", "espace", "grandlyon", "nestjs", diff --git a/src/appointment/appointment.service.spec.ts b/src/appointment/appointment.service.spec.ts index 59c881b16950e9ce5777dee66d4aab5e7620ebf3..11f6bb541e4d268e85e6b96361668a07270f39b9 100644 --- a/src/appointment/appointment.service.spec.ts +++ b/src/appointment/appointment.service.spec.ts @@ -75,7 +75,7 @@ describe('userRegistryService', () => { const res = { accompanimentType: 'RDV Conseiller Numérique', name: 'test', - onlineDemarcheType: ['Démarches Métropolitaines', 'CPAM'], + onlineDemarcheType: ['Démarches Métropolitaines'], phone: '65 65', surname: 'teztrfzegfv', structureOrientator: { structureName: 'name', structureMail: 'mail@structure.org', structurePhone: '12 34' }, diff --git a/src/appointment/dto/appointment.dto.ts b/src/appointment/dto/appointment.dto.ts index 0f6be8b4e47e6200432f9debb43a3ce9aa0a5948..ad729f2298741f60b83cbe550137ad9d741e0c1e 100644 --- a/src/appointment/dto/appointment.dto.ts +++ b/src/appointment/dto/appointment.dto.ts @@ -18,7 +18,7 @@ export class AppointmentDto { @IsNotEmpty() @ApiProperty({ - example: [{ text: 'CAF' }, { text: 'CPAM' }], + example: [{ text: 'CAF' }, { text: 'France Connect' }], }) readonly onlineDemarcheType: string[]; diff --git a/src/categories/controllers/categories.controller.spec.ts b/src/categories/controllers/categories.controller.spec.ts index cc6d7e44f84c0011efae5c204dfe4e1d27068860..f4de5777e6eaf7cabb9f81d35167fb945402ca17 100644 --- a/src/categories/controllers/categories.controller.spec.ts +++ b/src/categories/controllers/categories.controller.spec.ts @@ -42,6 +42,6 @@ describe('CategoriesAccompagnementController', () => { it('should find all accompagnements', async () => { expect((await categoriesController.findAll()).length).toBe(1); - expect((await categoriesController.findAll())[0].modules.length).toBe(8); + expect((await categoriesController.findAll())[0].modules.length).toBe(7); }); }); diff --git a/src/migrations/scripts/1695282868772-remove-cpam.ts b/src/migrations/scripts/1695282868772-remove-cpam.ts new file mode 100644 index 0000000000000000000000000000000000000000..667ec3c71ff133810a9e2d4d3d2352cddebd122d --- /dev/null +++ b/src/migrations/scripts/1695282868772-remove-cpam.ts @@ -0,0 +1,55 @@ +import { Db } from 'mongodb'; +import { getDb } from '../migrations-utils/db'; + +export const up = async () => { + const db: Db = await getDb(); + + await db.collection('categories').updateOne( + { id: 'onlineProcedures' }, + { + $pull: { modules: { id: 'cpam' } }, + } + ); + + await db.collection('categories').updateOne( + { id: 'onlineProcedures', 'modules.id': 'health' }, + { + $set: { 'modules.$.name': 'Santé (Ameli, CPAM...)' }, + } + ); + + // Iterate through cpam structures, remove cpam from onlineProcedures and add health if not already present + const cursor = db.collection('structures').find({ 'categories.onlineProcedures': 'cpam' }); + let cpamStructure; + while ((cpamStructure = await cursor.next())) { + const updatedOnlineProcedures = cpamStructure.categories.onlineProcedures.filter((item) => item !== 'cpam'); + + if (!updatedOnlineProcedures.includes('health')) { + updatedOnlineProcedures.push('health'); + } + + await db + .collection('structures') + .updateOne({ _id: cpamStructure._id }, { $set: { 'categories.onlineProcedures': updatedOnlineProcedures } }); + } + console.log('Updated : replace cpam online procedure with health'); +}; + +export const down = async () => { + const db: Db = await getDb(); + + await db.collection('categories').updateOne( + { id: 'onlineProcedures' }, + { + $push: { modules: { id: 'cpam', name: 'CPAM' } }, + } + ); + + await db.collection('categories').updateOne( + { id: 'onlineProcedures', 'modules.id': 'health' }, + { + $set: { 'modules.$.name': 'Santé (Ameli...)' }, + } + ); + console.log('Downgraded : added cpam online procedure and renamed health'); +}; diff --git a/src/online-mediation/onlineMediation.service.spec.ts b/src/online-mediation/onlineMediation.service.spec.ts index cb0deafa2d03a12bb46b2d20b8c66a5f33720b29..264fd8e4a92924cb115ea05c3da0236e9bdc5436 100644 --- a/src/online-mediation/onlineMediation.service.spec.ts +++ b/src/online-mediation/onlineMediation.service.spec.ts @@ -70,7 +70,7 @@ describe('userRegistryService', () => { accompanimentType: 'RDV Conseiller Numérique', dateSlot: { day: 'Vendredi', hours: '15h00-17h00' }, name: 'test', - onlineDemarcheType: ['Démarches Métropolitaines', 'CPAM'], + onlineDemarcheType: ['Démarches Métropolitaines'], phone: '65 65', surname: 'teztrfzegfv', preferredLanguage: 'Français', diff --git a/src/structures/services/structures-export-configs/services-config.json b/src/structures/services/structures-export-configs/services-config.json index a1285ad6ac6f43cd9e0afa43a36a30698d0e328e..a38a529d8ecd78fc6d7d9dd9b84e4a3e966dfa43 100644 --- a/src/structures/services/structures-export-configs/services-config.json +++ b/src/structures/services/structures-export-configs/services-config.json @@ -3,7 +3,6 @@ "categories": ["onlineProcedures"], "values": [ "caf", - "cpam", "idDoc", "needs", "foreigners", @@ -20,7 +19,6 @@ "categories": ["onlineProcedures"], "values": [ "caf", - "cpam", "idDoc", "needs", "foreigners", @@ -85,7 +83,7 @@ }, "Accompagner les démarches de santé": { "categories": ["onlineProcedures"], - "values": ["cpam", "health"] + "values": ["health"] }, "Promouvoir la citoyenneté numérique": { "categories": ["advancedSkills"], diff --git a/src/structures/services/structures.service.spec.ts b/src/structures/services/structures.service.spec.ts index 35bcecba7314ce3f0717eebafac57fd70016ee9a..2836627dcca9f7de919c592c4a4b3af026d5ed40 100644 --- a/src/structures/services/structures.service.spec.ts +++ b/src/structures/services/structures.service.spec.ts @@ -63,7 +63,7 @@ const mockStructuresSearchService = { 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: ['cpam', 'impots', 'carsat', 'poleEmploi'], + proceduresAccompaniment: ['impots', 'carsat', 'poleEmploi'], publics: ['toutPublic'], labelsQualifications: ['passNumerique', 'espacePublicNumeriqueepn'], accessModality: ['accesLibre', 'telephoneVisio', 'surRdv'], @@ -310,7 +310,7 @@ describe('StructuresService', () => { 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: ['cpam', 'impots', 'carsat', 'poleEmploi'], + proceduresAccompaniment: ['impots', 'carsat', 'poleEmploi'], publics: ['toutPublic'], labelsQualifications: ['passNumerique', 'espacePublicNumeriqueepn'], accessModality: ['accesLibre', 'telephoneVisio', 'surRdv'], diff --git a/src/structures/structures.controller.spec.ts b/src/structures/structures.controller.spec.ts index f58b6277f26da72f91365848f23031be21151199..7ab3ff58118c54f8c78228a3521e257510b4f11f 100644 --- a/src/structures/structures.controller.spec.ts +++ b/src/structures/structures.controller.spec.ts @@ -311,7 +311,7 @@ describe('StructuresController', () => { mockUsersService.getPersonalOfferInStructure.mockReturnValue({ _id: '2345ba0e2ab5775cfc01ed4d', categories: { - onlineProcedures: ['caf', 'cpam'], + onlineProcedures: ['caf'], baseSkills: [], advancedSkills: [], }, diff --git a/src/users/services/employer-search.service.spec.ts b/src/users/services/employer-search.service.spec.ts index 3c6715978dda55e34e49608a5629b1bd1df1fa42..435428dee0036b8dc65527fa82f07ced79c32f56 100644 --- a/src/users/services/employer-search.service.spec.ts +++ b/src/users/services/employer-search.service.spec.ts @@ -18,17 +18,17 @@ const employers = [ } as EmployerDocument, { _id: new Types.ObjectId('6231aefe76598527c8d0b5bd'), - name: 'CAF', + name: 'CGI', validated: true, } as EmployerDocument, { _id: new Types.ObjectId('6231aefe76598527c8d0b5be'), - name: 'CARSAT', + name: 'Decathlon', validated: true, } as EmployerDocument, { _id: new Types.ObjectId('6231aefe76598527c8d0b5bf'), - name: 'CPAM', + name: 'Apollo', validated: true, } as EmployerDocument, ]; @@ -63,14 +63,14 @@ describe('EmployerSearchService Search cases', () => { // await new Promise((r) => setTimeout(r, 2000)); // }, 10000); - it('should find CARSAT', async () => { - const res = await employerSearchService.search('CARSAT'); - expect(res[0].name).toBe('CARSAT'); + it('should find Metro', async () => { + const res = await employerSearchService.search('Metro'); + expect(res[0].name).toBe('Metro'); expect(res.length).toBe(1); }); - it('should find CAF', async () => { - const res = await employerSearchService.search('CAF'); - expect(res[0].name).toBe('CAF'); + it('should find Sopra', async () => { + const res = await employerSearchService.search('Sopra'); + expect(res[0].name).toBe('Sopra'); expect(res.length).toBe(1); }); @@ -82,18 +82,18 @@ describe('EmployerSearchService Search cases', () => { }); it('should update index', async () => { - const resCaf = await employerSearchService.search('CAF'); + const resCaf = await employerSearchService.search('Metro'); const res = await employerSearchService.update( resCaf[0] as EmployerDocument, - new Types.ObjectId('6231aefe76598527c8d0b5bd').toHexString() + new Types.ObjectId('6231aefe76598527c8d0b5ba').toHexString() ); expect(res).toBeTruthy(); }); it('should delete index', async () => { - const resCaf = await employerSearchService.search('CAF'); + const resCaf = await employerSearchService.search('Metro'); const res = await employerSearchService.deleteIndex( resCaf[0] as EmployerDocument, - new Types.ObjectId('6231aefe76598527c8d0b5bd').toHexString() + new Types.ObjectId('6231aefe76598527c8d0b5ba').toHexString() ); expect(res).toBeTruthy(); }); diff --git a/test/mock/data/appointment.mock.data.ts b/test/mock/data/appointment.mock.data.ts index 79904f88cbf89f12d89c3ed3c0d4b1daa0f0ca78..712ce1eedc973c54e5e2f8d29e434fcffebaa84e 100644 --- a/test/mock/data/appointment.mock.data.ts +++ b/test/mock/data/appointment.mock.data.ts @@ -10,7 +10,7 @@ export const appointmentMockData: IAppointment[] = [ __v: 0, }, { - onlineDemarcheType: ['CPAM', 'CARSAT'], + onlineDemarcheType: ['CARSAT'], _id: '6350fb490e75215f13f9f20c', name: 'czac', surname: 'cfezcfzc', diff --git a/test/mock/data/gouvStructures.mock.data.ts b/test/mock/data/gouvStructures.mock.data.ts index f5a54c3a63b4ff8de6ac1f8a790c7c8ec09e5064..ea84f0a899ed95c2a5a21b90b5c0621726c33e3f 100644 --- a/test/mock/data/gouvStructures.mock.data.ts +++ b/test/mock/data/gouvStructures.mock.data.ts @@ -49,7 +49,6 @@ export const mockGouvStructureToResinFormat = new Structure({ accessModality: ['accesLibre'], onlineProcedures: [ 'caf', - 'cpam', 'idDoc', 'needs', 'foreigners', diff --git a/test/mock/data/onlineMediation.mock.data.ts b/test/mock/data/onlineMediation.mock.data.ts index 2fcf49bf7d87ff2a1851d71a2472a91870f067b1..f428e444ba199697d6969e48241e54aaee851994 100644 --- a/test/mock/data/onlineMediation.mock.data.ts +++ b/test/mock/data/onlineMediation.mock.data.ts @@ -16,7 +16,7 @@ export const onlineMediationMockData: IOnlineMediation[] = [ __v: 0, }, { - onlineDemarcheType: ['CPAM', 'CARSAT'], + onlineDemarcheType: ['CARSAT'], _id: '6350fb490e75215f13f9f20c', name: 'czac', surname: 'cfezcfzc', diff --git a/test/mock/data/personalOffers.mock.data.ts b/test/mock/data/personalOffers.mock.data.ts index 6af1b99d97b15e777ba14f65ff5c1875b739af9b..181622e1eda4f9258d3b8c60841e0dacb353878e 100644 --- a/test/mock/data/personalOffers.mock.data.ts +++ b/test/mock/data/personalOffers.mock.data.ts @@ -5,7 +5,7 @@ import { PersonalOffer } from '../../../src/personal-offers/schemas/personal-off export const personalOffersDtoDataMock: PersonalOfferDto[] = [ { categories: { - onlineProcedures: ['caf', 'cpam'], + onlineProcedures: ['caf'], baseSkills: [], advancedSkills: [], }, @@ -18,7 +18,6 @@ export const personalOffersDtoDataMock: PersonalOfferDto[] = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -77,7 +76,6 @@ export const updatePersonalOffersDtoDataMock: PersonalOfferDto[] = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -98,7 +96,7 @@ export const personalOffersDataMock: PersonalOffer[] = [ { _id: '1234ba0e2ab5775cfc01ed3e', categories: { - onlineProcedures: ['caf', 'cpam'], + onlineProcedures: ['caf'], baseSkills: [], advancedSkills: [], }, @@ -114,7 +112,6 @@ export const personalOffersDataMock: PersonalOffer[] = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', diff --git a/test/mock/data/structures.mock.data.ts b/test/mock/data/structures.mock.data.ts index 29daeb29a706d23e01fabbec3a979db2b2276223..5e9d892693c63bc67ab7b721a3c21950b68cb05a 100644 --- a/test/mock/data/structures.mock.data.ts +++ b/test/mock/data/structures.mock.data.ts @@ -258,7 +258,6 @@ export const mockStructureDocument = ({ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -371,7 +370,6 @@ export const mockStructure: Structure = { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -505,7 +503,6 @@ export const mockDeletedStructure: Structure = { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', diff --git a/test/mock/services/categories.mock.service.ts b/test/mock/services/categories.mock.service.ts index 1027ce5382aaf154140640831eb0e9fe6836135b..f02103c5ae377025f889a0af63ebebd57893246b 100644 --- a/test/mock/services/categories.mock.service.ts +++ b/test/mock/services/categories.mock.service.ts @@ -29,10 +29,6 @@ export class CategoriesServiceMock { id: 'poleEmploi', text: 'Pôle Emploi', }, - { - id: 'cpam', - text: 'CPAM', - }, { id: 'impots', text: 'Impôts', diff --git a/test/mock/services/structures.mock.service.ts b/test/mock/services/structures.mock.service.ts index ea3114fe841bd723152ec6d2242ec8dbac82fd6b..46b2b12c0badb401292181902d6848fa8bea692b 100644 --- a/test/mock/services/structures.mock.service.ts +++ b/test/mock/services/structures.mock.service.ts @@ -30,7 +30,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -135,7 +134,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -286,7 +284,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -371,7 +368,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -526,7 +522,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -628,7 +623,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -735,7 +729,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -838,7 +831,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -946,7 +938,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -1050,7 +1041,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -1243,7 +1233,6 @@ export class StructuresServiceMock { 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -1517,7 +1506,6 @@ export const mockResinStructures: Array<Structure> = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -1623,7 +1611,6 @@ export const mockResinStructures: Array<Structure> = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect', @@ -1729,7 +1716,6 @@ export const mockResinStructures: Array<Structure> = [ 'health', 'work', 'caf', - 'cpam', 'foreigners', 'needs', 'franceConnect',