Major update

- Working client server interactions
- Can create radio config
- Needs radio testing
This commit is contained in:
Logan Cusano
2023-02-18 20:41:43 -05:00
parent c8c75e8b37
commit ce072d9287
25 changed files with 1114 additions and 39 deletions

View File

@@ -13,7 +13,9 @@ const nodesTable = `${databaseConfig.database_database}.nodes`;
connection.connect()
// Get all nodes the server knows about regardless of status
/** Get all nodes the server knows about regardless of status
* @param {*} callback Callback function
*/
exports.getAllNodes = (callback) => {
const sqlQuery = `SELECT * FROM ${nodesTable}`
runSQL(sqlQuery, (rows) => {
@@ -21,7 +23,9 @@ exports.getAllNodes = (callback) => {
})
}
// Get all nodes that have the online status set true (are online)
/** Get all nodes that have the online status set true (are online)
* @param callback Callback function
*/
exports.getOnlineNodes = (callback) => {
const sqlQuery = `SELECT * FROM ${nodesTable} WHERE online = 1;`
runSQL(sqlQuery, (rows) => {
@@ -29,7 +33,10 @@ exports.getOnlineNodes = (callback) => {
})
}
// Get info on a node based on ID
/** Get info on a node based on ID
* @param nodeId The ID of the node
* @param callback Callback function
*/
exports.getNodeInfoFromId = (nodeId, callback) => {
const sqlQuery = `SELECT * FROM ${nodesTable} WHERE id = ${nodeId}`
runSQL(sqlQuery, (rows) => {
@@ -39,7 +46,10 @@ exports.getNodeInfoFromId = (nodeId, callback) => {
})
}
// Add a new node to the DB
/** Add a new node to the DB
* @param nodeObject Node information object
* @param callback Callback function
*/
exports.addNewNode = (nodeObject, callback) => {
if (!nodeObject.name) throw new Error("No name provided");
const name = nodeObject.name,
@@ -55,7 +65,10 @@ exports.addNewNode = (nodeObject, callback) => {
})
}
// Update the known info on a node
/** Update the known info on a node
* @param nodeObject Node information object
* @param callback Callback function
*/
exports.updateNodeInfo = (nodeObject, callback) => {
const name = nodeObject.name,
ip = nodeObject.ip,