From b87abbb8ed0aa86a808b2f97e4d22b0ee1addd9f Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 29 Apr 2021 19:29:35 +0800 Subject: ... --- BackEnd/Timeline/Services/Api/SearchService.cs | 55 +------------------------- 1 file changed, 2 insertions(+), 53 deletions(-) (limited to 'BackEnd/Timeline/Services/Api/SearchService.cs') diff --git a/BackEnd/Timeline/Services/Api/SearchService.cs b/BackEnd/Timeline/Services/Api/SearchService.cs index eec5001f..037f0490 100644 --- a/BackEnd/Timeline/Services/Api/SearchService.cs +++ b/BackEnd/Timeline/Services/Api/SearchService.cs @@ -1,62 +1,11 @@ using Microsoft.EntityFrameworkCore; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Timeline.Entities; namespace Timeline.Services.Api { - public class SearchResultItem - { - public SearchResultItem(TItem item, int score) - { - Item = item; - Score = score; - } - - public TItem Item { get; set; } = default!; - - /// - /// Bigger is better. - /// - public int Score { get; set; } - } - - public class SearchResult - { -#pragma warning disable CA2227 // Collection properties should be read only - public List> Items { get; set; } = new(); -#pragma warning restore CA2227 // Collection properties should be read only - } - - public interface ISearchService - { - /// - /// Search timelines whose name or title contains query string. - /// - /// String to contain. - /// Search results. - /// Thrown when is null. - /// Thrown when is empty. - /// - /// Implementation should promise high score is at first. - /// - Task> SearchTimeline(string query); - - /// - /// Search users whose username or nickname contains query string. - /// - /// String to contain. - /// Search results. - /// Thrown when is null. - /// Thrown when is empty. - /// - /// Implementation should promise high score is at first. - /// - Task> SearchUser(string query); - } - public class SearchService : ISearchService { private readonly DatabaseContext _database; @@ -66,7 +15,7 @@ namespace Timeline.Services.Api _database = database; } - public async Task> SearchTimeline(string query) + public async Task> SearchTimelineAsync(string query) { if (query is null) throw new ArgumentNullException(nameof(query)); @@ -83,7 +32,7 @@ namespace Timeline.Services.Api return searchResult; } - public async Task> SearchUser(string query) + public async Task> SearchUserAsync(string query) { if (query is null) throw new ArgumentNullException(nameof(query)); -- cgit v1.2.3