Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Apr 1, 2024
1 parent d2dea92 commit 9bd9fd0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/src/services/db/providerStatusService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ export const getProviderList = async () => {

const [auditors, providerAttributeSchema] = await Promise.all([auditorsQuery, providerAttributeSchemaQuery]);

return filteredProviders.map((x) =>
mapProviderToList(x, providerAttributeSchema, auditors, providerNodes.find((p) => p.owner === x.owner)?.lastSnapshot?.nodes)
);
return filteredProviders.map((x) => {
const nodes = providerNodes.find((p) => p.owner === x.owner)?.lastSnapshot?.nodes;
return mapProviderToList(x, providerAttributeSchema, auditors, nodes);
});
};

export const getProviderDetail = async (address: string): Promise<ProviderDetail> => {
Expand Down Expand Up @@ -122,7 +123,7 @@ export const getProviderDetail = async (address: string): Promise<ProviderDetail
}
});

const lastOnlineSnapshot = await ProviderSnapshot.findOne({
const lastSnapshot = await ProviderSnapshot.findOne({
where: {
id: provider.lastSnapshotId
},
Expand All @@ -141,7 +142,7 @@ export const getProviderDetail = async (address: string): Promise<ProviderDetail
const [auditors, providerAttributeSchema] = await Promise.all([auditorsQuery, providerAttributeSchemaQuery]);

return {
...mapProviderToList(provider, providerAttributeSchema, auditors, lastOnlineSnapshot?.nodes),
...mapProviderToList(provider, providerAttributeSchema, auditors, lastSnapshot?.nodes),
uptime: uptimeSnapshots.map((ps) => ({
id: ps.id,
isOnline: ps.isOnline,
Expand Down

0 comments on commit 9bd9fd0

Please sign in to comment.