Browse Source

Feature/Include user role in admin endpoint (#3107)

* Include user role in admin endpoint
pull/3114/head
Gerard Du Pre 11 months ago
committed by GitHub
parent
commit
77358eed65
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      apps/api/src/app/admin/admin.service.ts
  2. 3
      libs/common/src/lib/interfaces/admin-data.interface.ts

4
apps/api/src/app/admin/admin.service.ts

@ -440,13 +440,14 @@ export class AdminService {
}, },
createdAt: true, createdAt: true,
id: true, id: true,
role: true,
Subscription: true Subscription: true
}, },
take: 30 take: 30
}); });
return usersWithAnalytics.map( return usersWithAnalytics.map(
({ _count, Analytics, createdAt, id, Subscription }) => { ({ _count, Analytics, createdAt, id, role, Subscription }) => {
const daysSinceRegistration = const daysSinceRegistration =
differenceInDays(new Date(), createdAt) + 1; differenceInDays(new Date(), createdAt) + 1;
const engagement = Analytics const engagement = Analytics
@ -466,6 +467,7 @@ export class AdminService {
createdAt, createdAt,
engagement, engagement,
id, id,
role,
subscription, subscription,
accountCount: _count.Account || 0, accountCount: _count.Account || 0,
country: Analytics?.country, country: Analytics?.country,

3
libs/common/src/lib/interfaces/admin-data.interface.ts

@ -1,3 +1,5 @@
import { Role } from '@prisma/client';
import { UniqueAsset } from './unique-asset.interface'; import { UniqueAsset } from './unique-asset.interface';
export interface AdminData { export interface AdminData {
@ -16,6 +18,7 @@ export interface AdminData {
engagement: number; engagement: number;
id: string; id: string;
lastActivity: Date; lastActivity: Date;
role: Role;
transactionCount: number; transactionCount: number;
}[]; }[];
version: string; version: string;

Loading…
Cancel
Save