Browse Source
Feature/improve currency validation in search functionality of data provider service (#5745)
* Improve currency validation
* Update changelog
pull/5747/head^2
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
13 additions and
13 deletions
-
CHANGELOG.md
-
apps/api/src/services/data-provider/data-provider.service.ts
-
libs/common/src/lib/helper.ts
-
package-lock.json
-
package.json
|
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Changed |
|
|
|
|
|
|
|
- Disabled the zoom functionality in the _Progressive Web App_ (PWA) |
|
|
|
- Improved the currency validation in the search functionality of the data provider service |
|
|
|
- Optimized the get quotes functionality by utilizing the asset profile resolutions in the _Financial Modeling Prep_ service |
|
|
|
- Extracted the footer to a component |
|
|
|
|
|
|
|
|
|
@ -645,8 +645,11 @@ export class DataProviderService implements OnModuleInit { |
|
|
|
|
|
|
|
const filteredItems = lookupItems |
|
|
|
.filter(({ currency }) => { |
|
|
|
// Only allow symbols with supported currency
|
|
|
|
return currency ? true : false; |
|
|
|
if (includeIndices) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return currency ? isCurrency(currency) : false; |
|
|
|
}) |
|
|
|
.map((lookupItem) => { |
|
|
|
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import * as currencies from '@dinero.js/currencies'; |
|
|
|
import { NumberParser } from '@internationalized/number'; |
|
|
|
import { Type as ActivityType, DataSource, MarketData } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { isISO4217CurrencyCode } from 'class-validator'; |
|
|
|
import { |
|
|
|
getDate, |
|
|
|
getMonth, |
|
|
@ -340,8 +340,12 @@ export function interpolate(template: string, context: any) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
export function isCurrency(aCurrency = '') { |
|
|
|
return currencies[aCurrency] || isDerivedCurrency(aCurrency); |
|
|
|
export function isCurrency(aCurrency: string) { |
|
|
|
if (!aCurrency) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return isISO4217CurrencyCode(aCurrency) || isDerivedCurrency(aCurrency); |
|
|
|
} |
|
|
|
|
|
|
|
export function isDerivedCurrency(aCurrency: string) { |
|
|
|
|
|
@ -28,7 +28,6 @@ |
|
|
|
"@dfinity/candid": "0.15.7", |
|
|
|
"@dfinity/identity": "0.15.7", |
|
|
|
"@dfinity/principal": "0.15.7", |
|
|
|
"@dinero.js/currencies": "2.0.0-alpha.8", |
|
|
|
"@internationalized/number": "3.6.3", |
|
|
|
"@ionic/angular": "8.7.3", |
|
|
|
"@keyv/redis": "4.4.0", |
|
|
@ -5018,12 +5017,6 @@ |
|
|
|
"ts-node": "^10.8.2" |
|
|
|
} |
|
|
|
}, |
|
|
|
"node_modules/@dinero.js/currencies": { |
|
|
|
"version": "2.0.0-alpha.8", |
|
|
|
"resolved": "https://registry.npmjs.org/@dinero.js/currencies/-/currencies-2.0.0-alpha.8.tgz", |
|
|
|
"integrity": "sha512-zApiqtuuPwjiM9LJA5/kNcT48VSHRiz2/mktkXjIpfxrJKzthXybUAgEenExIH6dYhLDgVmsLQZtZFOsdYl0Ag==", |
|
|
|
"license": "MIT" |
|
|
|
}, |
|
|
|
"node_modules/@discoveryjs/json-ext": { |
|
|
|
"version": "0.6.3", |
|
|
|
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", |
|
|
|
|
|
@ -74,7 +74,6 @@ |
|
|
|
"@dfinity/candid": "0.15.7", |
|
|
|
"@dfinity/identity": "0.15.7", |
|
|
|
"@dfinity/principal": "0.15.7", |
|
|
|
"@dinero.js/currencies": "2.0.0-alpha.8", |
|
|
|
"@internationalized/number": "3.6.3", |
|
|
|
"@ionic/angular": "8.7.3", |
|
|
|
"@keyv/redis": "4.4.0", |
|
|
|