Commit graph

105 commits

Author SHA1 Message Date
John Mizerek
cf1c6497ca Format date display in perf dashboard (Jan 29, 2026 8:46 PM)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:08:07 -08:00
John Mizerek
bc88f28e60 Fix UserID column references in auth endpoints after schema normalization
Users table primary key was renamed from UserID to ID but these
endpoints still referenced the old column name, causing server_error
on login/signup OTP flow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:15:46 -08:00
John Mizerek
bffca643b5 Restore API performance tracking and fix perf dashboard
- Add queryTimed(), logPerf(), flushPerfBuffer() to environment.cfm
- Auto-create ApiPerfLogs table on first flush
- Hook logPerf into Application.cfm apiAbort for automatic tracking
- Initialize request perf counters in Application.cfm
- Remove local apiAbort() overrides from 7 endpoints
- Instrument 12 high-traffic endpoints with logPerf calls
- Buffer metrics in application scope, batch INSERT every 100 requests
- 30-day auto-cleanup with probabilistic trigger

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:04:12 -08:00
John Mizerek
1210249f54 Normalize database column and table names across entire codebase
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>
2026-01-30 15:39:12 -08:00
John Mizerek
dc9db32b58 Add API performance profiling, caching, and query optimizations
- Add queryTimed() wrapper and logPerf() for per-endpoint timing metrics
- Add api_perf_log table flush mechanism with background thread batching
- Add application-scope cache (appCacheGet/Put/Invalidate) with TTL
- Cache businesses/get (5m), addresses/states (24h), menu/items (2m)
- Fix N+1 queries in orders/history, orders/listForKDS (batch fetch)
- Fix correlated subquery in orders/getDetail (LEFT JOIN)
- Combine 4 queries into 1 in portal/stats (subselects)
- Optimize getForBuilder tree building with pre-indexed parent lookup
- Add cache invalidation in update, saveBrandColor, updateHours, saveFromBuilder
- New admin/perf.cfm dashboard (localhost-protected)
- Instrument top 10 endpoints with queryTimed + logPerf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 20:41:27 -08:00
John Mizerek
a5fa1c1041 Skip empty categories in menu API response
Only include category headers that actually have items assigned
to them, preventing empty categories from showing up in the app.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:29:38 -08:00
John Mizerek
6b31b1abcf Remove time-based filtering from customer menu API
Always return all active menus in the response so chip selector
always appears. Show all items from all menus by default instead
of filtering by current time, which caused empty results outside
menu hours.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:18:10 -08:00
John Mizerek
3b48c3331d Add menu list and MenuID filter to items.cfm API
Returns active menus in response so mobile apps can show menu
selector chips. Accepts optional MenuID param to filter items
to a specific menu.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:54:37 -08:00
John Mizerek
9091461079 Auto-select active menu based on current time, allow manual override
When multiple menus exist, checks current time and day against menu
schedules. If exactly one menu matches, auto-selects it. If times
overlap or none match, shows all categories. User can still manually
select any menu or 'All Menus' from the dropdown.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:13:44 -08:00
John Mizerek
41ef1631ef Allow menu deletion when categories exist - unassign instead of block
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:01:51 -08:00
John Mizerek
3613776ff3 Fix undefined menuName in saveWizard when using provided menuId
The menuName variable was only defined in the else branch (new menu
creation) but referenced later in category logging. Now looks up the
menu name from DB when using a provided menuId.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:54:16 -08:00
John Mizerek
ec6bfdd9c9 Fix menu save: javaCast null breaks variable access in Lucee 7
javaCast('null','') makes the variable truly undefined, causing
'variable doesn't exist' errors when referenced in query params.
Use empty string + len() check instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:33:21 -08:00
John Mizerek
02a19f52be Add menu wizard flow: redirect to setup wizard after creating a new menu
When a new menu is created in Manage Menus, the user is now redirected
to the setup wizard with businessId and menuId params. The wizard skips
business info/header steps and goes straight to photo upload + category
extraction. Backend uses the provided menuId instead of creating a new
menu. Also removes temp debug from menus.cfm.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:08:31 -08:00
John Mizerek
65cf855ade Add menu/menus.cfm to public paths so menu save works
The endpoint was missing from the public paths whitelist in
Application.cfm, causing all requests to fail with not_logged_in.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:57:51 -08:00
John Mizerek
df64f161f3 Add debug tagcontext to menu save error response (temporary)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:56:00 -08:00
John Mizerek
6b4e5cc369 Add cfsqltype hints for nullable time params in menu save
Fixes save failure when MenuStartTime/MenuEndTime are null -
Lucee couldn't determine the SQL type without explicit hints.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:53:34 -08:00
John Mizerek
c6a45f7024 Fix CFML hash escaping in brand color migration script
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:17:46 -08:00
John Mizerek
7bba0fb511 Add one-time script to strip # from existing brand colors
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:11:01 -08:00
John Mizerek
cc96d891b2 Store brand color without # prefix, normalize on output
saveBrandColor.cfm no longer prepends # before storing. API responses
(get.cfm, items.cfm, getForBuilder.cfm) prepend # if missing so
consumers always get a CSS-ready value.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:58:58 -08:00
John Mizerek
8f9da2fbf0 Add Manage Menus toolbar button, photo upload, and various improvements
- Move menu manager button to toolbar next to Save Menu for visibility
- Implement server-side photo upload for menu items
- Strip base64 data URLs from save payload to reduce size
- Add scheduled tasks, quick tasks, ratings, and task categories APIs
- Add vertical support and brand color features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:43:41 -08:00
John Mizerek
0d3c381ed6 Add about.cfm API endpoint for mobile app About screennAdds server-side content for About Payfrit screen allowing content updates without releasing new app versions.nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> 2026-01-28 00:38:58 -08:00
John Mizerek
400df7624f Simplify address API - delivery addresses only
- Remove TypeID/Label from list response
- Hardcode TypeID=2 (delivery) in add endpoint
- Filter to personal addresses only (BusinessID=0 or NULL)
- Just IsDefault flag, no home/work labels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 00:12:18 -08:00
John Mizerek
6d5620d513 Filter out business addresses from user address list 2026-01-28 00:02:25 -08:00
John Mizerek
cadc66e46a Add address types endpoint, fix dev mode SMS skip
- Add /addresses/types.cfm - returns address types list
- Update /addresses/list.cfm - include TypeID in response
- Update /addresses/add.cfm - accept TypeID instead of hardcoded '2'
- Fix loginOTP.cfm and sendOTP.cfm to skip Twilio SMS on dev server

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 00:00:01 -08:00
John Mizerek
d4cc4b4a6c Fix service bell task creation for Android app
- Update create.cfm to handle TaskTypeID for service bell tasks
- Update hud.js to prefer TaskTypeColor/TaskTypeName for task display

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 20:52:59 -08:00
John Mizerek
c5ebb24b39 Fix completeProfile.cfm syntax error
Use mail() service inside cfscript instead of cfmail tag

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 13:33:40 -08:00
John Mizerek
16f63bebe5 Fix seedData.cfm: remove UserEmail column reference
Users table doesn't have email column.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:44:53 -08:00
John Mizerek
3a683751b8 Allow public access to /api/dev/ endpoints
Dev endpoints have their own isDevEnvironment check inside.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:41:26 -08:00
John Mizerek
05cf73446f Add dev environment configuration and tools
- api/config/environment.cfm: Central config for dev vs prod settings
  - Verbose errors, debug logging, magic OTP bypass
  - Rate limiting toggle, email catch-all, token expiry settings
- api/dev/: Development-only endpoints
  - seedData.cfm: Create/reset test users
  - timeTravel.cfm: Manipulate timestamps for testing
  - index.cfm: Dev tools index

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:39:28 -08:00
John Mizerek
8e3bb681e7 Add OTP-based signup page for website onboarding
- New portal/signup.html with phone → OTP → profile flow
- Handle both new users (signup) and existing users (login)
- Auto-detect user type and use appropriate API endpoints
- Show DEV_OTP on page for local testing
- Updated sendOTP.cfm to gracefully handle missing Twilio

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:49:44 -08:00
John Mizerek
ed3f9192d5 Add Task Admin feature to portal
- Add Quick Task Templates: admin creates task shortcuts, tap to create tasks instantly
- Add Scheduled Tasks: admin defines recurring tasks with cron expressions
- New API endpoints: /api/admin/quickTasks/* and /api/admin/scheduledTasks/*
- New database tables: QuickTaskTemplates, ScheduledTaskDefinitions
- Portal UI: Task Admin page with shortcut buttons and scheduled task management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 01:51:41 -08:00
John Mizerek
43a8d18541 Update callServer task endpoint
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 01:40:41 -08:00
John Mizerek
405914c586 Fix subtotal/itemCount null handling in history API
Use val() instead of ?: for SUM results that may be empty strings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:59:33 -08:00
John Mizerek
e9eb708de1 Fix null value handling in setOrderType API
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:41:31 -08:00
John Mizerek
d783f91075 Fix null value handling in setLineItem API
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:40:32 -08:00
John Mizerek
186c3fcf68 Fix null value handling in getActiveCart API
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:39:25 -08:00
John Mizerek
6727f42194 Fix null/empty value handling in order APIs
Wrap numeric fields with val() to prevent "can't cast empty string to number"
errors when database values are null or empty strings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:30:13 -08:00
John Mizerek
5f3f5a7345 Enable address endpoints and switch Stripe to live mode
- Add address list/add/delete/setDefault to public endpoint allowlist
- Switch Stripe from test to live mode for production payments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:26:14 -08:00
John Mizerek
c2ae037e71 App Store Version 2: Multi-menu support, beacon lookup, category scheduling
Features:
- Multi-menu support with time-based availability
- Menu hours validation against business operating hours
- Setup wizard now creates Menu records and links categories
- New menus.cfm API for menu CRUD operations
- Category schedule filtering (day/time based visibility)
- Beacon UUID lookup API for customer app
- Parent/child business relationships for franchises
- Category listing API for menu builder

Portal improvements:
- Menu builder theming to match admin UI
- Brand color picker fix
- Header image preview improvements

API fixes:
- Filter demo/hidden businesses from restaurant list
- Improved error handling throughout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 19:51:44 -08:00
John Mizerek
72f5b7eb12 Filter out demo and hidden businesses from restaurant list
Businesses with BusinessIsDemo=1 or BusinessIsHidden=1 will not appear
in the nearby restaurants list. Hidden businesses will be searchable
in a future update.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:14:45 -08:00
John Mizerek
3df846a31b Fix HUD business name - get from listPending API
The previous approach called getBusiness which requires auth.
Now listPending returns BUSINESS_NAME and HUD uses that.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 20:33:09 -08:00
John Mizerek
30570c3772 Add business name to HUD header, fix portal HUD link
- HUD now displays "Payfrit Tasks - <BusinessName>" by fetching from getBusiness API
- Fixed portal Task HUD button to link to /hud/index.html instead of /hud/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 20:23:52 -08:00
John Mizerek
0dc64b7868 Beacon save: auto-create service point and lt_ link, app is authoritative
- When saving a beacon, automatically create service point with same name
- Create lt_Beacon_Businesses_ServicePoints link record
- If UUID already exists, update instead of creating duplicate
- App is authoritative: reassigns beacon/servicepoint/lt_ to current business

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 14:42:38 -08:00
John Mizerek
31e71068d1 Add note about redundant BusinessID in employee table
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 14:07:58 -08:00
John Mizerek
736b19d0cf Add employee reassignment script for consolidating to VeGainz
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 14:00:29 -08:00
John Mizerek
dc50d82eee Add service points reassign script 2026-01-18 13:56:26 -08:00
John Mizerek
849cea6404 Add expo/pickup tasks for takeaway and delivery orders when kitchen finishes 2026-01-18 13:44:55 -08:00
John Mizerek
13554c1b02 Fix user search to support name, email, and phone 2026-01-18 13:29:25 -08:00
John Mizerek
ef92c86fcc Add team member search/add with phone or email support 2026-01-18 13:27:02 -08:00
John Mizerek
6ead6ddbb7 Add reassign_all to public paths 2026-01-18 13:08:14 -08:00