Browse Source
Feature/minor improvements in data provider service (#4017)
* Refactoring
pull/4027/head
Thomas Kaul
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
5 additions and
5 deletions
-
apps/api/src/services/data-provider/data-provider.service.ts
-
apps/client/src/app/services/data.service.ts
|
|
@ -575,8 +575,8 @@ export class DataProviderService { |
|
|
|
query: string; |
|
|
|
user: UserWithSettings; |
|
|
|
}): Promise<LookupResponse> { |
|
|
|
const promises: Promise<LookupResponse>[] = []; |
|
|
|
let lookupItems: LookupItem[] = []; |
|
|
|
const promises: Promise<LookupResponse>[] = []; |
|
|
|
|
|
|
|
if (query?.length < 2) { |
|
|
|
return { items: lookupItems }; |
|
|
@ -606,9 +606,9 @@ export class DataProviderService { |
|
|
|
}); |
|
|
|
|
|
|
|
const filteredItems = lookupItems |
|
|
|
.filter((lookupItem) => { |
|
|
|
.filter(({ currency }) => { |
|
|
|
// Only allow symbols with supported currency
|
|
|
|
return lookupItem.currency ? true : false; |
|
|
|
return currency ? true : false; |
|
|
|
}) |
|
|
|
.sort(({ name: name1 }, { name: name2 }) => { |
|
|
|
return name1?.toLowerCase().localeCompare(name2?.toLowerCase()); |
|
|
|
|
|
@ -466,8 +466,8 @@ export class DataService { |
|
|
|
return this.http |
|
|
|
.get<LookupResponse>('/api/v1/symbol/lookup', { params }) |
|
|
|
.pipe( |
|
|
|
map((respose) => { |
|
|
|
return respose.items; |
|
|
|
map(({ items }) => { |
|
|
|
return items; |
|
|
|
}) |
|
|
|
); |
|
|
|
} |
|
|
|