Display aliases in the UI, allow adding and removing aliases from the Person Edit modal

Adds forgotten translation string
This commit is contained in:
Amelia 2025-05-06 19:51:28 +02:00
parent c36123a58f
commit d1c5f4a377
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
21 changed files with 228 additions and 18 deletions

View file

@ -49,7 +49,7 @@ public interface IPersonRepository
/// <param name="name"></param>
/// <param name="includes"></param>
/// <returns></returns>
Task<Person?> GetPersonByNameAsync(string name, PersonIncludes includes = PersonIncludes.Aliases);
Task<Person?> GetPersonByNameOrAliasAsync(string name, PersonIncludes includes = PersonIncludes.Aliases);
Task<bool> IsNameUnique(string name);
Task<IEnumerable<SeriesDto>> GetSeriesKnownFor(int personId);
@ -235,7 +235,7 @@ public class PersonRepository : IPersonRepository
.FirstOrDefaultAsync();
}
public Task<Person?> GetPersonByNameAsync(string name, PersonIncludes includes = PersonIncludes.Aliases)
public Task<Person?> GetPersonByNameOrAliasAsync(string name, PersonIncludes includes = PersonIncludes.Aliases)
{
var normalized = name.ToNormalized();
return _context.Person
@ -246,7 +246,10 @@ public class PersonRepository : IPersonRepository
public async Task<bool> IsNameUnique(string name)
{
return !(await _context.Person.AnyAsync(p => p.Name == name));
// Should this use Normalized to check?
return !(await _context.Person
.Includes(PersonIncludes.Aliases)
.AnyAsync(p => p.Name == name || p.Aliases.Any(pa => pa.Alias == name)));
}
public async Task<IEnumerable<SeriesDto>> GetSeriesKnownFor(int personId)