1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-25 23:09:22 +00:00

Export the list of conversations

This commit is contained in:
Pierre HUBERT 2020-03-26 13:09:15 +01:00
parent 58877e0100
commit 653b066a3a
4 changed files with 12 additions and 2 deletions

View File

@ -252,7 +252,11 @@ export class AccountController {
movies: data.movies.map(MoviesController.MovieToAPI), movies: data.movies.map(MoviesController.MovieToAPI),
// Conversations messages // Conversations messages
all_conversation_messages: data.conversationMessages.map(ConversationsController.ConversationMessageToAPI) all_conversation_messages: data.conversationMessages.map(ConversationsController.ConversationMessageToAPI),
// Conversations list
conversations_list: data.conversations.map(ConversationsController.ConversationToAPI),
}; };

View File

@ -377,7 +377,7 @@ export class ConversationsController {
* *
* @param c * @param c
*/ */
private static ConversationToAPI(c : Conversation) : any { public static ConversationToAPI(c : Conversation) : any {
return { return {
ID: c.id, ID: c.id,
ID_owner: c.ownerID, ID_owner: c.ownerID,

View File

@ -11,6 +11,7 @@ import { UserLike } from "./UserLike";
import { SurveyResponse } from "./SurveyResponse"; import { SurveyResponse } from "./SurveyResponse";
import { Movie } from "./Movie"; import { Movie } from "./Movie";
import { ConversationMessage } from "./ConversationMessage"; import { ConversationMessage } from "./ConversationMessage";
import { Conversation } from "./Conversation";
export interface AccountExportBuilder { export interface AccountExportBuilder {
userID: number; userID: number;
@ -21,6 +22,7 @@ export interface AccountExportBuilder {
surveyResponses: SurveyResponse[]; surveyResponses: SurveyResponse[];
movies: Movie[]; movies: Movie[];
conversationMessages: ConversationMessage[]; conversationMessages: ConversationMessage[];
conversations: Conversation[];
} }
export class AccountExport implements AccountExportBuilder { export class AccountExport implements AccountExportBuilder {
@ -32,6 +34,7 @@ export class AccountExport implements AccountExportBuilder {
surveyResponses: SurveyResponse[]; surveyResponses: SurveyResponse[];
movies: Movie[]; movies: Movie[];
conversationMessages: ConversationMessage[]; conversationMessages: ConversationMessage[];
conversations: Conversation[];
public constructor(info: AccountExportBuilder) { public constructor(info: AccountExportBuilder) {
for (const key in info) { for (const key in info) {

View File

@ -410,6 +410,9 @@ export class AccountHelper {
// Conversation messages // Conversation messages
conversationMessages: await ConversationsHelper.ExportAllMessages(userID), conversationMessages: await ConversationsHelper.ExportAllMessages(userID),
// Conversations list
conversations: await ConversationsHelper.GetListUser(userID),
}) })