From ff9ac16d3ffe182d2429a6511ba61be67ed56a1c Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 18 Jun 2020 22:42:21 +0800 Subject: Add modified since for posts. --- Timeline/Controllers/TimelineController.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Timeline/Controllers/TimelineController.cs') 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>> PostListGet([FromRoute][GeneralTimelineName] string name) + public async Task>> 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>(posts); + List posts; + if (modifiedSince == null) + posts = await _service.GetPosts(name); + else + posts = await _service.GetPosts(name, modifiedSince.Value); + var result = _mapper.Map>(posts); return result; } -- cgit v1.2.3