mirror of
https://github.com/immich-app/immich.git
synced 2025-12-28 01:11:47 +03:00
32
server/src/commands/list-users.command.ts
Normal file
32
server/src/commands/list-users.command.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Command, CommandRunner } from 'nest-commander';
|
||||
import { UserService } from 'src/domain/user/user.service';
|
||||
import { UserEntity } from 'src/infra/entities/user.entity';
|
||||
|
||||
@Command({
|
||||
name: 'list-users',
|
||||
description: 'List Immich users',
|
||||
})
|
||||
export class ListUsersCommand extends CommandRunner {
|
||||
constructor(private userService: UserService) {
|
||||
super();
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
try {
|
||||
const users = await this.userService.getAll(
|
||||
{
|
||||
user: {
|
||||
id: 'cli',
|
||||
email: 'cli@immich.app',
|
||||
isAdmin: true,
|
||||
} as UserEntity,
|
||||
},
|
||||
true,
|
||||
);
|
||||
console.dir(users);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error('Unable to load users');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user