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/assignments/list.cfm
John Mizerek c62895e464 Fix prefixed column names in admin, beacon, task, assignment, chat, rating APIs
Updated all remaining SQL queries to use correct prefixed column names for
ServicePoints, Users, Businesses, Addresses, tt_States, tt_Days, and Hours
tables across 23 admin/infrastructure API files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:55:16 -08:00

46 lines
1.4 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfheader name="Cache-Control" value="no-store">
<cfscript>
function apiAbort(obj) {
writeOutput(serializeJSON(obj));
abort;
}
if (!structKeyExists(request, "BusinessID") || !isNumeric(request.BusinessID) || request.BusinessID LTE 0) {
apiAbort({ OK=false, ERROR="no_business_selected" });
}
</cfscript>
<cfquery name="q" datasource="payfrit">
SELECT
sp.ServicePointID AS ServicePointID,
sp.BeaconID,
sp.ServicePointBusinessID AS BusinessID,
sp.AssignedByUserID,
b.Name AS BeaconName,
b.UUID,
sp.ServicePointName AS ServicePointName
FROM ServicePoints sp
JOIN Beacons b ON b.ID = sp.BeaconID
WHERE sp.ServicePointBusinessID = <cfqueryparam cfsqltype="cf_sql_integer" value="#request.BusinessID#">
AND sp.BeaconID IS NOT NULL
ORDER BY b.Name, sp.ServicePointName
</cfquery>
<cfset assignments = []>
<cfloop query="q">
<cfset arrayAppend(assignments, {
"ServicePointID" = q.ServicePointID,
"BeaconID" = q.BeaconID,
"BusinessID" = q.BusinessID,
"BeaconName" = q.BeaconName,
"UUID" = q.UUID,
"ServicePointName"= q.ServicePointName
})>
</cfloop>
<cfoutput>#serializeJSON({ OK=true, ERROR="", COUNT=arrayLen(assignments), ASSIGNMENTS=assignments })#</cfoutput>