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

Fetch likes information

This commit is contained in:
Pierre HUBERT 2020-01-03 14:49:56 +01:00
parent 03459cd3a0
commit 8bcbcfb2b3

View File

@ -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;