From aef43df39ee1784b9491bd850827f485cf7ab529 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 26 Mar 2020 13:29:39 +0100 Subject: [PATCH] Export the list of friends --- src/controllers/AccountController.ts | 6 +++++- src/entities/AccountExport.ts | 3 +++ src/helpers/AccountHelper.ts | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/controllers/AccountController.ts b/src/controllers/AccountController.ts index 4c69729..36a87f3 100644 --- a/src/controllers/AccountController.ts +++ b/src/controllers/AccountController.ts @@ -12,6 +12,7 @@ import { LikesController } from "./LikesController"; import { SurveyController } from "./SurveyController"; import { MoviesController } from "./MoviesController"; import { ConversationsController } from "./ConversationsController"; +import { FriendsController } from "./FriendsController"; /** * Account controller @@ -258,7 +259,10 @@ export class AccountController { conversations_list: data.conversations.map(ConversationsController.ConversationToAPI), // Conversation messages - conversation_messages: {} + conversation_messages: {}, + + // Friends list + friends_list: data.friendsList.map(f => FriendsController.FriendToAPI(f, false)) }; // Fill conversation messages entry diff --git a/src/entities/AccountExport.ts b/src/entities/AccountExport.ts index 9353a71..7924e09 100644 --- a/src/entities/AccountExport.ts +++ b/src/entities/AccountExport.ts @@ -12,6 +12,7 @@ import { SurveyResponse } from "./SurveyResponse"; import { Movie } from "./Movie"; import { ConversationMessage } from "./ConversationMessage"; import { Conversation } from "./Conversation"; +import { Friend } from "./Friend"; export interface AccountExportBuilder { userID: number; @@ -24,6 +25,7 @@ export interface AccountExportBuilder { allConversationMessages: ConversationMessage[]; conversations: Conversation[]; conversationsMessages: Map; + friendsList: Friend[]; } export class AccountExport implements AccountExportBuilder { @@ -37,6 +39,7 @@ export class AccountExport implements AccountExportBuilder { allConversationMessages: ConversationMessage[]; conversations: Conversation[]; conversationsMessages: Map; + friendsList: Friend[]; public constructor(info: AccountExportBuilder) { for (const key in info) { diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 7671672..528a92f 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -13,6 +13,7 @@ import { LikesHelper } from "./LikesHelper"; import { SurveyHelper } from "./SurveyHelper"; import { MoviesHelper } from "./MoviesHelper"; import { ConversationsHelper } from "./ConversationsHelper"; +import { FriendsHelper } from "./FriendsHelper"; /** * Account helper @@ -415,7 +416,10 @@ export class AccountHelper { conversations: await ConversationsHelper.GetListUser(userID), // Conversations messages (completed after) - conversationsMessages: new Map() + conversationsMessages: new Map(), + + // Friends + friendsList: await FriendsHelper.GetList(userID) }) // Process conversation messages