Add debug endpoint for La Serenata beacon setup
This commit is contained in:
parent
0509e123e7
commit
dd85e7b386
1 changed files with 54 additions and 0 deletions
54
api/debug/serenata.cfm
Normal file
54
api/debug/serenata.cfm
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<cfsetting showdebugoutput="false">
|
||||
<cfsetting enablecfoutputonly="true">
|
||||
<cfcontent type="application/json; charset=utf-8" reset="true">
|
||||
|
||||
<!--- Debug: Show La Serenata business and service points --->
|
||||
<cfquery name="qBiz" datasource="payfrit">
|
||||
SELECT ID, Name, BeaconShardID, BeaconMajor
|
||||
FROM Businesses
|
||||
WHERE Name LIKE '%serenata%'
|
||||
</cfquery>
|
||||
|
||||
<cfif qBiz.recordCount EQ 0>
|
||||
<cfoutput>#serializeJSON({ "OK": false, "ERROR": "No business found" })#</cfoutput>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="qShard" datasource="payfrit">
|
||||
SELECT ID, UUID, IsActive
|
||||
FROM BeaconShards
|
||||
WHERE ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#qBiz.BeaconShardID#">
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="qSP" datasource="payfrit">
|
||||
SELECT ID, Name, BeaconMinor, IsActive
|
||||
FROM ServicePoints
|
||||
WHERE BusinessID = <cfqueryparam cfsqltype="cf_sql_integer" value="#qBiz.ID#">
|
||||
ORDER BY SortOrder, Name
|
||||
</cfquery>
|
||||
|
||||
<cfset spList = []>
|
||||
<cfloop query="qSP">
|
||||
<cfset arrayAppend(spList, {
|
||||
"ID": qSP.ID,
|
||||
"Name": qSP.Name,
|
||||
"BeaconMinor": isNull(qSP.BeaconMinor) ? "NULL" : val(qSP.BeaconMinor),
|
||||
"IsActive": qSP.IsActive
|
||||
})>
|
||||
</cfloop>
|
||||
|
||||
<cfoutput>#serializeJSON({
|
||||
"OK": true,
|
||||
"Business": {
|
||||
"ID": qBiz.ID,
|
||||
"Name": qBiz.Name,
|
||||
"BeaconShardID": val(qBiz.BeaconShardID),
|
||||
"BeaconMajor": val(qBiz.BeaconMajor)
|
||||
},
|
||||
"Shard": qShard.recordCount GT 0 ? {
|
||||
"ID": qShard.ID,
|
||||
"UUID": qShard.UUID,
|
||||
"IsActive": qShard.IsActive
|
||||
} : "NOT FOUND",
|
||||
"ServicePoints": spList
|
||||
})#</cfoutput>
|
||||
Reference in a new issue