mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 18:19:10 +03:00
feat(server): add immich.users.total metric (#21780)
* Add immich.users.total metric * Fix tests & one lint error * Lint * Fix SQL Schema checks * Fix nit * Use workers argument in OnEvent hook and remove condition from method body
This commit is contained in:
@@ -286,6 +286,16 @@ export class UserRepository {
|
||||
.execute();
|
||||
}
|
||||
|
||||
@GenerateSql()
|
||||
async getCount(): Promise<number> {
|
||||
const result = await this.db
|
||||
.selectFrom('user')
|
||||
.select((eb) => eb.fn.countAll().as('count'))
|
||||
.where('user.deletedAt', 'is', null)
|
||||
.executeTakeFirstOrThrow();
|
||||
return Number(result.count);
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID, DummyValue.NUMBER] })
|
||||
async updateUsage(id: string, delta: number): Promise<void> {
|
||||
await this.db
|
||||
|
||||
Reference in New Issue
Block a user