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:
parent
697a3bb52b
commit
4b13802301
10 changed files with 44 additions and 13 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue