This repository has been archived on 2026-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
payfrit-biz/api/admin/_scripts/setupBigDeansStations.cfm
John 16a3b7c9a3 Replace queryExecute with queryTimed across all endpoints for perf tracking
Converts 200+ endpoint files to use queryTimed() wrapper which tracks
DB query count and execution time. Restores perf dashboard files that
were accidentally moved to _scripts/. Includes portal UI updates.
2026-02-02 00:28:37 -08:00

60 lines
1.6 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
businessId = 27; // Big Dean's
response = { "OK": false };
try {
// Check if Big Dean's already has stations
existing = queryTimed("
SELECT COUNT(*) as cnt FROM Stations WHERE BusinessID = :bizId
", { bizId: businessId });
if (existing.cnt == 0) {
// Insert Kitchen station
queryTimed("
INSERT INTO Stations (BusinessID, Name, Color, SortOrder, IsActive)
VALUES (:bizId, 'Kitchen', :color1, 1, 1)
", { bizId: businessId, color1: "##FF5722" });
// Insert Bar station
queryTimed("
INSERT INTO Stations (BusinessID, Name, Color, SortOrder, IsActive)
VALUES (:bizId, 'Bar', :color2, 2, 1)
", { bizId: businessId, color2: "##2196F3" });
response["ACTION"] = "inserted";
} else {
response["ACTION"] = "already_exists";
}
// Get current stations
stations = queryTimed("
SELECT ID, Name, Color, SortOrder
FROM Stations
WHERE BusinessID = :bizId AND IsActive = 1
ORDER BY SortOrder
", { bizId: businessId });
stationArr = [];
for (s in stations) {
arrayAppend(stationArr, {
"StationID": s.ID,
"Name": s.Name,
"Color": s.Color
});
}
response["OK"] = true;
response["BUSINESS_ID"] = businessId;
response["STATIONS"] = stationArr;
} catch (any e) {
response["ERROR"] = e.message;
response["DETAIL"] = e.detail;
}
writeOutput(serializeJSON(response));
</cfscript>