[FA-misc] Switches to using DTOs, updates frontend with details and reader page, updates novel import to be an upsert
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using FictionArchive.Service.UserService.Models.Database;
|
||||
using FictionArchive.Service.UserService.Models.DTOs;
|
||||
using FictionArchive.Service.UserService.Services;
|
||||
using HotChocolate.Authorization;
|
||||
|
||||
@@ -7,8 +7,28 @@ namespace FictionArchive.Service.UserService.GraphQL;
|
||||
public class Query
|
||||
{
|
||||
[Authorize]
|
||||
public async Task<IQueryable<User>> GetUsers(UserManagementService userManagementService)
|
||||
public IQueryable<UserDto> GetUsers(UserManagementService userManagementService)
|
||||
{
|
||||
return userManagementService.GetUsers();
|
||||
return userManagementService.GetUsers().Select(user => new UserDto
|
||||
{
|
||||
Id = user.Id,
|
||||
CreatedTime = user.CreatedTime,
|
||||
LastUpdatedTime = user.LastUpdatedTime,
|
||||
Username = user.Username,
|
||||
Email = user.Email,
|
||||
Disabled = user.Disabled,
|
||||
Inviter = user.Inviter != null
|
||||
? new UserDto
|
||||
{
|
||||
Id = user.Inviter.Id,
|
||||
CreatedTime = user.Inviter.CreatedTime,
|
||||
LastUpdatedTime = user.Inviter.LastUpdatedTime,
|
||||
Username = user.Inviter.Username,
|
||||
Email = user.Inviter.Email,
|
||||
Disabled = user.Inviter.Disabled,
|
||||
Inviter = null // Limit recursion to one level
|
||||
}
|
||||
: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user