chore(server): move commands (#8121)

move commands
This commit is contained in:
Daniel Dietzler
2024-03-20 21:25:33 +01:00
committed by GitHub
parent 96a22ec3c1
commit 2dcce03352
6 changed files with 15 additions and 19 deletions

View 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');
}
}
}