aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/TimelinePostController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-05-13 15:53:08 +0800
committercrupest <crupest@outlook.com>2021-05-13 15:53:08 +0800
commitc667c722ec081dfb651d3583236d7aa429c56941 (patch)
tree9e3da51562130f16234b6d00c210aa471d90eeed /BackEnd/Timeline/Controllers/TimelinePostController.cs
parent6b19be9d57d06d9a079ed8f947d44628421bef18 (diff)
downloadtimeline-c667c722ec081dfb651d3583236d7aa429c56941.tar.gz
timeline-c667c722ec081dfb651d3583236d7aa429c56941.tar.bz2
timeline-c667c722ec081dfb651d3583236d7aa429c56941.zip
feat: Posts pagination.
Diffstat (limited to 'BackEnd/Timeline/Controllers/TimelinePostController.cs')
-rw-r--r--BackEnd/Timeline/Controllers/TimelinePostController.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/BackEnd/Timeline/Controllers/TimelinePostController.cs b/BackEnd/Timeline/Controllers/TimelinePostController.cs
index 21d3821a..da45cbea 100644
--- a/BackEnd/Timeline/Controllers/TimelinePostController.cs
+++ b/BackEnd/Timeline/Controllers/TimelinePostController.cs
@@ -57,12 +57,14 @@ namespace Timeline.Controllers
/// <param name="timeline">The name of the timeline.</param>
/// <param name="modifiedSince">If set, only posts modified since the time will return.</param>
/// <param name="includeDeleted">If set to true, deleted post will also return.</param>
+ /// <param name="page">Page number, starting from 0. Null to get all.</param>
+ /// <param name="numberPerPage">Post number per page. Default is 20.</param>
/// <returns>The post list.</returns>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public async Task<ActionResult<List<HttpTimelinePost>>> List([FromRoute][GeneralTimelineName] string timeline, [FromQuery] DateTime? modifiedSince, [FromQuery] bool? includeDeleted)
+ public async Task<ActionResult<List<HttpTimelinePost>>> List([FromRoute][GeneralTimelineName] string timeline, [FromQuery] DateTime? modifiedSince, [FromQuery] bool? includeDeleted, [FromQuery][Range(0, int.MaxValue)] int? page, [FromQuery][Range(1, int.MaxValue)] int? numberPerPage)
{
var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
@@ -71,7 +73,7 @@ namespace Timeline.Controllers
return ForbidWithCommonResponse();
}
- var posts = await _postService.GetPostsAsync(timelineId, modifiedSince, includeDeleted ?? false);
+ var posts = await _postService.GetPostsAsync(timelineId, modifiedSince, includeDeleted ?? false, page, numberPerPage);
var result = await Map(posts);
return result;