Browse Source
Feature/improve Ghostfolio data provider integration (#4743)
* Improve Ghostfolio data provider integration
pull/4746/head
Thomas Kaul
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
2 deletions
-
apps/api/src/app/admin/admin.service.ts
-
apps/api/src/services/data-provider/data-provider.service.ts
|
@ -135,7 +135,10 @@ export class AdminService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async get({ user }: { user: UserWithSettings }): Promise<AdminData> { |
|
|
public async get({ user }: { user: UserWithSettings }): Promise<AdminData> { |
|
|
const dataSources = await this.dataProviderService.getDataSources({ user }); |
|
|
const dataSources = await this.dataProviderService.getDataSources({ |
|
|
|
|
|
user, |
|
|
|
|
|
includeGhostfolio: true |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const [settings, transactionCount, userCount] = await Promise.all([ |
|
|
const [settings, transactionCount, userCount] = await Promise.all([ |
|
|
this.propertyService.get(), |
|
|
this.propertyService.get(), |
|
|
|
@ -163,8 +163,10 @@ export class DataProviderService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getDataSources({ |
|
|
public async getDataSources({ |
|
|
|
|
|
includeGhostfolio = false, |
|
|
user |
|
|
user |
|
|
}: { |
|
|
}: { |
|
|
|
|
|
includeGhostfolio?: boolean; |
|
|
user: UserWithSettings; |
|
|
user: UserWithSettings; |
|
|
}): Promise<DataSource[]> { |
|
|
}): Promise<DataSource[]> { |
|
|
let dataSourcesKey: 'DATA_SOURCES' | 'DATA_SOURCES_LEGACY' = 'DATA_SOURCES'; |
|
|
let dataSourcesKey: 'DATA_SOURCES' | 'DATA_SOURCES_LEGACY' = 'DATA_SOURCES'; |
|
@ -187,7 +189,7 @@ export class DataProviderService { |
|
|
PROPERTY_API_KEY_GHOSTFOLIO |
|
|
PROPERTY_API_KEY_GHOSTFOLIO |
|
|
)) as string; |
|
|
)) as string; |
|
|
|
|
|
|
|
|
if (ghostfolioApiKey || hasRole(user, 'ADMIN')) { |
|
|
if (includeGhostfolio || ghostfolioApiKey) { |
|
|
dataSources.push('GHOSTFOLIO'); |
|
|
dataSources.push('GHOSTFOLIO'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|