async getMonitorJSONList(userID, monitorID = null) {

        let query = " user_id = ? ";
        let queryParams = [ userID ];

        if (monitorID) {
            query += "AND id = ? ";
            queryParams.push(monitorID);
        }

        let monitorList = await R.find("monitor", query + "ORDER BY weight DESC, name", queryParams);

        const monitorData = monitorList.map(monitor => ({
            id: monitor.id,
            active: monitor.active,
            name: monitor.name,
        }));
        const preloadData = await Monitor.preparePreloadData(monitorData);

        const result = {};
        monitorList.forEach(monitor => result[monitor.id] = monitor.toJSON(preloadData));
        return result;
    }
Get a list of monitors for the given user.
@param {string} userID - The ID of the user to get monitors for.
@param {number} monitorID - The ID of monitor for.
@returns {Promise<object>} A promise that resolves to an object with monitor IDs as keys and monitor objects as values.

Generated by Trelent