From 02739d39730c618f54f3d46a3312a42f95766a31 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 26 Mar 2020 12:13:53 +0100 Subject: [PATCH] Export the list of movies of the user --- 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 8672e27..588fc4e 100644 --- a/src/controllers/AccountController.ts +++ b/src/controllers/AccountController.ts @@ -10,6 +10,7 @@ import { PostsController } from "./PostsController"; import { CommentsController } from "./CommentsController"; import { LikesController } from "./LikesController"; import { SurveyController } from "./SurveyController"; +import { MoviesController } from "./MoviesController"; /** * Account controller @@ -244,7 +245,10 @@ export class AccountController { likes: data.likes.map(LikesController.UserLikeToAPI), // Responses to surveys - survey_responses: data.surveyResponses.map(SurveyController.SurveyResponseToAPI) + survey_responses: data.surveyResponses.map(SurveyController.SurveyResponseToAPI), + + // User movies + movies: data.movies.map(MoviesController.MovieToAPI), }; diff --git a/src/entities/AccountExport.ts b/src/entities/AccountExport.ts index 45c0a50..cbd917c 100644 --- a/src/entities/AccountExport.ts +++ b/src/entities/AccountExport.ts @@ -9,6 +9,7 @@ import { Post } from "./Post"; import { Comment } from "./Comment"; import { UserLike } from "./UserLike"; import { SurveyResponse } from "./SurveyResponse"; +import { Movie } from "./Movies"; export interface AccountExportBuilder { userID: number; @@ -17,6 +18,7 @@ export interface AccountExportBuilder { comments: Comment[]; likes: UserLike[]; surveyResponses: SurveyResponse[]; + movies: Movie[]; } export class AccountExport implements AccountExportBuilder { @@ -26,6 +28,7 @@ export class AccountExport implements AccountExportBuilder { comments: Comment[]; likes: UserLike[]; surveyResponses: SurveyResponse[]; + movies: Movie[]; public constructor(info: AccountExportBuilder) { for (const key in info) { diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index e96a0d4..af4faf5 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -11,6 +11,7 @@ import { PostsHelper } from "./PostsHelper"; import { CommentsHelper } from "./CommentsHelper"; import { LikesHelper } from "./LikesHelper"; import { SurveyHelper } from "./SurveyHelper"; +import { MoviesHelper } from "./MoviesHelper"; /** * Account helper @@ -401,7 +402,10 @@ export class AccountHelper { likes: await LikesHelper.ExportAllUser(userID), // Export all responses of user to surveys - surveyResponses: await SurveyHelper.ExportAllUserResponses(userID) + surveyResponses: await SurveyHelper.ExportAllUserResponses(userID), + + // User movies + movies: await MoviesHelper.GetListUser(userID), })