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/addresses/states.cfm
John Mizerek 8acf2f3249 Complete DB column normalization: strip redundant table-name prefixes from all SQL queries
Updated 70 files to match the payfrit_dev schema where columns like
BusinessName→Name, UserFirstName→FirstName, AddressCity→City, etc.
PKs renamed to ID, FKs keep referenced table name (e.g. BusinessID).
SQL aliases preserve original JSON response keys for API compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:03:40 -08:00

35 lines
833 B
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8">
<!--- List US states for address forms --->
<cfscript>
try {
qStates = queryExecute("
SELECT ID as StateID, Abbreviation as StateAbbreviation, Name as StateName
FROM tt_States
ORDER BY Name
", {}, { datasource: "payfrit" });
states = [];
for (row in qStates) {
arrayAppend(states, {
"StateID": row.StateID,
"Abbr": row.StateAbbreviation,
"Name": row.StateName
});
}
writeOutput(serializeJSON({
"OK": true,
"STATES": states
}));
} catch (any e) {
writeOutput(serializeJSON({
"OK": false,
"ERROR": "server_error",
"MESSAGE": e.message
}));
}
</cfscript>