Fix a bunch of EF issues

I don't fully understand the issue that was present before, so this is
more of a workaround than a real fix.
This commit is contained in:
Amelia 2025-05-07 23:37:19 +02:00
parent 697a3bb52b
commit 4b13802301
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
10 changed files with 44 additions and 13 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
@ -57,6 +58,17 @@ public class PersonController : BaseApiController
return Ok(await _unitOfWork.PersonRepository.GetRolesForPersonByName(personId, User.GetUserId()));
}
[HttpGet("aliases")]
public async Task<ActionResult<IList<string>>> GetAliasesForPerson([FromQuery] int personId)
{
var person = await _unitOfWork.PersonRepository.GetPersonById(personId);
if (person == null) return NotFound();
if (person.Aliases == null || person.Aliases.Count == 0) return new List<string>();
return Ok(person.Aliases.Select(a => a.Alias).ToList());
}
/// <summary>
/// Returns a list of authors and artists for browsing
/// </summary>