Browse Source

refactor: reuse countUsersWithAnalytics and move count above users and use promise.all for multiple async method

pull/4058/head
Qurban Ahmad 9 months ago
parent
commit
3eb51e9521
  1. 11
      apps/api/src/app/admin/admin.service.ts

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

@ -140,7 +140,7 @@ export class AdminService {
const [settings, transactionCount, userCount] = await Promise.all([ const [settings, transactionCount, userCount] = await Promise.all([
this.propertyService.get(), this.propertyService.get(),
this.prismaService.order.count(), this.prismaService.order.count(),
this.prismaService.user.count() this.countUsersWithAnalytics()
]); ]);
return { return {
@ -436,10 +436,11 @@ export class AdminService {
skip?: number; skip?: number;
take?: number; take?: number;
}): Promise<AdminUsers> { }): Promise<AdminUsers> {
return { const [count, users] = await Promise.all([
users: await this.getUsersWithAnalytics({ skip, take }), this.countUsersWithAnalytics(),
count: await this.countUsersWithAnalytics() await this.getUsersWithAnalytics({ skip, take })
}; ]);
return { count, users };
} }
public async patchAssetProfileData({ public async patchAssetProfileData({

Loading…
Cancel
Save