|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service';
|
|
|
|
|
import { PlatformService } from '@ghostfolio/api/app/platform/platform.service';
|
|
|
|
|
import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service';
|
|
|
|
|
import { UserService } from '@ghostfolio/api/app/user/user.service';
|
|
|
|
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
|
|
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
|
|
|
|
|
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
|
|
|
|
|
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
|
|
|
|
import { TagService } from '@ghostfolio/api/services/tag/tag.service';
|
|
|
|
|
import {
|
|
|
|
@ -44,10 +44,10 @@ export class InfoService {
|
|
|
|
|
private readonly exchangeRateDataService: ExchangeRateDataService,
|
|
|
|
|
private readonly jwtService: JwtService,
|
|
|
|
|
private readonly platformService: PlatformService,
|
|
|
|
|
private readonly prismaService: PrismaService,
|
|
|
|
|
private readonly propertyService: PropertyService,
|
|
|
|
|
private readonly redisCacheService: RedisCacheService,
|
|
|
|
|
private readonly tagService: TagService
|
|
|
|
|
private readonly tagService: TagService,
|
|
|
|
|
private readonly userService: UserService
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
public async get(): Promise<InfoItem> {
|
|
|
|
@ -145,12 +145,7 @@ export class InfoService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async countActiveUsers(aDays: number) {
|
|
|
|
|
return await this.prismaService.user.count({
|
|
|
|
|
orderBy: {
|
|
|
|
|
Analytics: {
|
|
|
|
|
updatedAt: 'desc'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
return this.userService.count({
|
|
|
|
|
where: {
|
|
|
|
|
AND: [
|
|
|
|
|
{
|
|
|
|
@ -223,10 +218,7 @@ export class InfoService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async countNewUsers(aDays: number) {
|
|
|
|
|
return await this.prismaService.user.count({
|
|
|
|
|
orderBy: {
|
|
|
|
|
createdAt: 'desc'
|
|
|
|
|
},
|
|
|
|
|
return this.userService.count({
|
|
|
|
|
where: {
|
|
|
|
|
AND: [
|
|
|
|
|
{
|
|
|
|
@ -317,11 +309,10 @@ export class InfoService {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const stripeConfig = (await this.prismaService.property.findUnique({
|
|
|
|
|
where: { key: PROPERTY_STRIPE_CONFIG }
|
|
|
|
|
})) ?? { value: '{}' };
|
|
|
|
|
|
|
|
|
|
return JSON.parse(stripeConfig.value);
|
|
|
|
|
return (
|
|
|
|
|
((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ??
|
|
|
|
|
{}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async getUptime(): Promise<number> {
|
|
|
|
|