mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 03:24:04 +00:00 
			
		
		
		
	Get the latest posts of the user
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user