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/updateBigDeans.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

81 lines
2.2 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
// Update Big Dean's business info
businessId = 27;
// Big Dean's actual info
phone = "(310) 393-2666";
hours = "Mon-Thu: 11am-10pm, Fri-Sat: 11am-11pm, Sun: 11am-10pm";
try {
// Update phone and hours on Businesses table
queryTimed("
UPDATE Businesses
SET Phone = :phone,
Hours = :hours
WHERE ID = :bizId
", {
phone: phone,
hours: hours,
bizId: businessId
}, { datasource: "payfrit" });
// Update or insert address in Addresses table
qAddr = queryTimed("
SELECT ID FROM Addresses
WHERE BusinessID = :bizId AND IsDeleted = 0
LIMIT 1
", { bizId: businessId }, { datasource: "payfrit" });
if (qAddr.recordCount > 0) {
queryTimed("
UPDATE Addresses
SET Line1 = :line1, City = :city, ZIPCode = :zip
WHERE ID = :addrId
", {
line1: "1615 Ocean Front Walk",
city: "Santa Monica",
zip: "90401",
addrId: qAddr.ID
}, { datasource: "payfrit" });
} else {
queryTimed("
INSERT INTO Addresses (BusinessID, UserID, AddressTypeID, Line1, City, ZIPCode, AddedOn)
VALUES (:bizId, 0, 'business', :line1, :city, :zip, NOW())
", {
bizId: businessId,
line1: "1615 Ocean Front Walk",
city: "Santa Monica",
zip: "90401"
}, { datasource: "payfrit" });
}
// Get updated record
updated = queryTimed("
SELECT ID, Name, Phone, Hours
FROM Businesses
WHERE ID = :bizId
", { bizId: businessId }, { datasource: "payfrit" });
writeOutput(serializeJSON({
"OK": true,
"MESSAGE": "Updated Big Dean's info",
"BUSINESS": {
"BusinessID": updated.ID,
"Name": updated.Name,
"Phone": updated.Phone,
"Hours": updated.Hours
}
}));
} catch (any e) {
writeOutput(serializeJSON({
"OK": false,
"ERROR": e.message,
"DETAIL": e.detail
}));
}
</cfscript>