Skip to content

Commit

Permalink
Update status service to handle new schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ajhollid committed Nov 11, 2024
1 parent d1061be commit 3b8454b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Server/service/statusService.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class StatusService {
responseTime,
message,
};

if (type === "pagespeed") {
const categories = payload.lighthouseResult?.categories;
const audits = payload.lighthouseResult?.audits;
Expand All @@ -101,10 +102,13 @@ class StatusService {
}

if (type === "hardware") {
check.cpu = payload?.cpu ?? {};
check.memory = payload?.memory ?? {};
check.disk = payload?.disk ?? {};
check.host = payload?.host ?? {};
const { cpu, memory, disk, host } = payload?.data ?? {};
const { errors } = payload;
check.cpu = cpu ?? {};
check.memory = memory ?? {};
check.disk = disk ?? {};
check.host = host ?? {};
check.errors = errors ?? [];
}
return check;
};
Expand All @@ -131,6 +135,7 @@ class StatusService {
hardware: this.db.createHardwareCheck,
};
const operation = operationMap[networkResponse.type];

const check = this.buildCheck(networkResponse);
await operation(check);
} catch (error) {
Expand Down

0 comments on commit 3b8454b

Please sign in to comment.