mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-09-19 21:58:48 +00:00
Export user likes
This commit is contained in:
@@ -8,6 +8,7 @@ import { Action } from "../helpers/APILimitsHelper";
|
||||
import { UserController } from "./UserController";
|
||||
import { PostsController } from "./PostsController";
|
||||
import { CommentsController } from "./CommentsController";
|
||||
import { LikesController } from "./LikesController";
|
||||
|
||||
/**
|
||||
* Account controller
|
||||
@@ -237,6 +238,9 @@ export class AccountController {
|
||||
|
||||
// User comments
|
||||
comments: await CommentsController.CommentsToAPI(h, data.comments),
|
||||
|
||||
// User likes
|
||||
likes: data.likes.map(LikesController.UserLikeToAPI)
|
||||
};
|
||||
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import { RequestHandler } from "../entities/RequestHandler";
|
||||
import { LikesType, LikesHelper } from "../helpers/LikesHelper";
|
||||
import { UserHelper } from "../helpers/UserHelper";
|
||||
import { GroupsAccessLevel } from "../entities/Group";
|
||||
import { UserLike } from "../entities/UserLike";
|
||||
|
||||
/**
|
||||
* Likes controller
|
||||
@@ -74,4 +75,18 @@ export class LikesController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a user like entry into an API entry
|
||||
*
|
||||
* @param l The like entry
|
||||
*/
|
||||
public static UserLikeToAPI(l: UserLike) : any {
|
||||
return {
|
||||
id: l.id,
|
||||
userID: l.userID,
|
||||
time_sent: l.timeSent,
|
||||
elem_type: l.elemType,
|
||||
elem_id: l.elemId
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user