From 84ab258726ffa1c9f49c60259c8209bdfdd88c10 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Mon, 17 Jan 2022 14:53:44 +0000 Subject: [server/registration] Accepting bas ids as location for clients instead of only names --- server/api/registration.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/api/registration.js b/server/api/registration.js index 41d5fac..7641f87 100644 --- a/server/api/registration.js +++ b/server/api/registration.js @@ -512,7 +512,7 @@ function getRecursiveParents (groupIds) { */ async function parseHardwareInformation (data) { let client = { - 'parents': [], // TODO: + 'parents': [], 'type': data.type ? data.type : 'CLIENT', // SERVER OR CLIENT 'uuid': '', 'networks': [], // { 'mac': '', 'ip': '' } @@ -752,6 +752,9 @@ async function parseHardwareInformation (data) { const parent = await db.group.findOne({ where: { name: data.location.parent } }) // findOne only returns the first object with the matching name, so if the name isn't unique id should be used client.parents.push(parent.id) + } else if (data.location.parent) { + const pid = Number(data.location.parent) + if (!isNaN(pid)) client.parents.push(pid) } // Add bay and slot if given -- cgit v1.2.3-55-g7522