mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Move mapping assignment to Map
This commit is contained in:
parent
e137a06362
commit
7abb94d8a2
@ -43,18 +43,6 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
|
|||||||
if (!filter.ItemId.IsEmpty())
|
if (!filter.ItemId.IsEmpty())
|
||||||
{
|
{
|
||||||
dbQuery = dbQuery.Include(p => p.BaseItems!.Where(m => m.ItemId == filter.ItemId));
|
dbQuery = dbQuery.Include(p => p.BaseItems!.Where(m => m.ItemId == filter.ItemId));
|
||||||
|
|
||||||
return dbQuery
|
|
||||||
.AsEnumerable()
|
|
||||||
.Select(p =>
|
|
||||||
{
|
|
||||||
var personInfo = Map(p);
|
|
||||||
var mapping = p.BaseItems?.FirstOrDefault();
|
|
||||||
personInfo.Role = mapping?.Role;
|
|
||||||
personInfo.SortOrder = mapping?.SortOrder;
|
|
||||||
return personInfo;
|
|
||||||
})
|
|
||||||
.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbQuery.AsEnumerable().Select(Map).ToArray();
|
return dbQuery.AsEnumerable().Select(Map).ToArray();
|
||||||
@ -111,10 +99,13 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
|
|||||||
|
|
||||||
private PersonInfo Map(People people)
|
private PersonInfo Map(People people)
|
||||||
{
|
{
|
||||||
|
var mapping = people.BaseItems?.FirstOrDefault();
|
||||||
var personInfo = new PersonInfo()
|
var personInfo = new PersonInfo()
|
||||||
{
|
{
|
||||||
Id = people.Id,
|
Id = people.Id,
|
||||||
Name = people.Name,
|
Name = people.Name,
|
||||||
|
Role = mapping?.Role,
|
||||||
|
SortOrder = mapping?.SortOrder
|
||||||
};
|
};
|
||||||
if (Enum.TryParse<PersonKind>(people.PersonType, out var kind))
|
if (Enum.TryParse<PersonKind>(people.PersonType, out var kind))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user