Commit graph

8 commits

Author SHA1 Message Date
John Mizerek
89ec86c9d2 Move 70 one-off admin scripts to api/admin/_scripts/ (gitignored)
Only quickTasks/ and scheduledTasks/ subdirectories remain tracked
since those are actively used by the portal.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:38:49 -08:00
John Mizerek
78035e9cf6 Fix remaining prefixed DB column names across 17 API files
Hours: HoursBusinessID/HoursDayID/HoursOpenTime/HoursClosingTime -> BusinessID/DayID/OpenTime/ClosingTime
ServicePoints: ServicePointID/ServicePointName/ServicePointBusinessID -> ID/Name/BusinessID
Users: UserFirstName/UserLastName/UserEmailAddress/UserContactNumber -> FirstName/LastName/EmailAddress/ContactNumber
Orders: BusinessDeliveryMultiplier -> DeliveryMultiplier (column renamed in dev DB)
Businesses: BusinessParentBusinessID -> ParentBusinessID
tt_Days: tt_DayID/tt_DayName -> ID/Name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:35:24 -08:00
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
John Mizerek
c62895e464 Fix prefixed column names in admin, beacon, task, assignment, chat, rating APIs
Updated all remaining SQL queries to use correct prefixed column names for
ServicePoints, Users, Businesses, Addresses, tt_States, tt_Days, and Hours
tables across 23 admin/infrastructure API files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:55:16 -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
ec81af5cdd Add business info, order details, beacon management, and admin tools
API Improvements:
- api/businesses/get.cfm: Fetch address from Addresses table, hours from Hours table
- api/tasks/getDetails.cfm: Add CustomerPhone field from UserContactNumber
- api/orders/getDetail.cfm: New endpoint for order details with line items
- api/Application.cfm: Add new admin endpoints to public allowlist

Admin Tools:
- api/admin/beaconStatus.cfm: View all beacon-to-business mappings
- api/admin/updateBeaconMapping.cfm: Change beacon business assignment
- api/admin/setupBigDeansInfo.cfm: Set Big Dean's address and hours
- api/admin/listTables.cfm: List all database tables
- api/admin/describeTable.cfm: Get table structure and sample data
- api/admin/randomizePrices.cfm: Randomize item prices for testing
- Various Big Dean's debug/update scripts

Portal Enhancements:
- Enhanced CSS styling for portal pages
- Improved portal.js functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 11:45:21 -08:00
John Mizerek
d225133c68 Add menu builder required selection UI and fix portal issues
Menu Builder - Required Selections:
- Added "Selection Rules" section for modifier groups
- Required (Yes/No) dropdown to mark if customer must select an option
- Max Selections input (0 = unlimited) to limit selections
- Visual "Required" badge (red) and "Max X" badge in modifier list
- Updated saveFromBuilder.cfm to persist ItemRequiresChildSelection
  and ItemMaxNumSelectionReq to database

Portal Fixes:
- Fixed menu-builder link to include BASE_PATH for local dev
- Fixed stats.cfm to not reference non-existent Categories table
- Menu items count now uses ItemParentItemID > 0 (not ItemCategoryID)

Stripe Configuration:
- Added api/config/stripe.cfm for centralized Stripe key management
- Supports test/live mode switching
- Fee configuration variables (5% customer, 5% business, 2.9% + $0.30 card)

Payment Intent API:
- Updated createPaymentIntent.cfm with proper fee structure
- Customer pays: subtotal + tax + tip + 5% Payfrit fee + card processing
- Platform receives 10% total (5% from customer + 5% from business)
- Saves fee breakdown to order record

Beacon Management:
- Updated switchBeacons.cfm to move beacons between businesses
- Currently configured: Big Dean's (27) -> In-N-Out (17)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 01:56:12 -08:00
John Mizerek
51a80b537d Add local dev support and fix menu builder API
Portal local development:
- Add BASE_PATH detection to all portal files (login, portal.js, menu-builder, station-assignment)
- Allows portal to work at /biz.payfrit.com/ path locally

Menu Builder fixes:
- Fix duplicate template options in getForBuilder.cfm query
- Filter template children by business ID with DISTINCT

New APIs:
- api/portal/myBusinesses.cfm - List businesses for logged-in user
- api/stations/list.cfm - List KDS stations
- api/menu/updateStations.cfm - Update item station assignments
- api/setup/reimportBigDeans.cfm - Full Big Dean's menu import script

Admin utilities:
- Various debug and migration scripts for menu/template management
- Beacon switching, category cleanup, modifier template setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 22:47:12 -08:00