1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-21 00:55:17 +00:00

Get the latest posts of the user

This commit is contained in:
2020-01-04 11:30:33 +01:00
parent 8ba28a88dc
commit 25159e3718
5 changed files with 95 additions and 3 deletions

View File

@ -64,6 +64,20 @@ export class PostsController {
await this.SendMultiplePosts(h, posts);
}
/**
* Get the list of latest posts
*
* @param h Request handler
*/
public static async GetLatest(h: RequestHandler) {
const startFrom = h.postInt("startFrom", 0);
const includeGroups = h.postBool('include_groups', false);
const posts = await PostsHelper.GetLatest(h.getUserId(), startFrom, 10, includeGroups);
await this.SendMultiplePosts(h, posts);
}
/**
* Send multiple posts to the API

View File

@ -188,6 +188,8 @@ export const Routes : Route[] = [
{path: "/posts/get_group", cb: (h) => PostsController.GetListGroup(h), needLogin: false},
{path: "/posts/get_latest", cb: (h) => PostsController.GetLatest(h)},
// Notifications controller