From ee0e3ad3d8383a2e6c60a62425836f0667d835eb Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Thu, 4 Feb 2021 18:25:44 +0100
Subject: [PATCH] fix(form) : fix update properties

---
 src/structures/services/structures.service.ts | 2 +-
 src/structures/structures.controller.ts       | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts
index 6fc689024..ee7232034 100644
--- a/src/structures/services/structures.service.ts
+++ b/src/structures/services/structures.service.ts
@@ -298,7 +298,7 @@ export class StructuresService {
     this.mailerService.send(userEmail, jsonConfig.subject, html);
   }
 
-  public async updateAfterOwnerVerify(emailUser: string): Promise<Structure> {
+  public async updateAccountVerified(idStructure: string, emailUser: string): Promise<Structure> {
     const user = await this.userService.findOne(emailUser);
     const structureLinked = await this.findOne(user.structuresLink[0]);
     const structure = new this.structureModel(structureLinked);
diff --git a/src/structures/structures.controller.ts b/src/structures/structures.controller.ts
index 748493ee0..16d68f7e9 100644
--- a/src/structures/structures.controller.ts
+++ b/src/structures/structures.controller.ts
@@ -27,8 +27,11 @@ export class StructuresController {
   }
 
   @Put('updateAfterOwnerVerify/:id')
-  public async updateAfterOwnerVerify(@Param('id') id: string, @Body() body: structureDto): Promise<Structure> {
-    return this.structureService.update(id, body);
+  public async updateAfterOwnerVerify(
+    @Param('id') id: string,
+    @Body() body: { emailUser: string }
+  ): Promise<Structure> {
+    return this.structureService.updateAccountVerified(id, body.emailUser);
   }
 
   @Put(':id')
-- 
GitLab