Add Johns Beverages debug endpoint
This commit is contained in:
parent
b8cf2ce150
commit
133f57f689
1 changed files with 42 additions and 0 deletions
42
api/debug/johns.cfm
Normal file
42
api/debug/johns.cfm
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<cfsetting showdebugoutput="false">
|
||||
<cfsetting enablecfoutputonly="true">
|
||||
<cfcontent type="application/json; charset=utf-8" reset="true">
|
||||
|
||||
<cfquery name="qBiz" datasource="payfrit">
|
||||
SELECT ID, Name, BeaconShardID, BeaconMajor
|
||||
FROM Businesses
|
||||
WHERE Name LIKE '%john%beverages%' OR Name LIKE '%john\'s beverages%'
|
||||
</cfquery>
|
||||
|
||||
<cfif qBiz.recordCount EQ 0>
|
||||
<cfoutput>#serializeJSON({ "OK": false, "ERROR": "No business found" })#</cfoutput>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<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)
|
||||
},
|
||||
"ServicePoints": spList
|
||||
})#</cfoutput>
|
||||
Reference in a new issue