mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Fetch likes information
This commit is contained in:
parent
03459cd3a0
commit
8bcbcfb2b3
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user