|
|
|
@ -14,29 +14,23 @@ import { |
|
|
|
AdminUserResponse, |
|
|
|
AdminUsersResponse, |
|
|
|
AssetProfileIdentifier, |
|
|
|
AssetProfilesResponse, |
|
|
|
DataProviderGhostfolioStatusResponse, |
|
|
|
DataProviderHistoricalResponse, |
|
|
|
EnhancedSymbolProfile, |
|
|
|
Filter |
|
|
|
EnhancedSymbolProfile |
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
import { DateRange } from '@ghostfolio/common/types'; |
|
|
|
import { GF_ENVIRONMENT } from '@ghostfolio/ui/environment'; |
|
|
|
|
|
|
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; |
|
|
|
import { Injectable, inject } from '@angular/core'; |
|
|
|
import { SortDirection } from '@angular/material/sort'; |
|
|
|
import { DataSource, MarketData, Platform } from '@prisma/client'; |
|
|
|
import { JobStatus } from 'bull'; |
|
|
|
import { isNumber } from 'lodash'; |
|
|
|
|
|
|
|
import { DataService } from './data.service'; |
|
|
|
|
|
|
|
@Injectable({ |
|
|
|
providedIn: 'root' |
|
|
|
}) |
|
|
|
export class AdminService { |
|
|
|
private readonly dataService = inject(DataService); |
|
|
|
private readonly environment = inject(GF_ENVIRONMENT); |
|
|
|
private readonly http = inject(HttpClient); |
|
|
|
|
|
|
|
@ -81,42 +75,6 @@ export class AdminService { |
|
|
|
return this.http.get<AdminData>('/api/v1/admin'); |
|
|
|
} |
|
|
|
|
|
|
|
public fetchAssetProfiles({ |
|
|
|
filters, |
|
|
|
skip, |
|
|
|
sortColumn, |
|
|
|
sortDirection, |
|
|
|
take |
|
|
|
}: { |
|
|
|
filters?: Filter[]; |
|
|
|
skip?: number; |
|
|
|
sortColumn?: string; |
|
|
|
sortDirection?: SortDirection; |
|
|
|
take: number; |
|
|
|
}) { |
|
|
|
let params = this.dataService.buildFiltersAsQueryParams({ filters }); |
|
|
|
|
|
|
|
if (skip) { |
|
|
|
params = params.append('skip', skip); |
|
|
|
} |
|
|
|
|
|
|
|
if (sortColumn) { |
|
|
|
params = params.append('sortColumn', sortColumn); |
|
|
|
} |
|
|
|
|
|
|
|
if (sortDirection) { |
|
|
|
params = params.append('sortDirection', sortDirection); |
|
|
|
} |
|
|
|
|
|
|
|
if (take) { |
|
|
|
params = params.append('take', take); |
|
|
|
} |
|
|
|
|
|
|
|
return this.http.get<AssetProfilesResponse>('/api/v1/asset-profiles', { |
|
|
|
params |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public fetchGhostfolioDataProviderStatus(aApiKey: string) { |
|
|
|
const headers = new HttpHeaders({ |
|
|
|
[HEADER_KEY_SKIP_INTERCEPTOR]: 'true', |
|
|
|
|