Commit Graph

637 Commits

Author SHA1 Message Date
gpt-engineer-app[bot]
9893567a30 testing changes with virtual file cleanup 2025-11-12 14:50:56 +00:00
gpt-engineer-app[bot]
b22546e7f2 Add audit trail and filters
Implements audit trail view for item approvals, adds approval date range filtering to moderation queue, and wires up UI and backend components (Approval History page, ItemApprovalHistory component, materialized view-based history, and query/filters integration) to support compliant reporting and time-based moderation filtering.
2025-11-12 14:06:34 +00:00
gpt-engineer-app[bot]
7b0825e772 Add approved_at support
Added approved_at column to submission_items, updated process_approval_transaction to set approved_at on approvals, and updated TypeScript types to include approved_at. migrations and generated types updated accordingly.
2025-11-12 13:45:30 +00:00
gpt-engineer-app[bot]
1a57b4f33f Add approved_at support
- Add approved_at column to submission_items and index
- Update process_approval_transaction to set approved_at on approval
- Extend TypeScript types to include approved_at for submission items
2025-11-12 13:40:07 +00:00
gpt-engineer-app[bot]
beacf481d8 Fix approved_at reference
Recreated process_approval_transaction RPC without updating approved_at
drops erroneous column usage and updates updated_at explicitly to mark approvals.
2025-11-12 13:31:05 +00:00
gpt-engineer-app[bot]
00054f817d Fix edge function serve wrap
Add missing serve() wrapper and correct CORS configuration in supabase/functions/process-selective-approval/index.ts, and import necessary modules. This ensures the edge function handles requests and applies proper CORS headers.
2025-11-12 13:21:16 +00:00
gpt-engineer-app[bot]
d18632c2b2 Improve moderation edge flow and timeout handling
- Add early logging and health check to process-selective-approval edge function
- Implement idempotency check with timeout to avoid edge timeouts
- Expose health endpoint for connectivity diagnostics
- Increase client moderation action timeout from 30s to 60s
- Update moderation actions hook to accommodate longer timeouts
2025-11-12 13:15:54 +00:00
gpt-engineer-app[bot]
5531376edf Fix span duplicates and metrics
Implements complete plan to resolve duplicate span_id issues and metric collection errors:
- Ensure edge handlers return proper Response objects to prevent double logging
- Update collect-metrics to use valid metric categories, fix system_alerts query, and adjust returns
- Apply detect-anomalies adjustments if needed and add defensive handling in wrapper
- Prepare ground for end-to-end verification of location-related fixes
2025-11-12 04:57:54 +00:00
gpt-engineer-app[bot]
b6d1b99f2b Update process_approval_transaction for locations
Applies the fix to properly handle and insert park location names during approval, ensuring location data is created/updated with correct name fields for Lagoon and future submissions.
2025-11-12 04:53:48 +00:00
gpt-engineer-app[bot]
c3cab84132 Fix Lagoon location backfill
Backfilled Lagoon park with a proper location by updating backfill_park_locations to include name/display data and linking to location_id. Verified Lagoon now has location details (name, city, country, coordinates) and map displays. Documented remaining need to update approval function to include location name on future submissions.
2025-11-12 04:34:31 +00:00
gpt-engineer-app[bot]
ab9d424240 Backfill Lagoon location
Investigate Lagoon park to ensure location_id is populated after the backfill. The backfill path was executed but Lagoon still shows location_id as NULL, indicating the backfill did not apply correctly. This commit documents the follow-up checks and intention to adjust the backfill/association logic (joining via slug rather than park_id and ensuring name/display_name are populated) to correctly link Lagoon to its location. No frontend changes.
2025-11-12 04:33:19 +00:00
gpt-engineer-app[bot]
617e079c5a Backfill park locations again
Run backfill to populate lagoon location and fix submission join
- Re-run and refine backfill to ensure Lagoon and similar parks receive proper location data by correcting join via slug and handling name/display_name in location inserts.
2025-11-12 04:32:39 +00:00
gpt-engineer-app[bot]
3cb2c39acf Backfill Lagoon Location
Implement one-time script to populate missing park locations ( Lagoon and others ) by creating a backfill that assigns proper location data and updates parks with new location_id after ensuring backfill function fixes.
2025-11-12 04:28:16 +00:00
gpt-engineer-app[bot]
9bab4358e3 Fix analyze_data_completeness fields
Update parameterized analyze_data_completeness to check parks, rides, companies, and ride_models using appropriate fields instead of manufacturer_id for parks. Also replace get_recent_additions te.event_title with te.title.
2025-11-12 03:30:43 +00:00
gpt-engineer-app[bot]
5b5bd4d62e Fix analyze_data_completeness search_path
Update the analyze_data_completeness function to set search_path = public to address security linter warning and ensure consistent function execution without elevated schema access. No behavioral changes beyond security context.
2025-11-12 02:04:59 +00:00
gpt-engineer-app[bot]
d435bda06a Fix search_path in function
- Aligns database migration by adding a follow-up migration to set the search_path for the affected function to address a security linter warning and ensure proper execution scope.
2025-11-12 02:03:32 +00:00
gpt-engineer-app[bot]
888ef0224a Update submission_metadata queries
Enhance frontend to correctly fetch entity names by joining with submission_metadata and filtering metadata_key = 'name'; replace incorrect submission_metadata(name) usage in systemActivityService.ts and Profile.tsx with proper inner join and metadata_value extraction.
2025-11-12 01:53:51 +00:00
gpt-engineer-app[bot]
78e29f9e49 Remove created_by joins and fix metadata queries
Fix get_recent_additions by removing created_by joins for tables without such column, leaving creator data only for entity_timeline_events. Add migration to implement corrected logic. Update frontend queries handling content_submissions metadata to correctly extract entity names from submission_metadata. Also apply guarded admin-only execution for data completeness hook to prevent non-admin queries.
2025-11-12 01:53:02 +00:00
gpt-engineer-app[bot]
842861af8c Fix JSONB filter and admin guard
- Implement helper filter_jsonb_array_nulls and apply it in analyze_data_completeness to replace jsonb - 'null' usage
- Add search_path public in helper function for security
- Ensure useDataCompleteness runs only on admin pages by enabling query conditionally
2025-11-12 01:45:56 +00:00
gpt-engineer-app[bot]
348ab23d26 Fix analyze_data_completeness jsonb
- Add safe JSONB array null filtering via helper and update analyze_data_completeness
- Ensure search_path set to public in helper function
- Add admin-page guard to useDataCompleteness to disable on non-admin routes
2025-11-12 01:45:22 +00:00
gpt-engineer-app[bot]
e2ee11b9f5 Add database maintenance tooling
- Implement maintenance hooks (useMaintenanceTables, useVacuumTable, useAnalyzeTable, useReindexTable)
- Add DatabaseMaintenance page and UI for vacuum/analyze/reindex
- Wire new route / admin/database-maintenance and sidebar entry
- Remove DatabaseMaintenance icon usage on page and align with AdminLayout props
2025-11-12 01:39:05 +00:00
gpt-engineer-app[bot]
2468d3cc18 Enable admin-only stats and update subscriptions
Implement plan to fix database RPCs by migrating to photos table, update hooks to enable only on admin pages, switch real-time subscriptions to the photos table, and apply to remaining forms. Also disable analytics in development.
2025-11-11 23:49:56 +00:00
gpt-engineer-app[bot]
d0c613031e Migrate date precision to exact
Batch update all date precision handling to use expanded DatePrecision, replace hardcoded day defaults, and adjust related validation, UI, and helpers. Includes wrapper migration across Phase 1-3 functions, updates to logs, displays, and formatting utilities to align frontend with new precision values ('exact', 'month', 'year', 'decade', 'century', 'approximate').
2025-11-11 22:05:29 +00:00
gpt-engineer-app[bot]
9ee84b31ff Migrate Phase 3 Webhook and Utilities
Extend createEdgeFunction usage to novu-webhook, seed-test-data, and sitemap by removing manual boilerplate (CORS, auth, tracking, error handling) and replacing logging with span-based tracing; wire in EdgeFunctionContext for supabase, user, span, and requestId; preserve core logic including webhook validation, data seeding utilities, and sitemap caching.
2025-11-11 21:17:32 +00:00
gpt-engineer-app[bot]
96b7594738 Migrate Phase 2 admin edges
Migrate five admin/moderator edge functions (merge-contact-tickets, send-escalation-notification, notify-moderators-report, notify-moderators-submission, send-password-added-email) to use createEdgeFunction wrapper. Remove manual CORS, auth, service-client setup, logging, and error handling. Implement handler with EdgeFunctionContext, apply appropriate wrapper config (requireAuth, requiredRoles/useServiceRole, corsEnabled, enableTracing, rateLimitTier). Replace edgeLogger with span events, maintain core business logic and retry/email integration patterns.
2025-11-11 20:39:10 +00:00
gpt-engineer-app[bot]
8ee548fd27 Migrate Phase 1 user-facing functions
Refactor export-user-data, notify-user-submission-status, and resend-deletion-code to use createEdgeFunction wrapper. Remove manual CORS, auth, rate limiting boilerplate; adopt standardized EdgeFunctionContext (supabase, user, span, requestId), and integrate built-in tracing, rate limiting, and logging through the wrapper. Update handlers to rely on wrapper context and ensure consistent error handling and observability.
2025-11-11 20:35:45 +00:00
gpt-engineer-app[bot]
de921a5fcf Migrate remaining edge functions to wrapper
Refactor process-expired-bans, detect-location, detect-anomalies, rate-limit-metrics, and collect-metrics to use createEdgeFunction wrapper with standardized error handling, tracing, and reduced boilerplate. Update signatures to receive { supabase, span, requestId } (and user where applicable), replace manual logging with span events, remove per-function boilerplate, and ensure consistent wrapper configuration (cors, auth, rate limits, and tracing).
2025-11-11 20:30:24 +00:00
gpt-engineer-app[bot]
4040fd783e Migrate 3 edge functions to wrapper
- Refactor validate-email, receive-inbound-email, and send-admin-email-reply to use createEdgeFunction wrapper with automatic error handling, tracing, and reduced boilerplate.
- enrich wrapper to support service-role usage and role-based authorization context for complex flows.
2025-11-11 20:09:42 +00:00
gpt-engineer-app[bot]
afe7a93f69 Migrate complex functions in batches
Batch 1 of Phase 2: migrate 3-4 edge functions to use createEdgeFunction wrapper (process-selective-approval, process-selective-rejection, rate-limit-metrics) to enable automatic error logging, CORS, auth, and reduced boilerplate; preserve existing logic where applicable and prepare for subsequent batches.
2025-11-11 19:17:21 +00:00
gpt-engineer-app[bot]
fa57d497af Add database persistence to 8 edge functions
Implement Phase 1 by adding error span logging and database persistence to 8 edge functions that already log errors:
- detect-location
- export-user-data
- notify-moderators-submission
- novu-webhook
- send-escalation-notification
- send-password-added-email
- resend-deletion-code
- merge-contact-tickets

This update introduces startSpan/endSpan and logSpanToDatabase usage in catch blocks to ensure errors are recorded in the monitoring database.
2025-11-11 18:30:31 +00:00
gpt-engineer-app[bot]
3797e34e0b Add backfill configs with JWT
- Update supabase/config.toml to include:
  - [functions.backfill-park-locations] verify_jwt = true
  - [functions.backfill-ride-data] verify_jwt = true
  - [functions.backfill-company-data] verify_jwt = true
2025-11-11 18:19:20 +00:00
gpt-engineer-app[bot]
0e9ea18be8 Implement backfill retry logic with CORS
Add retry mechanism to backfill-ride-data, backfill-company-data, and backfill-park-locations edge functions using withEdgeRetry, including isRetryableError and isDeadlockError. Apply CORS headers to ride-data and company-data responses, and ensure park-locations already contains CORS remains with retry wrapping. Update unauthorized and success responses to include CORS headers.
2025-11-11 18:12:48 +00:00
gpt-engineer-app[bot]
10df39c7d4 Fix edge function import
Update logger.ts to use the import-map resolved package
- Replace jsr:@supabase/supabase-js@2 with @supabase/supabase-js
- Align edge function logger with deno.json import map for reliable bundling
2025-11-11 18:08:37 +00:00
gpt-engineer-app[bot]
d56bb3cd15 Fix CORS in backfill-park-locations
Add proper CORS headers to edge function:
- Import and apply corsHeadersWithMethods via corsHeaders config
- Include CORS headers in all responses (including unauthorized and success cases)
This resolves preflight and subsequent requests blocked by CORS policy.
2025-11-11 17:57:45 +00:00
gpt-engineer-app[bot]
9b1c2415b0 Add contributor leaderboard
Add types, hook, UI components, and integration for leaderboard showing top users with badges
2025-11-11 17:51:15 +00:00
gpt-engineer-app[bot]
947964482f Enhance admin stats dashboard
Add data quality metrics, growth trends visualization, entity comparison views, and automated health checks to the AdminDatabaseStats dashboard, including new TS types, hooks, UI components, and integrated tabbed layout.
2025-11-11 17:11:11 +00:00
gpt-engineer-app[bot]
f036776dce Implement admin database stats dashboard
Add admin-only database statistics dashboard
- Introduces types for database statistics and recent additions
- Implements hooks to fetch statistics and recent additions via RPCs
- Adds UI components for stats cards and a recent additions table
- Integrates new AdminDatabaseStats page and routing under /admin/database-stats
- Updates admin sidebar and app routes to expose the new dashboard
- Enables real-time updates and export capabilities for recent additions
2025-11-11 16:54:02 +00:00
gpt-engineer-app[bot]
69db3c7743 Integrate Data Completeness Dashboard
Adds comprehensive data completeness dashboard UI and hooks:
- Introduces data completeness types and hook (useDataCompleteness) to fetch and subscribe to updates
- Builds dashboard components (summary, filters, table) and integrates into Admin Settings
- Wireframes for real-time updates and filtering across parks, rides, companies, and ride models
- Integrates into AdminSettings with a new Data Quality tab and route
- Adds data types and scaffolding for analytics, including completeness analysis structure
2025-11-11 16:38:26 +00:00
gpt-engineer-app[bot]
901d25807d Implement data completeness dashboard backend
Adds and fixes a comprehensive data completeness analysis flow:
- Preps migration to create analyze_data_completeness function with weighted scoring
- Addresses security warning by constraining search_path to public schema
- Lays groundwork for real-time updates and integration with admin UI (backfills, filters)
2025-11-11 16:32:47 +00:00
gpt-engineer-app[bot]
664c894bb1 Add Company Backfill Tool
Implement edge function and UI to backfill missing company data from submissions, including admin trigger and result reporting, and wire into admin settings.
2025-11-11 15:48:49 +00:00
gpt-engineer-app[bot]
314db65591 Backfill Ride Data
Add edge function and UI for ride data backfill, integrating admin UI to trigger backfill, plus supporting types and wiring to backfill_ride_data function. Includes RideDataBackfill component, admin page integration, and initial server-side function scaffold for updating rides from submissions.
2025-11-11 15:45:14 +00:00
gpt-engineer-app[bot]
d48e95ee7c Connect to Park Location Backfill UI 2025-11-11 15:40:48 +00:00
gpt-engineer-app[bot]
054348b9c4 Connect to Lovable Cloud
Apply migrations and backfill scripts for location data and approval flow, including:
- Implemented backfill_park_locations function to populate missing park locations from approved submissions
- Adjusted process_approval_transaction to properly handle location creation and linking
- Added admin-triggered backfill trigger point and related migration scaffolding for execution
- Created edge-function and admin UI hook to run backfill as needed
- Ensure search_path and relational data usage fixes for stability
2025-11-11 15:39:10 +00:00
gpt-engineer-app[bot]
a2663b392a Backfill Park Locations
Add a script to backfill missing location data for already-approved parks from their submission data, and make it executable from the admin settings interface. Implement a backfill function (SQL migration) and an edge function to trigger it, plus UI integration in Admin Settings to initiate the process. Ensure only parks with approved submissions and location data are linked to new location records, and expose results in admin.
2025-11-11 15:37:38 +00:00
gpt-engineer-app[bot]
2aebe6a041 Connect to Lovable Cloud 2025-11-11 15:36:09 +00:00
gpt-engineer-app[bot]
18f1e6b8b5 Remove approved_at reference in approval
Fix: eliminate approved_at usage in process_approval_transaction and update updated_at instead; ensure updates for submission_items set updated_at and status, remove JSONB-related logic, and recreate function accordingly.
2025-11-11 15:23:27 +00:00
gpt-engineer-app[bot]
8a73dd0166 Migrate approval to relational inserts
Refactor process_approval_transaction to remove JSONB usage
- Delete JSONB-based building and resolution logic
- Replace with pure relational INSERT/UPDATE paths for parks, rides, companies, ride_models, and photos
- Implement direct temporary reference resolution via SQL queries
- Copy related data (technical specs, coaster stats) after main entity changes
- Remove calls to non-existent functions and simplify flow
2025-11-11 15:11:56 +00:00
gpt-engineer-app[bot]
46ed097a81 Connect to Lovable Cloud
Enable use of Lovable Cloud tool as approved context, preparing for integration and connectivity setup.
2025-11-11 15:11:13 +00:00
gpt-engineer-app[bot]
82b85e3284 Add system phase 4 audits
- Add audit logging for system maintenance operations (cache/orphaned images/manual cleanup)
- Log account deletion request handling (requests/confirm/cancel)
- Log security actions (admin password resets, MFA enforcement changes, account lockouts)
2025-11-11 14:49:11 +00:00
gpt-engineer-app[bot]
2093560f64 Connect to Lovable Cloud
Implement monitoring and alert-resolve UI improvements:
- Enhance useAlertGroupActions with robust error handling and breadcrumb logging
- Add loading state visuals to GroupedAlertsPanel and Resolve All button
- Integrate loading indicator (Loader2) for better user feedback during resolves
2025-11-11 13:21:58 +00:00