Introduce NodeMonitoringStateResponse to get rid of some any

This commit is contained in:
baldo 2022-08-24 18:20:49 +02:00
parent 672369d419
commit 00d93c33b4
4 changed files with 100 additions and 48 deletions
server/resources

View file

@ -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,
};
}