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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
1 deletions
-
apps/api/src/app/admin/admin.service.ts
-
libs/common/src/lib/interfaces/admin-data.interface.ts
|
|
@ -440,13 +440,14 @@ export class AdminService { |
|
|
|
}, |
|
|
|
createdAt: true, |
|
|
|
id: true, |
|
|
|
role: true, |
|
|
|
Subscription: true |
|
|
|
}, |
|
|
|
take: 30 |
|
|
|
}); |
|
|
|
|
|
|
|
return usersWithAnalytics.map( |
|
|
|
({ _count, Analytics, createdAt, id, Subscription }) => { |
|
|
|
({ _count, Analytics, createdAt, id, role, Subscription }) => { |
|
|
|
const daysSinceRegistration = |
|
|
|
differenceInDays(new Date(), createdAt) + 1; |
|
|
|
const engagement = Analytics |
|
|
@ -466,6 +467,7 @@ export class AdminService { |
|
|
|
createdAt, |
|
|
|
engagement, |
|
|
|
id, |
|
|
|
role, |
|
|
|
subscription, |
|
|
|
accountCount: _count.Account || 0, |
|
|
|
country: Analytics?.country, |
|
|
|
|
|
@ -1,3 +1,5 @@ |
|
|
|
import { Role } from '@prisma/client'; |
|
|
|
|
|
|
|
import { UniqueAsset } from './unique-asset.interface'; |
|
|
|
|
|
|
|
export interface AdminData { |
|
|
@ -16,6 +18,7 @@ export interface AdminData { |
|
|
|
engagement: number; |
|
|
|
id: string; |
|
|
|
lastActivity: Date; |
|
|
|
role: Role; |
|
|
|
transactionCount: number; |
|
|
|
}[]; |
|
|
|
version: string; |
|
|
|