Added list of posts of a specific user

Similar to the blog handler the blog user handler routes /blogs/users/{id}. Pagination is implemented as well
This commit is contained in:
Dario Bösch
2015-05-22 17:31:30 +02:00
parent 9b169f70a7
commit 0bd75e7c59
8 changed files with 230 additions and 7 deletions

View File

@@ -43,6 +43,12 @@ feature -- Access node
Result := node_storage.blogs_count
end
blogs_count_from_user (user_id: INTEGER_64) : INTEGER_64
-- Number of nodes of type blog from user with user_id
do
Result := node_storage.blogs_count_from_user(user_id)
end
blogs_order_created_desc: LIST[CMS_NODE]
-- List of nodes ordered by creation date (descending)
do
@@ -59,6 +65,16 @@ feature -- Access node
end
blogs_from_user_order_created_desc_limited (a_user_id: INTEGER_32; a_limit:NATURAL_32; a_offset:NATURAL_32) : LIST[CMS_NODE]
-- List of nodes ordered by creation date and limited by limit and offset
local
tmp: LIST[CMS_NODE]
do
-- load all posts and add the authors to each post
Result := add_authors(node_storage.blogs_from_user_limited (a_user_id, a_limit, a_offset))
end
feature {NONE} -- Helpers
add_authors(posts: LIST[CMS_NODE]) : LIST[CMS_NODE]