Skip to content

Commit 1776162

Browse files
fix(adoption-insights): remove unwanted columns and add techdocs type (#497)
1 parent 858d37c commit 1776162

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

  • workspaces/adoption-insights/plugins/adoption-insights-backend/src

workspaces/adoption-insights/plugins/adoption-insights-backend/src/database/adapters/BaseAdapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ export abstract class BaseDatabaseAdapter implements EventDatabase {
207207
const db = this.db;
208208
const query = db('events')
209209
.select(
210-
db.raw(`context->>'routeRef' AS entityref`),
211210
db.raw('CAST(COUNT(*) as INTEGER) AS count'),
212211
db.raw(this.getLastUsedDate()),
213212
db.raw(`COALESCE(attributes->>'kind', '') AS kind`),
@@ -219,7 +218,7 @@ export abstract class BaseDatabaseAdapter implements EventDatabase {
219218
plugin_id: 'techdocs',
220219
})
221220
.whereBetween('created_at', [start_date, end_date])
222-
.groupByRaw(`entityref, name, kind, namespace`)
221+
.groupByRaw(`name, kind, namespace`)
223222
.limit(Number(limit) || 3);
224223

225224
return query.then(data => this.getResponseData(data, 'last_used'));

workspaces/adoption-insights/plugins/adoption-insights-backend/src/types/event.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ interface EntityRefCount {
4141
count: string;
4242
last_used: string;
4343
}
44+
interface TechDocsCount {
45+
kind: string;
46+
name: string;
47+
namespace: string;
48+
count: string;
49+
last_used: string;
50+
}
4451

4552
interface CatalogEntityCount {
4653
plugin_id: string;
@@ -64,6 +71,6 @@ export type DailyUsers = ResponseWithGrouping<DailyUser[]>;
6471
export type TotalUsers = ResponseData<TotalUser[]>;
6572
export type TopSearches = ResponseData<DateCount[]>;
6673
export type TopPluginCount = ResponseWithGrouping<PluginCount[]>;
67-
export type TopTechDocsCount = ResponseData<EntityRefCount[]>;
74+
export type TopTechDocsCount = ResponseData<TechDocsCount[]>;
6875
export type TopTemplatesCount = ResponseData<EntityRefCount[]>;
6976
export type TopCatalogEntitiesCount = ResponseData<CatalogEntityCount[]>;

0 commit comments

Comments
 (0)