- Fix for...in loops on query results in getForBuilder.cfm (only iterated once) - Remove illegal var keyword from loop variables in saveWizard.cfm - Only create food running tasks for dine-in orders (skip takeaway/delivery) - Add image preview modal for modifier source images in wizard - Add data clearing utilities (clearAllData, clearOrders) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Text
50 lines
1.5 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfset request.skipAuth = true>
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
response = { "OK": false };
|
|
|
|
try {
|
|
requestBody = toString(getHttpRequestData().content);
|
|
requestData = {};
|
|
if (len(requestBody)) {
|
|
requestData = deserializeJSON(requestBody);
|
|
}
|
|
|
|
confirmDelete = requestData.confirm ?: "";
|
|
|
|
if (confirmDelete != "NUKE_EVERYTHING") {
|
|
throw("Must pass confirm: 'NUKE_EVERYTHING' to proceed");
|
|
}
|
|
|
|
// Get counts before deletion
|
|
qItemCount = queryExecute("SELECT COUNT(*) as cnt FROM Items", {}, { datasource: "payfrit" });
|
|
qCatCount = queryExecute("SELECT COUNT(*) as cnt FROM Categories", {}, { datasource: "payfrit" });
|
|
qLinkCount = queryExecute("SELECT COUNT(*) as cnt FROM ItemTemplateLinks", {}, { datasource: "payfrit" });
|
|
|
|
// Delete in correct order (foreign key constraints)
|
|
queryExecute("DELETE FROM ItemTemplateLinks", {}, { datasource: "payfrit" });
|
|
queryExecute("DELETE FROM Items", {}, { datasource: "payfrit" });
|
|
queryExecute("DELETE FROM Categories", {}, { datasource: "payfrit" });
|
|
|
|
response = {
|
|
"OK": true,
|
|
"deleted": {
|
|
"items": qItemCount.cnt,
|
|
"categories": qCatCount.cnt,
|
|
"templateLinks": qLinkCount.cnt
|
|
}
|
|
};
|
|
|
|
} catch (any e) {
|
|
response = {
|
|
"OK": false,
|
|
"ERROR": e.message,
|
|
"DETAIL": e.detail ?: ""
|
|
};
|
|
}
|
|
|
|
writeOutput(serializeJSON(response));
|
|
</cfscript>
|