From 17325772183bab4376f7db9d40e0105305d0742f Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Mon, 10 May 2021 13:53:21 +0200
Subject: [PATCH] fix: add creation of ES document on apitc structure

---
 src/structures/services/aptic-structures.service.ts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/structures/services/aptic-structures.service.ts b/src/structures/services/aptic-structures.service.ts
index 87ab19d74..b0013f8fc 100644
--- a/src/structures/services/aptic-structures.service.ts
+++ b/src/structures/services/aptic-structures.service.ts
@@ -13,6 +13,7 @@ import { Address } from '../schemas/address.schema';
 import { UsersService } from '../../users/users.service';
 import { ApticCatalog } from '../schemas/aptic-catalog.schema';
 import { CategoriesFormationsService } from '../../categories/services/categories-formations.service';
+import { StructuresSearchService } from './structures-search.service';
 
 @Injectable()
 export class ApticStructuresService {
@@ -20,6 +21,7 @@ export class ApticStructuresService {
     private readonly httpService: HttpService,
     private readonly userService: UsersService,
     private readonly categoriesFormationsService: CategoriesFormationsService,
+    private structuresSearchService: StructuresSearchService,
     @InjectModel(Structure.name) private structureModel: Model<StructureDocument>
   ) {}
 
@@ -92,6 +94,7 @@ export class ApticStructuresService {
         createdStructure.socialAndProfessional = await this.setModules(structure, 'socialAndProfessional');
         createdStructure.digitalCultureSecurity = await this.setModules(structure, 'digitalCultureSecurity');
         createdStructure.save();
+        this.structuresSearchService.indexStructure(createdStructure);
         // Send admin weird structure mail
         this.verifyDuplication(createdStructure);
       }
-- 
GitLab