mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: users.total metric (#23158)
* refactor: users.total metric * fix: broken test
This commit is contained in:
@@ -103,7 +103,8 @@ export class UserAdminService extends BaseService {
|
||||
|
||||
const status = force ? UserStatus.Removing : UserStatus.Deleted;
|
||||
const user = await this.userRepository.update(id, { status, deletedAt: new Date() });
|
||||
this.telemetryRepository.api.addToGauge(`immich.users.total`, -1);
|
||||
|
||||
await this.eventRepository.emit('UserDelete', user);
|
||||
|
||||
if (force) {
|
||||
await this.jobRepository.queue({ name: JobName.UserDelete, data: { id: user.id, force } });
|
||||
@@ -116,7 +117,7 @@ export class UserAdminService extends BaseService {
|
||||
await this.findOrFail(id, { withDeleted: true });
|
||||
await this.albumRepository.restoreAll(id);
|
||||
const user = await this.userRepository.restore(id);
|
||||
this.telemetryRepository.api.addToGauge('immich.users.total', 1);
|
||||
await this.eventRepository.emit('UserRestore', user);
|
||||
return mapUserAdmin(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user