Skip to content

Commit

Permalink
feat: response structure substrate countries (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenkristian authored Aug 18, 2022
1 parent ea7dc6d commit 049a69f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
export interface RequestsByCountry {
countryId: string;
country: string;
totalRequests: number;
totalValue: string;
totalValue: CurrencyValueInterface;
services: Array<ServiceInterface>;
}
export interface CurrencyValueInterface {
dbio: number;
dai: number;
usd: number;
dai: number | string;
usd: number | string;
}
export interface ServiceInterface {
countryId: string;
Expand All @@ -19,7 +20,7 @@ export interface ServiceInterface {
}
export interface RequestByCountryDictInterface {
totalRequests: number;
totalValue: string | number;
totalValue: number;
services: {
[id: string]: ServiceInterface;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,15 @@ export class ServiceRequestService {
}));

const requestByCountry: RequestsByCountry = {
countryId: countryCode,
country: name,
services: servicesArr,
totalRequests: totalRequests,
totalValue: totalValue as string,
totalValue: {
dbio: totalValue,
dai: totalValue * oneDbioEqualToDai || 'Conversion Error',
usd: totalValue * oneDbioEqualToUsd || 'Conversion Error',
},
};

requestByCountryList.push(requestByCountry);
Expand Down

0 comments on commit 049a69f

Please sign in to comment.