refactor(server): cli service (#9672)

This commit is contained in:
Jason Rasmussen 2024-05-22 16:23:47 -04:00 committed by GitHub
parent 967d195a05
commit 13cbdf6851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 176 additions and 91 deletions

View file

@ -170,20 +170,6 @@ export class UserService {
});
}
async resetAdminPassword(ask: (admin: UserResponseDto) => Promise<string | undefined>) {
const admin = await this.userRepository.getAdmin();
if (!admin) {
throw new BadRequestException('Admin account does not exist');
}
const providedPassword = await ask(mapUser(admin));
const password = providedPassword || this.cryptoRepository.newPassword(24);
await this.userCore.updateUser(admin, admin.id, { password });
return { admin, password, provided: !!providedPassword };
}
async handleUserSyncUsage(): Promise<JobStatus> {
await this.userRepository.syncUsage();
return JobStatus.SUCCESS;