mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 01:11:16 +03:00
refactor(server): immich-admin list-users (#8862)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Command, CommandRunner } from 'nest-commander';
|
||||
import { UserEntity } from 'src/entities/user.entity';
|
||||
import { UserService } from 'src/services/user.service';
|
||||
|
||||
@Command({
|
||||
@@ -13,16 +12,7 @@ export class ListUsersCommand extends CommandRunner {
|
||||
|
||||
async run(): Promise<void> {
|
||||
try {
|
||||
const users = await this.userService.getAll(
|
||||
{
|
||||
user: {
|
||||
id: 'cli',
|
||||
email: 'cli@immich.app',
|
||||
isAdmin: true,
|
||||
} as UserEntity,
|
||||
},
|
||||
true,
|
||||
);
|
||||
const users = await this.userService.listUsers();
|
||||
console.dir(users);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -37,6 +37,11 @@ export class UserService {
|
||||
this.configCore = SystemConfigCore.create(configRepository, this.logger);
|
||||
}
|
||||
|
||||
async listUsers(): Promise<UserResponseDto[]> {
|
||||
const users = await this.userRepository.getList({ withDeleted: true });
|
||||
return users.map((user) => mapUser(user));
|
||||
}
|
||||
|
||||
async getAll(auth: AuthDto, isAll: boolean): Promise<UserResponseDto[]> {
|
||||
const users = await this.userRepository.getList({ withDeleted: !isAll });
|
||||
return users.map((user) => mapUser(user));
|
||||
|
||||
Reference in New Issue
Block a user