Browse Source

Refactor platforms

pull/2429/head
Thomas 2 years ago
parent
commit
6f3a4d43b9
  1. 6
      apps/api/src/app/info/info.service.ts
  2. 4
      apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
  3. 4
      libs/common/src/lib/interfaces/info-item.interface.ts

6
apps/api/src/app/info/info.service.ts

@ -55,12 +55,8 @@ export class InfoService {
public async get(): Promise<InfoItem> { public async get(): Promise<InfoItem> {
const info: Partial<InfoItem> = {}; const info: Partial<InfoItem> = {};
let isReadOnlyMode: boolean; let isReadOnlyMode: boolean;
const platforms = ( const platforms = await this.platformService.getPlatforms({
await this.platformService.getPlatforms({
orderBy: { name: 'asc' } orderBy: { name: 'asc' }
})
).map(({ id, name }) => {
return { id, name };
}); });
let systemMessage: string; let systemMessage: string;

4
apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts

@ -47,9 +47,7 @@ export class CreateOrUpdateAccountDialog implements OnDestroy {
const { currencies, platforms } = this.dataService.fetchInfo(); const { currencies, platforms } = this.dataService.fetchInfo();
this.currencies = currencies; this.currencies = currencies;
this.platforms = platforms.map((platform) => { this.platforms = platforms;
return { ...platform, url: '' };
});
this.accountForm = this.formBuilder.group({ this.accountForm = this.formBuilder.group({
accountId: [{ disabled: true, value: this.data.account.id }], accountId: [{ disabled: true, value: this.data.account.id }],

4
libs/common/src/lib/interfaces/info-item.interface.ts

@ -1,5 +1,5 @@
import { SubscriptionOffer } from '@ghostfolio/common/types'; import { SubscriptionOffer } from '@ghostfolio/common/types';
import { SymbolProfile, Tag } from '@prisma/client'; import { Platform, SymbolProfile, Tag } from '@prisma/client';
import { Statistics } from './statistics.interface'; import { Statistics } from './statistics.interface';
import { Subscription } from './subscription.interface'; import { Subscription } from './subscription.interface';
@ -13,7 +13,7 @@ export interface InfoItem {
fearAndGreedDataSource?: string; fearAndGreedDataSource?: string;
globalPermissions: string[]; globalPermissions: string[];
isReadOnlyMode?: boolean; isReadOnlyMode?: boolean;
platforms: { id: string; name: string }[]; platforms: Platform[];
statistics: Statistics; statistics: Statistics;
stripePublicKey?: string; stripePublicKey?: string;
subscriptions: { [offer in SubscriptionOffer]: Subscription }; subscriptions: { [offer in SubscriptionOffer]: Subscription };

Loading…
Cancel
Save