Update all SQL queries, query result references, and ColdFusion code to match
the renamed database schema. Tables use plural CamelCase, PKs are all `ID`,
column prefixes stripped (e.g. BusinessName→Name, UserFirstName→FirstName).
Key changes:
- Strip table-name prefixes from all column references (Businesses, Users,
Addresses, Hours, Menus, Categories, Items, Stations, Orders,
OrderLineItems, Tasks, TaskCategories, TaskRatings, QuickTaskTemplates,
ScheduledTaskDefinitions, ChatMessages, Beacons, ServicePoints, Employees,
VisitorTrackings, ApiPerfLogs, tt_States, tt_Days, tt_AddressTypes,
tt_OrderTypes, tt_TaskTypes)
- Rename PK references from {TableName}ID to ID in all queries
- Rewrite 7 admin beacon files to use ServicePoints.BeaconID instead of
dropped lt_Beacon_Businesses_ServicePoints link table
- Rewrite beacon assignment files (list, save, delete) for new schema
- Fix FK references incorrectly changed to ID (OrderLineItems.OrderID,
Categories.MenuID, Tasks.CategoryID, ServicePoints.BeaconID)
- Update Addresses: AddressLat→Latitude, AddressLng→Longitude
- Update Users: UserPassword→Password, UserIsEmailVerified→IsEmailVerified,
UserIsActive→IsActive, UserBalance→Balance, etc.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
124 lines
4 KiB
Text
124 lines
4 KiB
Text
<cfscript>
|
|
/**
|
|
* Environment Configuration
|
|
*
|
|
* Controls dev vs production behavior.
|
|
* This file should have DIFFERENT values on dev vs biz servers.
|
|
*
|
|
* dev.payfrit.com: isDevEnvironment = true
|
|
* biz.payfrit.com: isDevEnvironment = false
|
|
*/
|
|
|
|
// ============================================
|
|
// ENVIRONMENT FLAG - CHANGE PER SERVER
|
|
// ============================================
|
|
isDevEnvironment = true; // Set to FALSE on biz.payfrit.com
|
|
|
|
// ============================================
|
|
// ERROR HANDLING
|
|
// ============================================
|
|
// Dev: Show full stack traces
|
|
// Prod: Show generic "server error" message
|
|
application.showDetailedErrors = isDevEnvironment;
|
|
|
|
// ============================================
|
|
// DEBUG LOGGING
|
|
// ============================================
|
|
// Dev: Log all API requests/responses
|
|
// Prod: Minimal logging
|
|
application.debugLogging = isDevEnvironment;
|
|
application.logDirectory = expandPath("/api/logs/");
|
|
|
|
// ============================================
|
|
// RATE LIMITING
|
|
// ============================================
|
|
// Dev: No rate limits
|
|
// Prod: Enforce rate limits
|
|
application.enableRateLimiting = !isDevEnvironment;
|
|
application.rateLimitPerMinute = 60; // requests per minute per IP
|
|
|
|
// ============================================
|
|
// EMAIL HANDLING
|
|
// ============================================
|
|
// Dev: Send all emails to catch-all address
|
|
// Prod: Send to real recipients
|
|
application.emailCatchAll = isDevEnvironment ? "dev-emails@payfrit.com" : "";
|
|
application.emailEnabled = !isDevEnvironment ? true : false; // Disable emails on dev entirely
|
|
|
|
// ============================================
|
|
// MAGIC OTP (for testing)
|
|
// ============================================
|
|
// Dev: Allow magic phone number to bypass OTP
|
|
// Prod: Disabled
|
|
application.MAGIC_OTP_ENABLED = isDevEnvironment;
|
|
application.MAGIC_OTP_CODE = "123456";
|
|
application.MAGIC_PHONE_NUMBERS = ["5555555555", "0000000000"];
|
|
|
|
// ============================================
|
|
// STRIPE MODE
|
|
// ============================================
|
|
// Already handled in stripe.cfm, but good to have reference
|
|
application.stripeTestMode = isDevEnvironment;
|
|
|
|
// ============================================
|
|
// API RESPONSE EXTRAS
|
|
// ============================================
|
|
// Dev: Include debug info in API responses (timing, queries, etc)
|
|
// Prod: Minimal responses
|
|
application.includeDebugInResponse = isDevEnvironment;
|
|
|
|
// ============================================
|
|
// SESSION/TOKEN SETTINGS
|
|
// ============================================
|
|
// Dev: Longer token expiry for easier testing
|
|
// Prod: Normal expiry
|
|
application.tokenExpiryHours = isDevEnvironment ? 720 : 24; // 30 days vs 1 day
|
|
|
|
// ============================================
|
|
// HELPER FUNCTIONS
|
|
// ============================================
|
|
function isDev() {
|
|
return structKeyExists(application, "isDevEnvironment") && application.isDevEnvironment;
|
|
}
|
|
|
|
function logDebug(message, data = {}) {
|
|
if (!application.debugLogging) return;
|
|
|
|
var logFile = application.logDirectory & "debug_" & dateFormat(now(), "yyyy-mm-dd") & ".log";
|
|
var logLine = "[" & timeFormat(now(), "HH:mm:ss") & "] " & message;
|
|
|
|
if (!structIsEmpty(data)) {
|
|
logLine &= " | " & serializeJSON(data);
|
|
}
|
|
|
|
try {
|
|
if (!directoryExists(application.logDirectory)) {
|
|
directoryCreate(application.logDirectory);
|
|
}
|
|
fileAppend(logFile, logLine & chr(10));
|
|
} catch (any e) {
|
|
// Silent fail - don't break app if logging fails
|
|
}
|
|
}
|
|
|
|
function apiError(message, detail = "", statusCode = 500) {
|
|
var response = {
|
|
"OK": false,
|
|
"ERROR": "server_error",
|
|
"MESSAGE": application.showDetailedErrors ? message : "An error occurred"
|
|
};
|
|
|
|
if (application.showDetailedErrors && len(detail)) {
|
|
response["DETAIL"] = detail;
|
|
response["STACK"] = "";
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
// Store in application scope
|
|
application.isDevEnvironment = isDevEnvironment;
|
|
application.isDev = isDev;
|
|
application.logDebug = logDebug;
|
|
application.apiError = apiError;
|
|
</cfscript>
|