Skip to content

Commit 049a69f

Browse files
feat: response structure substrate countries (#436)
1 parent ea7dc6d commit 049a69f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/endpoints/substrate-endpoint/interface/service-request.interface.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
export interface RequestsByCountry {
2+
countryId: string;
23
country: string;
34
totalRequests: number;
4-
totalValue: string;
5+
totalValue: CurrencyValueInterface;
56
services: Array<ServiceInterface>;
67
}
78
export interface CurrencyValueInterface {
89
dbio: number;
9-
dai: number;
10-
usd: number;
10+
dai: number | string;
11+
usd: number | string;
1112
}
1213
export interface ServiceInterface {
1314
countryId: string;
@@ -19,7 +20,7 @@ export interface ServiceInterface {
1920
}
2021
export interface RequestByCountryDictInterface {
2122
totalRequests: number;
22-
totalValue: string | number;
23+
totalValue: number;
2324
services: {
2425
[id: string]: ServiceInterface;
2526
};

src/endpoints/substrate-endpoint/services/service-request.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,15 @@ export class ServiceRequestService {
138138
}));
139139

140140
const requestByCountry: RequestsByCountry = {
141+
countryId: countryCode,
141142
country: name,
142143
services: servicesArr,
143144
totalRequests: totalRequests,
144-
totalValue: totalValue as string,
145+
totalValue: {
146+
dbio: totalValue,
147+
dai: totalValue * oneDbioEqualToDai || 'Conversion Error',
148+
usd: totalValue * oneDbioEqualToUsd || 'Conversion Error',
149+
},
145150
};
146151

147152
requestByCountryList.push(requestByCountry);

0 commit comments

Comments
 (0)