From 8bcbcfb2b364bb73c3b1d8c16148b0ae7429946b Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 3 Jan 2020 14:49:56 +0100 Subject: [PATCH] Fetch likes information --- src/controllers/PostsController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controllers/PostsController.ts b/src/controllers/PostsController.ts index ffd4002..2ee9c06 100644 --- a/src/controllers/PostsController.ts +++ b/src/controllers/PostsController.ts @@ -6,6 +6,7 @@ import { MoviesController } from "./MoviesController"; import { MoviesHelper } from "../helpers/MoviesHelper"; import { SurveyHelper } from "../helpers/SurveyHelper"; import { SurveyController } from "./SurveyController"; +import { LikesHelper, LikesType } from "../helpers/LikesHelper"; /** * Posts controller @@ -87,6 +88,11 @@ export class PostsController { // Survey specific data_survey: !p.hasSurvey ? null : await SurveyController.SurveyToAPI(h, await SurveyHelper.GetInfo(p.id)), + + + // Likes information + likes: await LikesHelper.Count(p.id, LikesType.POST), + userlike: h.signedIn ? await LikesHelper.IsLiking(h.getUserId(), p.id, LikesType.POST) : false, }; return data;