Introduce NodeMonitoringStateResponse to get rid of some any
This commit is contained in:
parent
672369d419
commit
00d93c33b4
4 changed files with 100 additions and 48 deletions
server/resources
|
@ -11,23 +11,22 @@ import {
|
|||
JSONObject,
|
||||
MonitoringResponse,
|
||||
MonitoringToken,
|
||||
NodeMonitoringStateResponse,
|
||||
toMonitoringResponse,
|
||||
} from "../types";
|
||||
|
||||
const isValidToken = forConstraint(CONSTRAINTS.token, false);
|
||||
|
||||
// FIXME: Get rid of any
|
||||
async function doGetAll(req: Request): Promise<{ total: number; result: any }> {
|
||||
async function doGetAll(
|
||||
req: Request
|
||||
): Promise<{ total: number; result: NodeMonitoringStateResponse[] }> {
|
||||
const restParams = await Resources.getValidRestParams("list", null, req);
|
||||
const { monitoringStates, total } = await MonitoringService.getAll(
|
||||
restParams
|
||||
);
|
||||
return {
|
||||
total,
|
||||
result: monitoringStates.map((state) => {
|
||||
state.mapId = state.mac.toLowerCase().replace(/:/g, "");
|
||||
return state;
|
||||
}),
|
||||
result: monitoringStates,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue