From 4538aa0be40316a967d6fbcbc08bc9670b9bbcf0 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 13 Feb 2021 15:46:02 +0800 Subject: feat: Add timeline manageable. --- BackEnd/Timeline/Controllers/SearchController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'BackEnd/Timeline/Controllers/SearchController.cs') diff --git a/BackEnd/Timeline/Controllers/SearchController.cs b/BackEnd/Timeline/Controllers/SearchController.cs index dec876b6..b2266c18 100644 --- a/BackEnd/Timeline/Controllers/SearchController.cs +++ b/BackEnd/Timeline/Controllers/SearchController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; +using Timeline.Entities; using Timeline.Models.Http; using Timeline.Models.Mapper; using Timeline.Services; @@ -28,6 +29,11 @@ namespace Timeline.Controllers _userMapper = userMapper; } + private Task> Map(List timelines) + { + return _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId(), this.UserHasPermission(UserPermission.AllTimelineManagement)); + } + /// /// Search timelines whose name or title contains query string case-insensitively. /// @@ -40,7 +46,7 @@ namespace Timeline.Controllers { var searchResult = await _service.SearchTimeline(query); var timelines = searchResult.Items.Select(i => i.Item).ToList(); - return await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId()); + return await Map(timelines); } /// -- cgit v1.2.3