From a870ad24df6d34aa218202d4eeefaedd723102ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Thu, 29 Jun 2023 18:02:11 +0200
Subject: [PATCH] Model => Remove param in toJsonObject function

---
 ExpressAPI/src/controllers/Session.ts | 2 +-
 ExpressAPI/src/models/Enonce.ts       | 6 +++---
 ExpressAPI/src/models/EnonceStaff.ts  | 2 +-
 ExpressAPI/src/models/Model.ts        | 2 +-
 ExpressAPI/src/models/User.ts         | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ExpressAPI/src/controllers/Session.ts b/ExpressAPI/src/controllers/Session.ts
index fdbd800..2fd2747 100644
--- a/ExpressAPI/src/controllers/Session.ts
+++ b/ExpressAPI/src/controllers/Session.ts
@@ -44,7 +44,7 @@ class Session {
     }
 
     private async getResponse(code: number, data: any, descriptionOverride?: string): Promise<any> {
-        const profileJson = await this.profile.toJsonObject(false);
+        const profileJson = await this.profile.toJsonObject();
 
         let reasonPhrase = '';
 
diff --git a/ExpressAPI/src/models/Enonce.ts b/ExpressAPI/src/models/Enonce.ts
index 1ae10f9..2fbe0be 100644
--- a/ExpressAPI/src/models/Enonce.ts
+++ b/ExpressAPI/src/models/Enonce.ts
@@ -13,14 +13,14 @@ class Enonce extends Model {
     enonceGitlabLastInfo: string = '';
     enonceGitlabLastInfoTs: number = null;
 
-    public async toJsonObject(lightVersion: boolean): Promise<Object> {
+    public async toJsonObject(): Promise<Object> {
         const result = {
             'id'                : this.enonceID,
             'name'              : this.enonceName,
             'gitlabId'          : this.enonceGitlabId,
             'gitlabLink'        : this.enonceGitlabLink,
-            'gitlabCreationInfo': this.enonceGitlabCreationInfo,
-            'gitlabLastInfo'    : this.enonceGitlabLastInfo,
+            'gitlabCreationInfo': JSON.parse(this.enonceGitlabCreationInfo),
+            'gitlabLastInfo'    : JSON.parse(this.enonceGitlabLastInfo),
             'gitlabLastInfoTs'  : this.enonceGitlabLastInfoTs
         };
 
diff --git a/ExpressAPI/src/models/EnonceStaff.ts b/ExpressAPI/src/models/EnonceStaff.ts
index 9674081..3af23a4 100644
--- a/ExpressAPI/src/models/EnonceStaff.ts
+++ b/ExpressAPI/src/models/EnonceStaff.ts
@@ -8,7 +8,7 @@ class EnonceStaff extends Model {
     enonceID: number = null;
     userID: number = null;
 
-    public async toJsonObject(lightVersion: boolean): Promise<Object> {
+    public async toJsonObject(): Promise<Object> {
         const result = {
             'enonceID': this.enonceID,
             'userID'  : this.userID
diff --git a/ExpressAPI/src/models/Model.ts b/ExpressAPI/src/models/Model.ts
index fdb0618..96a3a96 100644
--- a/ExpressAPI/src/models/Model.ts
+++ b/ExpressAPI/src/models/Model.ts
@@ -15,7 +15,7 @@ abstract class Model extends Object {
         return result;
     }
 
-    public abstract toJsonObject(lightVersion: boolean): Promise<Object>
+    public abstract toJsonObject(): Promise<Object>
 }
 
 
diff --git a/ExpressAPI/src/models/User.ts b/ExpressAPI/src/models/User.ts
index 0cce0f7..88af3c2 100644
--- a/ExpressAPI/src/models/User.ts
+++ b/ExpressAPI/src/models/User.ts
@@ -23,7 +23,7 @@ class User extends Model {
 
     currentSession: Session = null;
 
-    public async toJsonObject(lightVersion: boolean): Promise<Object> {
+    public async toJsonObject(): Promise<Object> {
         const result = {
             'id'             : this.userID,
             'firstName'      : this.userFirstName,
-- 
GitLab