From 0c8a035ce5442304c0e82bb3c275efaab75b26d9 Mon Sep 17 00:00:00 2001 From: Khaled Ferjani Date: Wed, 11 Dec 2024 11:20:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(metrics=20API):=20remove=20u?= =?UTF-8?q?nexistant=20fields=20in=20users=20table=20(#150)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tom-server/src/metrics-api/services/index.ts | 2 -- .../tom-server/src/metrics-api/tests/controller.test.ts | 8 -------- packages/tom-server/src/metrics-api/types.ts | 2 -- 3 files changed, 12 deletions(-) diff --git a/packages/tom-server/src/metrics-api/services/index.ts b/packages/tom-server/src/metrics-api/services/index.ts index f98fd558..0588fabb 100644 --- a/packages/tom-server/src/metrics-api/services/index.ts +++ b/packages/tom-server/src/metrics-api/services/index.ts @@ -81,8 +81,6 @@ class MetricsService implements IMetricsService { try { const queryResult = (await this.matrixDb.getAll('users', [ 'name', - 'displayname', - 'avatar_url', 'creation_ts', 'last_seen_ts' ])) as unknown as MatrixUserInfo[] diff --git a/packages/tom-server/src/metrics-api/tests/controller.test.ts b/packages/tom-server/src/metrics-api/tests/controller.test.ts index d7e4e86b..a7b3fe85 100644 --- a/packages/tom-server/src/metrics-api/tests/controller.test.ts +++ b/packages/tom-server/src/metrics-api/tests/controller.test.ts @@ -12,33 +12,25 @@ const ONE_WEEK_IN_MS = 7 * ONE_DAY_IN_MS const ONE_MONTH_IN_MS = 30 * ONE_DAY_IN_MS const TODAY_USER = { - avatar_url: '', creation_ts: 1, - displayname: 'user 1', last_seen_ts: new Date().getTime(), name: 'user1' } satisfies MatrixUserInfo const PRE_TODAY_USER = { - avatar_url: '', creation_ts: 1, - displayname: 'user 1', last_seen_ts: new Date().getTime() - ONE_DAY_IN_MS - 1, name: 'user2' } const PRE_WEEK_USER = { - avatar_url: '', creation_ts: 1, - displayname: 'user 2', last_seen_ts: new Date().getTime() - ONE_WEEK_IN_MS - 1, name: 'user3' } const PRE_MONTH_USER = { - avatar_url: '', creation_ts: 1, - displayname: 'user 3', last_seen_ts: new Date().getTime() - ONE_MONTH_IN_MS - 1, name: 'user4' } diff --git a/packages/tom-server/src/metrics-api/types.ts b/packages/tom-server/src/metrics-api/types.ts index 8572b73f..c5809835 100644 --- a/packages/tom-server/src/metrics-api/types.ts +++ b/packages/tom-server/src/metrics-api/types.ts @@ -20,8 +20,6 @@ export interface UserActivityStats { export interface MatrixUserInfo { name: string - displayname: string - avatar_url: string last_seen_ts: number creation_ts: number }