|
@ -1,3 +1,4 @@ |
|
|
|
|
|
import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service'; |
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; |
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; |
|
|
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; |
|
|
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; |
|
|
import { AdminData } from '@ghostfolio/common/interfaces'; |
|
|
import { AdminData } from '@ghostfolio/common/interfaces'; |
|
@ -7,6 +8,7 @@ import { Currency } from '@prisma/client'; |
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class AdminService { |
|
|
export class AdminService { |
|
|
public constructor( |
|
|
public constructor( |
|
|
|
|
|
private readonly dataGatheringService: DataGatheringService, |
|
|
private readonly exchangeRateDataService: ExchangeRateDataService, |
|
|
private readonly exchangeRateDataService: ExchangeRateDataService, |
|
|
private readonly prismaService: PrismaService |
|
|
private readonly prismaService: PrismaService |
|
|
) {} |
|
|
) {} |
|
@ -68,18 +70,15 @@ export class AdminService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async getLastDataGathering() { |
|
|
private async getLastDataGathering() { |
|
|
const lastDataGathering = await this.prismaService.property.findUnique({ |
|
|
const lastDataGathering = |
|
|
where: { key: 'LAST_DATA_GATHERING' } |
|
|
await this.dataGatheringService.getLastDataGathering(); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (lastDataGathering?.value) { |
|
|
if (lastDataGathering) { |
|
|
return new Date(lastDataGathering.value); |
|
|
return lastDataGathering; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const dataGatheringInProgress = |
|
|
const dataGatheringInProgress = |
|
|
await this.prismaService.property.findUnique({ |
|
|
await this.dataGatheringService.getIsInProgress(); |
|
|
where: { key: 'LOCKED_DATA_GATHERING' } |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (dataGatheringInProgress) { |
|
|
if (dataGatheringInProgress) { |
|
|
return 'IN_PROGRESS'; |
|
|
return 'IN_PROGRESS'; |
|
|