diff options
author | crupest <crupest@outlook.com> | 2020-06-18 23:41:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-18 23:41:13 +0800 |
commit | e4ca28740d3ccdb64b61361a16bd104009682f6c (patch) | |
tree | 5f65150b65ac37d2cd3f9d04d9cde22b3c02691d /Timeline/Controllers | |
parent | 5f57f6d3f9c7bd94929f3e50915d57da7c031538 (diff) | |
parent | 35f4e03157fdb6643dc42db0cd764804e00944aa (diff) | |
download | timeline-e4ca28740d3ccdb64b61361a16bd104009682f6c.tar.gz timeline-e4ca28740d3ccdb64b61361a16bd104009682f6c.tar.bz2 timeline-e4ca28740d3ccdb64b61361a16bd104009682f6c.zip |
Merge pull request #112 from crupest/post-modified-since
Post modified since query param.
Diffstat (limited to 'Timeline/Controllers')
-rw-r--r-- | Timeline/Controllers/TimelineController.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Timeline/Controllers/TimelineController.cs b/Timeline/Controllers/TimelineController.cs index 36e9fe6d..b8cc608b 100644 --- a/Timeline/Controllers/TimelineController.cs +++ b/Timeline/Controllers/TimelineController.cs @@ -102,16 +102,20 @@ namespace Timeline.Controllers }
[HttpGet("timelines/{name}/posts")]
- public async Task<ActionResult<List<TimelinePostInfo>>> PostListGet([FromRoute][GeneralTimelineName] string name)
+ public async Task<ActionResult<List<TimelinePostInfo>>> PostListGet([FromRoute][GeneralTimelineName] string name, [FromQuery] DateTime? modifiedSince)
{
if (!this.IsAdministrator() && !await _service.HasReadPermission(name, this.GetOptionalUserId()))
{
return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
- var posts = await _service.GetPosts(name);
- var result = _mapper.Map<List<TimelinePostInfo>>(posts);
+ List<TimelinePost> posts;
+ if (modifiedSince == null)
+ posts = await _service.GetPosts(name);
+ else
+ posts = await _service.GetPosts(name, modifiedSince.Value);
+ var result = _mapper.Map<List<TimelinePostInfo>>(posts);
return result;
}
|