auto-enrolment enhancements

This commit is contained in:
Muhammad Ibrahim
2025-11-14 23:57:43 +00:00
parent 1ca8bf8581
commit 9da341f84c
3 changed files with 112 additions and 101 deletions

View File

@@ -551,8 +551,11 @@ router.post(
updated_at: new Date(),
};
// Update machine_id if provided and current one is a placeholder
if (req.body.machineId && host.machine_id.startsWith("pending-")) {
// Update machine_id if provided and current one is a placeholder or null
if (
req.body.machineId &&
(host.machine_id === null || host.machine_id.startsWith("pending-"))
) {
updateData.machine_id = req.body.machineId;
}