Skip to content

Conversation

@neeleshseerapu
Copy link
Contributor

Key Changes:

  • Added RLS to tables Tickets and Ticket-items.
  • Added order to a config file so that migration files work properly

Specifics (Generated with Co-Pilot):
This pull request introduces significant changes to the tickets and ticket_items system, focusing on improving database integrity, updating row-level security (RLS) policies, and aligning TypeScript models and test components with these backend updates. The main themes are database schema updates, RLS policy enhancements for better authorization, and frontend/test code adjustments to reflect these changes.

Database schema and policy updates

  • Replaced inventory_item_id with store_item_id in the ticket_items table and added/validated foreign key constraints for both ticket_items and tickets tables to ensure referential integrity. [1] [2] [3]
  • Overhauled row-level security policies for both tables: now only authenticated users with appropriate roles or ownership can read, insert, update, or delete tickets and ticket_items. This replaces previous "public can ..." policies with more restrictive, role-based policies. [1] [2] [3]

TypeScript model and test component updates

  • Updated the TicketItem type, replacing inventory_item_id with store_item_id, and adjusted all related test data and usage in TicketItemsTestComponent. [1] [2]
  • Modified test components to use new test IDs and field names, and updated quantity change logic to match new test scenarios. [1] [2]
  • Enhanced the TicketsTestComponent to fetch and display tickets from the database, reflecting the new RLS policies and foreign key constraints in the frontend. [1] [2]

Configuration and test data changes

  • Updated Supabase configuration to include new schema files for functions, stores, and tickets, ensuring migrations and schema changes are properly loaded.
  • Changed test credentials in AuthTestComponent for improved test isolation and clarity.

These changes together strengthen the security model, enforce better data relationships, and ensure the frontend and test code match the backend structure and policies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants