Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed code for getting members with roles and libraries

Joseph Milazzofbe2daac6a93
diff --git a/API/Data/UserRepository.cs b/API/Data/UserRepository.cs
index 55a382654..6c63d31b9 100644
--- a/API/Data/UserRepository.cs
+++ b/API/Data/UserRepository.cs
@@ -68,16 +68,16 @@ namespace API.Data
Username = u.UserName,
Created = u.Created,
LastActive = u.LastActive,
- Roles = u.UserRoles.Select(r => r.Role.Name).ToList()
+ Roles = u.UserRoles.Select(r => r.Role.Name).ToList(),
+ Libraries = u.Libraries.Select(l => new LibraryDto
+ {
+ Name = l.Name,
+ CoverImage = l.CoverImage,
+ Type = l.Type,
+ Folders = l.Folders.Select(x => x.Path).ToList()
+ }).ToList()
})
.ToListAsync();
-
- //return await _context.Users.Include(x => x.Libraries)
-
- return await _context.Users.Include(x => x.Libraries)
- .Include(x => x.Libraries)
- .ProjectTo<MemberDto>(_mapper.ConfigurationProvider)
- .ToListAsync();
}
public async Task<MemberDto> GetMemberAsync(string username)