diff --git a/docker-compose.yml b/docker-compose.yml index c35a22a19525362e2d78135b483fd402ea39106f..dfd119ce1f86adfc3325c9df0a879ce89bd1b53f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,8 @@ version: '2' services: service-ram: - image: registry.forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server:dev + image: registry.forge.grandlyon.com/web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server:dev + container_name: resin-back ports: - ${SERVICE_API_BIND_PORT}:3000 extra_hosts: @@ -35,6 +36,7 @@ services: database-ram: image: bitnami/mongodb:4.2.3 user: root + container_name: resin-db environment: MONGODB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD} MONGODB_USERNAME: ${MONGO_NON_ROOT_USERNAME} @@ -50,7 +52,8 @@ services: mongo-express: image: mongo-express - restart: unless-stopped + restart: unless-stopped + container_name: resin-mongo-express depends_on: - database-ram networks: @@ -67,6 +70,7 @@ services: ghost: image: ghost:latest restart: always + container_name: resin-ghost ports: - ${GHOST_PORT}:2368 environment: @@ -78,11 +82,14 @@ services: database__connection__database: ghost # this url value is just an example, and is likely wrong for your environment! url: http://localhost:${GHOST_PORT} + depends_on: + - ghost-db volumes: - ghost-content:/var/lib/ghost/content ghost-db: image: mysql:5.7 + container_name: resin-ghost-db restart: always environment: MYSQL_ROOT_PASSWORD: ${GHOST_DB_PASSWORD} @@ -92,6 +99,7 @@ services: es01: image: elasticsearch:7.16.2 restart: unless-stopped + container_name: resin-es environment: node.name: es01 cluster.name: es-docker-cluster @@ -108,7 +116,7 @@ services: kib01: image: docker.elastic.co/kibana/kibana:7.6.1 restart: unless-stopped - container_name: kib01 + container_name: resin-kib ports: - ${KIBANA_PORT}:5601 environment: diff --git a/src/structures/services/structure.service.spec.ts b/src/structures/services/structure.service.spec.ts index 567946859a7ffc47c1e1f3d2fad064dfda6c068b..5f3b0a28c9e58477075b93cb6a1be64f764d03a3 100644 --- a/src/structures/services/structure.service.spec.ts +++ b/src/structures/services/structure.service.spec.ts @@ -428,7 +428,7 @@ describe('StructuresService', () => { updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)', dataShareConsentDate: new Date(), } as StructureDocument); - let res = await service.getAllDataConsentPendingStructures(user); + const res = await service.getAllDataConsentPendingStructures(user); expect(res.length).toBe(1); }); it('should get no consent', async () => { @@ -478,7 +478,7 @@ describe('StructuresService', () => { updatedAt: 'Thu Jan 20 2022 10:06:19 GMT+0100 (heure normale d’Europe centrale)', dataShareConsentDate: new Date(), } as StructureDocument); - let res = await service.getAllDataConsentPendingStructures(user); + const res = await service.getAllDataConsentPendingStructures(user); expect(res.length).toBe(0); }); }); diff --git a/src/structures/services/structures-search.service.spec.ts b/src/structures/services/structures-search.service.spec.ts index ed226632d31a01e424d865f37166a39a6a61679d..67fd4e9ae58f0daedcadbcaa0ee594f642eb31d4 100644 --- a/src/structures/services/structures-search.service.spec.ts +++ b/src/structures/services/structures-search.service.spec.ts @@ -49,7 +49,7 @@ describe('StructuresSearchService', () => { // wait for the new structures to be indexed before search await service.refreshIndexStructure(); // but we still need to wait the refresh to be done - await new Promise((r) => setTimeout(r, 1000)); + await new Promise((r) => setTimeout(r, 2000)); }); it('should find maisons de la métropole', async () => { diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts index b16568d30ce962f5a49e793ba01935bc21e1427a..12a67717e33f2826692f9331678f5398516671f0 100644 --- a/src/structures/services/structures.service.ts +++ b/src/structures/services/structures.service.ts @@ -410,42 +410,6 @@ export class StructuresService { }); } - /** - * Count every value occurence of a given key - * @param key structure key - * @return [{id: 'key', count: 'value'}] - */ - public async countByStructureKey(key: string, selected: { id: string; text: string }[]): Promise<any> { - const uniqueElements = await this.structureModel.distinct(key).exec(); - return Promise.all( - uniqueElements.map(async (value) => { - const keyList: FilterQuery<DocumentDefinition<StructureDocument>>[] = []; - keyList.push({ - [key]: { $elemMatch: { $eq: value } }, - deletedAt: { $exists: false }, - accountVerified: true, - }); - if (selected && selected.length > 0) { - for (const val of selected) { - keyList.push({ - [val.text]: { $elemMatch: { $eq: val.id } }, - deletedAt: { $exists: false }, - accountVerified: true, - }); - } - } - return { - id: value, - count: await this.structureModel - .countDocuments({ - $and: keyList, - }) - .exec(), - }; - }) - ); - } - public getCoord(numero: string, address: string, zipcode: string): Observable<AxiosResponse<any>> { const req = 'https://download.data.grandlyon.com/geocoding/photon/api?q=' + numero + ' ' + address + ' ' + zipcode; Logger.log(`getCoord - Request : ${req}`, 'StructureService'); diff --git a/src/structures/structures.controller.spec.ts b/src/structures/structures.controller.spec.ts index 6404d10cfc171e8fb445d71d1025788a0c7ca78d..2f569d8fab0d59fe9db936a06367bf8b82129e3a 100644 --- a/src/structures/structures.controller.spec.ts +++ b/src/structures/structures.controller.spec.ts @@ -143,11 +143,6 @@ describe('AuthController', () => { expect(res).toBeTruthy(); }); - it('should count', async () => { - const res = controller.countCategories([{ id: 'equipmentsAndServices', text: 'wifiEnAccesLibre' }]); - expect(res).toBeTruthy(); - }); - it('should search an address', async () => { const res = controller.searchAddress({ searchQuery: 'Rue Alphonse Daudet' }); expect(res).toBeTruthy(); diff --git a/src/structures/structures.controller.ts b/src/structures/structures.controller.ts index 24b25f37daa728f15f970c6a4fff115edd57d9e0..db0d06286aebc30ef1eb4231e4ba94f2c6317e37 100644 --- a/src/structures/structures.controller.ts +++ b/src/structures/structures.controller.ts @@ -119,30 +119,6 @@ export class StructuresController { return this.userService.updateStructureLinkedClaim(user.email, idStructure, structure); } - @Post('count') - public async countCategories( - @Body() - selectedFilter: { id: string; text: string }[] - ): Promise<Array<{ id: string; count: number }>> { - const data = await Promise.all([ - this.structureService.countByStructureKey('proceduresAccompaniment', selectedFilter), - - this.structureService.countByStructureKey('accessRight', selectedFilter), - this.structureService.countByStructureKey('baseSkills', selectedFilter), - this.structureService.countByStructureKey('parentingHelp', selectedFilter), - this.structureService.countByStructureKey('digitalCultureSecurity', selectedFilter), - this.structureService.countByStructureKey('socialAndProfessional', selectedFilter), - - this.structureService.countByStructureKey('publicsAccompaniment', selectedFilter), - this.structureService.countByStructureKey('labelsQualifications', selectedFilter), - this.structureService.countByStructureKey('publics', selectedFilter), - this.structureService.countByStructureKey('accessModality', selectedFilter), - this.structureService.countByStructureKey('equipmentsAndServices', selectedFilter), - ]); - // Return a concat of all arrays - return data.reduce((a, b) => [...a, ...b]); - } - @Post('address') public async searchAddress(@Body() data: { searchQuery: string }) { return this.structureService.searchAddress(data); diff --git a/src/users/users.service.ts b/src/users/users.service.ts index ce0e954d6eb37a37a2f14f2da4befc9a13de3b18..632c624080b65132083f9e37583a3752edd604b2 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -223,7 +223,7 @@ export class UsersService { const html = await ejs.renderFile(ejsPath, { config, - status: status ? 'accepté' : 'refusée', + status: status ? 'acceptée' : 'refusée', name: structureName, }); this.mailerService.send(userEmail, jsonConfig.subject, html);