From fb6442f1716406c7a2da79e4a1cc42e23908d218 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 19 Jan 2021 15:24:39 +0800 Subject: test: Add integrated tests for search api. --- BackEnd/Timeline/Controllers/SearchController.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'BackEnd/Timeline/Controllers/SearchController.cs') diff --git a/BackEnd/Timeline/Controllers/SearchController.cs b/BackEnd/Timeline/Controllers/SearchController.cs index 915938de..dec876b6 100644 --- a/BackEnd/Timeline/Controllers/SearchController.cs +++ b/BackEnd/Timeline/Controllers/SearchController.cs @@ -28,7 +28,14 @@ namespace Timeline.Controllers _userMapper = userMapper; } + /// + /// Search timelines whose name or title contains query string case-insensitively. + /// + /// The string to contain. + /// Timelines with most related at first. [HttpGet("timelines")] + [ProducesResponseType(200)] + [ProducesResponseType(400)] public async Task>> TimelineSearch([FromQuery(Name = "q"), Required(AllowEmptyStrings = false)] string query) { var searchResult = await _service.SearchTimeline(query); @@ -36,7 +43,14 @@ namespace Timeline.Controllers return await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId()); } + /// + /// Search users whose username or nick contains query string case-insensitively. + /// + /// The string to contain. + /// Users with most related at first. [HttpGet("users")] + [ProducesResponseType(200)] + [ProducesResponseType(400)] public async Task>> UserSearch([FromQuery(Name = "q"), Required(AllowEmptyStrings = false)] string query) { var searchResult = await _service.SearchUser(query); -- cgit v1.2.3