Browse Source
Task/improve type safety in lookup item (#8441)
Improve type safety
pull/8436/head^2
Kenrick Tandrian
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
9 additions and
9 deletions
-
apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
-
libs/common/src/lib/interfaces/lookup-item.interface.ts
-
libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts
|
|
@ -321,11 +321,11 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { |
|
|
quoteType?: string; |
|
|
quoteType?: string; |
|
|
shortName?: string | null; |
|
|
shortName?: string | null; |
|
|
}): { |
|
|
}): { |
|
|
assetClass: AssetClass; |
|
|
assetClass: AssetClass | undefined; |
|
|
assetSubClass: AssetSubClass; |
|
|
assetSubClass: AssetSubClass | undefined; |
|
|
} { |
|
|
} { |
|
|
let assetClass: AssetClass; |
|
|
let assetClass: AssetClass | undefined; |
|
|
let assetSubClass: AssetSubClass; |
|
|
let assetSubClass: AssetSubClass | undefined; |
|
|
|
|
|
|
|
|
switch (quoteType?.toLowerCase()) { |
|
|
switch (quoteType?.toLowerCase()) { |
|
|
case 'cryptocurrency': |
|
|
case 'cryptocurrency': |
|
|
|
|
|
@ -7,11 +7,11 @@ import { |
|
|
import { DataProviderInfo } from './data-provider-info.interface'; |
|
|
import { DataProviderInfo } from './data-provider-info.interface'; |
|
|
|
|
|
|
|
|
export interface LookupItem { |
|
|
export interface LookupItem { |
|
|
assetClass: AssetClass; |
|
|
assetClass?: AssetClass | null; |
|
|
assetSubClass: AssetSubClass; |
|
|
assetSubClass?: AssetSubClass | null; |
|
|
currency: string; |
|
|
currency: string; |
|
|
dataProviderInfo: DataProviderInfo; |
|
|
dataProviderInfo: DataProviderInfo; |
|
|
dataSource: DataSource | null; |
|
|
dataSource: DataSource | null; |
|
|
name: string; |
|
|
name?: string | null; |
|
|
symbol: string; |
|
|
symbol: string; |
|
|
} |
|
|
} |
|
|
|
|
|
@ -158,7 +158,7 @@ export class GfSymbolAutocompleteComponent |
|
|
this.lookupItems = filteredLookupItems.map((lookupItem) => { |
|
|
this.lookupItems = filteredLookupItems.map((lookupItem) => { |
|
|
return { |
|
|
return { |
|
|
...lookupItem, |
|
|
...lookupItem, |
|
|
assetSubClassString: translate(lookupItem.assetSubClass) |
|
|
assetSubClassString: translate(lookupItem.assetSubClass ?? '') |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -207,7 +207,7 @@ export class GfSymbolAutocompleteComponent |
|
|
this.lookupItems = this.defaultLookupItems.map((lookupItem) => { |
|
|
this.lookupItems = this.defaultLookupItems.map((lookupItem) => { |
|
|
return { |
|
|
return { |
|
|
...lookupItem, |
|
|
...lookupItem, |
|
|
assetSubClassString: translate(lookupItem.assetSubClass) |
|
|
assetSubClassString: translate(lookupItem.assetSubClass ?? '') |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|