From e592a8979c96a5c03f5280eee21522b52329142b Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Thu, 11 Feb 2021 16:07:11 +0100
Subject: [PATCH] feat: add user structure delete

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

diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts
index 810442b27..f43626a2a 100644
--- a/src/structures/services/structures.service.ts
+++ b/src/structures/services/structures.service.ts
@@ -235,9 +235,9 @@ export class StructuresService {
   private anonymizeStructure(structure: StructureDocument): StructureDocument {
     structure.contactPhone = '';
     structure.contactMail = '';
-    structure.facebook = '';
-    structure.twitter = '';
-    structure.instagram = '';
+    structure.facebook = null;
+    structure.twitter = null;
+    structure.instagram = null;
     structure.website = '';
     return structure;
   }
diff --git a/src/structures/structures.controller.ts b/src/structures/structures.controller.ts
index c3fb6ef64..6354084b0 100644
--- a/src/structures/structures.controller.ts
+++ b/src/structures/structures.controller.ts
@@ -89,7 +89,7 @@ export class StructuresController {
   }
 
   @Delete(':id')
-  @UseGuards(JwtAuthGuard, RolesGuard)
+  @UseGuards(JwtAuthGuard, IsStructureOwnerGuard)
   @Roles('admin')
   @ApiParam({ name: 'id', type: String, required: true })
   public async delete(@Param('id') id: string) {
-- 
GitLab