- Add uploadHeader.cfm API for 1200px header images - Add saveBrandColor.cfm API for hex color storage - Add Branding section to menu builder sidebar - Fix header upload path and permissions - Various beacon and service point API improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
86 lines
3.1 KiB
Text
86 lines
3.1 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
/**
|
|
* Cleanup Lazy Daisy Beacons
|
|
* - Removes duplicate beacons created by setupBeaconTables
|
|
* - Updates original beacons with proper names
|
|
*/
|
|
response = { "OK": false, "steps": [] };
|
|
|
|
try {
|
|
lazyDaisyID = 37;
|
|
|
|
// Delete duplicate assignments for beacons 7, 8, 9
|
|
queryExecute("
|
|
DELETE FROM lt_Beacon_Businesses_ServicePoints
|
|
WHERE BeaconID IN (7, 8, 9) AND BusinessID = :bizId
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
response.steps.append("Deleted duplicate assignments for beacons 7, 8, 9");
|
|
|
|
// Delete duplicate beacons 7, 8, 9
|
|
queryExecute("
|
|
DELETE FROM Beacons
|
|
WHERE BeaconID IN (7, 8, 9) AND BeaconBusinessID = :bizId
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
response.steps.append("Deleted duplicate beacons 7, 8, 9");
|
|
|
|
// Update original beacons with names based on their service point assignments
|
|
// Beacon 4 -> Table 1 (ServicePointID 4)
|
|
// Beacon 5 -> Table 2 (ServicePointID 5)
|
|
// Beacon 6 -> Table 3 (ServicePointID 6)
|
|
|
|
queryExecute("
|
|
UPDATE Beacons SET BeaconName = 'Beacon - Table 1'
|
|
WHERE BeaconID = 4 AND BeaconBusinessID = :bizId
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
response.steps.append("Updated Beacon 4 name to 'Beacon - Table 1'");
|
|
|
|
queryExecute("
|
|
UPDATE Beacons SET BeaconName = 'Beacon - Table 2'
|
|
WHERE BeaconID = 5 AND BeaconBusinessID = :bizId
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
response.steps.append("Updated Beacon 5 name to 'Beacon - Table 2'");
|
|
|
|
queryExecute("
|
|
UPDATE Beacons SET BeaconName = 'Beacon - Table 3'
|
|
WHERE BeaconID = 6 AND BeaconBusinessID = :bizId
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
response.steps.append("Updated Beacon 6 name to 'Beacon - Table 3'");
|
|
|
|
// Get final status
|
|
qFinal = queryExecute("
|
|
SELECT lt.BeaconID, b.BeaconUUID, b.BeaconName, lt.BusinessID, biz.BusinessName, lt.ServicePointID, sp.ServicePointName
|
|
FROM lt_Beacon_Businesses_ServicePoints lt
|
|
JOIN Beacons b ON b.BeaconID = lt.BeaconID
|
|
JOIN Businesses biz ON biz.BusinessID = lt.BusinessID
|
|
LEFT JOIN ServicePoints sp ON sp.ServicePointID = lt.ServicePointID
|
|
WHERE lt.BusinessID = :bizId
|
|
ORDER BY lt.BeaconID
|
|
", { bizId: lazyDaisyID }, { datasource: "payfrit" });
|
|
|
|
beacons = [];
|
|
for (i = 1; i <= qFinal.recordCount; i++) {
|
|
arrayAppend(beacons, {
|
|
"BeaconID": qFinal.BeaconID[i],
|
|
"BeaconName": qFinal.BeaconName[i],
|
|
"UUID": qFinal.BeaconUUID[i],
|
|
"BusinessName": qFinal.BusinessName[i],
|
|
"ServicePointName": qFinal.ServicePointName[i]
|
|
});
|
|
}
|
|
|
|
response.OK = true;
|
|
response.beacons = beacons;
|
|
|
|
} catch (any e) {
|
|
response.error = e.message;
|
|
if (len(e.detail)) {
|
|
response.detail = e.detail;
|
|
}
|
|
}
|
|
|
|
writeOutput(serializeJSON(response));
|
|
</cfscript>
|