Task System: - Tasks auto-created when KDS marks order Ready (status 3) - Duplicate task prevention via TaskOrderID check - Task completion now marks associated order as Completed (status 4) - Fixed isNull() check for TaskCompletedOn (use len() instead) - Added TaskOrderID to task queries for order linking Worker APIs: - api/workers/myBusinesses.cfm with GROUP BY to prevent duplicates - api/tasks/listMine.cfm for worker's claimed tasks with filters - api/tasks/complete.cfm updates both task and order status - api/tasks/accept.cfm for claiming tasks KDS/Portal: - KDS only shows orders with status < 4 - Portal dashboard improvements Admin/Debug: - Debug endpoints for tasks and businesses - Test data reset endpoint 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
57 lines
1.9 KiB
Text
57 lines
1.9 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
|
|
<cffunction name="apiAbort" access="public" returntype="void" output="true">
|
|
<cfargument name="payload" type="struct" required="true">
|
|
<cfcontent type="application/json; charset=utf-8">
|
|
<cfoutput>#serializeJSON(arguments.payload)#</cfoutput>
|
|
<cfabort>
|
|
</cffunction>
|
|
|
|
<cftry>
|
|
<!--- Disable foreign key checks temporarily --->
|
|
<cfset queryExecute("SET FOREIGN_KEY_CHECKS = 0", [], { datasource = "payfrit" })>
|
|
|
|
<!--- Clear Tasks --->
|
|
<cfset queryExecute("DELETE FROM Tasks", [], { datasource = "payfrit" })>
|
|
|
|
<!--- Clear Payments --->
|
|
<cftry>
|
|
<cfset queryExecute("DELETE FROM Payments", [], { datasource = "payfrit" })>
|
|
<cfcatch></cfcatch>
|
|
</cftry>
|
|
|
|
<!--- Clear OrderLineItemModifiers if exists --->
|
|
<cftry>
|
|
<cfset queryExecute("DELETE FROM OrderLineItemModifiers", [], { datasource = "payfrit" })>
|
|
<cfcatch></cfcatch>
|
|
</cftry>
|
|
|
|
<!--- Clear OrderLineItems --->
|
|
<cfset queryExecute("DELETE FROM OrderLineItems", [], { datasource = "payfrit" })>
|
|
|
|
<!--- Clear Orders --->
|
|
<cfset queryExecute("DELETE FROM Orders", [], { datasource = "payfrit" })>
|
|
|
|
<!--- Re-enable foreign key checks --->
|
|
<cfset queryExecute("SET FOREIGN_KEY_CHECKS = 1", [], { datasource = "payfrit" })>
|
|
|
|
<!--- Reset auto-increment counters --->
|
|
<cfset queryExecute("ALTER TABLE Tasks AUTO_INCREMENT = 1", [], { datasource = "payfrit" })>
|
|
<cfset queryExecute("ALTER TABLE Orders AUTO_INCREMENT = 1", [], { datasource = "payfrit" })>
|
|
<cfset queryExecute("ALTER TABLE OrderLineItems AUTO_INCREMENT = 1", [], { datasource = "payfrit" })>
|
|
|
|
<cfset apiAbort({
|
|
"OK": true,
|
|
"MESSAGE": "All test data cleared successfully. Orders, OrderLineItems, and Tasks tables have been reset."
|
|
})>
|
|
|
|
<cfcatch>
|
|
<cfset apiAbort({
|
|
"OK": false,
|
|
"ERROR": "reset_failed",
|
|
"MESSAGE": cfcatch.message,
|
|
"DETAIL": cfcatch.detail
|
|
})>
|
|
</cfcatch>
|
|
</cftry>
|