diff options
author | crupest <crupest@outlook.com> | 2020-06-18 22:42:21 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-18 22:42:21 +0800 |
commit | ff9ac16d3ffe182d2429a6511ba61be67ed56a1c (patch) | |
tree | 57d9cdc187a94264613d8a9c119af0d6bdf37318 /Timeline | |
parent | c118855c8b03d419687fe26434afc8c0a8fc33f5 (diff) | |
download | timeline-ff9ac16d3ffe182d2429a6511ba61be67ed56a1c.tar.gz timeline-ff9ac16d3ffe182d2429a6511ba61be67ed56a1c.tar.bz2 timeline-ff9ac16d3ffe182d2429a6511ba61be67ed56a1c.zip |
Add modified since for posts.
Diffstat (limited to 'Timeline')
-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;
}
|