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 | 838f9377514b03404afa1d6b6e42e981174178b5 (patch) | |
tree | 6d5e383ad6f135ec40fc69f0f1fa16bfa2c56656 /Timeline/Controllers | |
parent | 135f47e7477bb2a72c423145dcd286ae494fd3ed (diff) | |
parent | 71ad72b6d3db3937a2b769fe1d64c8bb99702ba1 (diff) | |
download | timeline-838f9377514b03404afa1d6b6e42e981174178b5.tar.gz timeline-838f9377514b03404afa1d6b6e42e981174178b5.tar.bz2 timeline-838f9377514b03404afa1d6b6e42e981174178b5.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;
}
|