payfrit-works/api/admin/switchBeacons.cfm
John Mizerek 51a80b537d Add local dev support and fix menu builder API
Portal local development:
- Add BASE_PATH detection to all portal files (login, portal.js, menu-builder, station-assignment)
- Allows portal to work at /biz.payfrit.com/ path locally

Menu Builder fixes:
- Fix duplicate template options in getForBuilder.cfm query
- Filter template children by business ID with DISTINCT

New APIs:
- api/portal/myBusinesses.cfm - List businesses for logged-in user
- api/stations/list.cfm - List KDS stations
- api/menu/updateStations.cfm - Update item station assignments
- api/setup/reimportBigDeans.cfm - Full Big Dean's menu import script

Admin utilities:
- Various debug and migration scripts for menu/template management
- Beacon switching, category cleanup, modifier template setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 22:47:12 -08:00

38 lines
994 B
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
// Switch all beacons from one business to another
fromBiz = 17; // In-N-Out
toBiz = 27; // Big Dean's
queryExecute("
UPDATE lt_Beacon_Businesses_ServicePoints
SET BusinessID = :toBiz
WHERE BusinessID = :fromBiz
", { toBiz: toBiz, fromBiz: fromBiz }, { datasource: "payfrit" });
// Get current state
q = queryExecute("
SELECT lt.*, b.BusinessName
FROM lt_Beacon_Businesses_ServicePoints lt
JOIN Businesses b ON b.BusinessID = lt.BusinessID
", {}, { datasource: "payfrit" });
rows = [];
for (row in q) {
arrayAppend(rows, {
"BeaconID": row.BeaconID,
"BusinessID": row.BusinessID,
"BusinessName": row.BusinessName,
"ServicePointID": row.ServicePointID
});
}
writeOutput(serializeJSON({
"OK": true,
"MESSAGE": "Switched beacons from BusinessID #fromBiz# to #toBiz#",
"MAPPINGS": rows
}));
</cfscript>