Add new node if node tries to check in with an ID not in the DB
This commit is contained in:
@@ -269,6 +269,7 @@ exports.updateExistingNode = async = (req, res) => {
|
|||||||
exports.nodeCheckIn = async (req, res) => {
|
exports.nodeCheckIn = async (req, res) => {
|
||||||
if (!req.params.nodeId) return res.status(400).json("No id specified");
|
if (!req.params.nodeId) return res.status(400).json("No id specified");
|
||||||
getNodeInfoFromId(req.params.nodeId, (nodeInfo) => {
|
getNodeInfoFromId(req.params.nodeId, (nodeInfo) => {
|
||||||
|
if (!nodeInfo) return this.newNode(req, res);
|
||||||
if (!nodeInfo.online) {
|
if (!nodeInfo.online) {
|
||||||
nodeInfo.online = true;
|
nodeInfo.online = true;
|
||||||
updateNodeInfo(nodeInfo, () => {
|
updateNodeInfo(nodeInfo, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user