1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Export the list of movies of the user

This commit is contained in:
Pierre HUBERT 2020-03-26 12:13:53 +01:00
parent 7e9e35765e
commit 02739d3973
3 changed files with 13 additions and 2 deletions

View File

@ -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),
};

View File

@ -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) {

View File

@ -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),
})