Don't load all people for search, display series being merged in
This commit is contained in:
parent
940fe80609
commit
39b6382467
6 changed files with 44 additions and 8 deletions
|
|
@ -67,6 +67,8 @@ public interface IPersonRepository
|
|||
/// <returns></returns>
|
||||
Task<IList<Person>> GetPeopleByNames(List<string> normalizedNames, PersonIncludes includes = PersonIncludes.Aliases);
|
||||
Task<Person?> GetPersonByAniListId(int aniListId, PersonIncludes includes = PersonIncludes.Aliases);
|
||||
|
||||
Task<IList<Person>> SearchPeople(string query, PersonIncludes includes = PersonIncludes.Aliases);
|
||||
}
|
||||
|
||||
public class PersonRepository : IPersonRepository
|
||||
|
|
@ -303,6 +305,15 @@ public class PersonRepository : IPersonRepository
|
|||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IList<Person>> SearchPeople(string query, PersonIncludes includes = PersonIncludes.Aliases)
|
||||
{
|
||||
return await _context.Person
|
||||
.Includes(includes)
|
||||
.Where(p => EF.Functions.Like(p.Name, $"%{query}%")
|
||||
|| p.Aliases.Any(pa => EF.Functions.Like(pa.Alias, $"%{query}%")))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IList<Person>> GetAllPeople(PersonIncludes includes = PersonIncludes.Aliases)
|
||||
{
|
||||
return await _context.Person
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue