|
|
@ -192,7 +192,7 @@ export class AdminService { |
|
|
filters, |
|
|
filters, |
|
|
presetId, |
|
|
presetId, |
|
|
sortColumn, |
|
|
sortColumn, |
|
|
sortDirection, |
|
|
sortDirection = 'asc', |
|
|
skip, |
|
|
skip, |
|
|
take = Number.MAX_SAFE_INTEGER |
|
|
take = Number.MAX_SAFE_INTEGER |
|
|
}: { |
|
|
}: { |
|
|
@ -204,7 +204,7 @@ export class AdminService { |
|
|
take?: number; |
|
|
take?: number; |
|
|
}): Promise<AdminMarketData> { |
|
|
}): Promise<AdminMarketData> { |
|
|
let orderBy: Prisma.Enumerable<Prisma.SymbolProfileOrderByWithRelationInput> = |
|
|
let orderBy: Prisma.Enumerable<Prisma.SymbolProfileOrderByWithRelationInput> = |
|
|
[{ symbol: 'asc' }, { id: 'asc' }]; |
|
|
[{ symbol: 'asc' }]; |
|
|
const where: Prisma.SymbolProfileWhereInput = {}; |
|
|
const where: Prisma.SymbolProfileWhereInput = {}; |
|
|
|
|
|
|
|
|
if (presetId === 'BENCHMARKS') { |
|
|
if (presetId === 'BENCHMARKS') { |
|
|
@ -259,7 +259,7 @@ export class AdminService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (sortColumn) { |
|
|
if (sortColumn) { |
|
|
orderBy = [{ [sortColumn]: sortDirection }, { id: sortDirection }]; |
|
|
orderBy = [{ [sortColumn]: sortDirection }]; |
|
|
|
|
|
|
|
|
if (sortColumn === 'activitiesCount') { |
|
|
if (sortColumn === 'activitiesCount') { |
|
|
orderBy = [ |
|
|
orderBy = [ |
|
|
@ -267,8 +267,7 @@ export class AdminService { |
|
|
activities: { |
|
|
activities: { |
|
|
_count: sortDirection |
|
|
_count: sortDirection |
|
|
} |
|
|
} |
|
|
}, |
|
|
} |
|
|
{ id: sortDirection } |
|
|
|
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -278,10 +277,10 @@ export class AdminService { |
|
|
try { |
|
|
try { |
|
|
const symbolProfileResult = await Promise.all([ |
|
|
const symbolProfileResult = await Promise.all([ |
|
|
extendedPrismaClient.symbolProfile.findMany({ |
|
|
extendedPrismaClient.symbolProfile.findMany({ |
|
|
orderBy, |
|
|
|
|
|
skip, |
|
|
skip, |
|
|
take, |
|
|
take, |
|
|
where, |
|
|
where, |
|
|
|
|
|
orderBy: [...orderBy, { id: sortDirection }], |
|
|
select: { |
|
|
select: { |
|
|
_count: { |
|
|
_count: { |
|
|
select: { |
|
|
select: { |
|
|
@ -821,9 +820,9 @@ export class AdminService { |
|
|
take?: number; |
|
|
take?: number; |
|
|
}): Promise<AdminUsers['users']> { |
|
|
}): Promise<AdminUsers['users']> { |
|
|
let orderBy: Prisma.Enumerable<Prisma.UserOrderByWithRelationInput> = [ |
|
|
let orderBy: Prisma.Enumerable<Prisma.UserOrderByWithRelationInput> = [ |
|
|
{ createdAt: 'desc' }, |
|
|
{ createdAt: 'desc' } |
|
|
{ id: 'desc' } |
|
|
|
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
let where: Prisma.UserWhereInput; |
|
|
let where: Prisma.UserWhereInput; |
|
|
|
|
|
|
|
|
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { |
|
|
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { |
|
|
@ -832,9 +831,9 @@ export class AdminService { |
|
|
analytics: { |
|
|
analytics: { |
|
|
lastRequestAt: 'desc' |
|
|
lastRequestAt: 'desc' |
|
|
} |
|
|
} |
|
|
}, |
|
|
} |
|
|
{ id: 'desc' } |
|
|
|
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
where = { |
|
|
where = { |
|
|
NOT: { |
|
|
NOT: { |
|
|
analytics: null |
|
|
analytics: null |
|
|
@ -843,10 +842,10 @@ export class AdminService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const usersWithAnalytics = await this.prismaService.user.findMany({ |
|
|
const usersWithAnalytics = await this.prismaService.user.findMany({ |
|
|
orderBy, |
|
|
|
|
|
skip, |
|
|
skip, |
|
|
take, |
|
|
take, |
|
|
where, |
|
|
where, |
|
|
|
|
|
orderBy: [...orderBy, { id: 'desc' }], |
|
|
select: { |
|
|
select: { |
|
|
_count: { |
|
|
_count: { |
|
|
select: { accounts: true, activities: true } |
|
|
select: { accounts: true, activities: true } |
|
|
|