feat: implement merchant dashboard, secure auth, and short_id system
- Added dedicated merchant dashboard with analytics and transactions - Implemented API Key based authentication for merchants - Introduced 8-character Short IDs for merchants to use in URLs - Refactored checkout and payment intent APIs to support multi-gateway - Enhanced Landing Page with Merchant Portal access and marketing copy - Fixed Next.js 15 async params build issues - Updated internal branding to P2CGateway - Added AyrisTech credits to footer
This commit is contained in:
25
docs/update_schema_short_ids.sql
Normal file
25
docs/update_schema_short_ids.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Add short_id column to merchants
|
||||
ALTER TABLE merchants ADD COLUMN IF NOT EXISTS short_id TEXT UNIQUE;
|
||||
|
||||
-- Function to generate a random short ID
|
||||
CREATE OR REPLACE FUNCTION generate_short_id() RETURNS TEXT AS $$
|
||||
DECLARE
|
||||
chars TEXT := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
result TEXT := '';
|
||||
i INTEGER := 0;
|
||||
BEGIN
|
||||
FOR i IN 1..8 LOOP
|
||||
result := result || substr(chars, floor(random() * length(chars) + 1)::integer, 1);
|
||||
END LOOP;
|
||||
RETURN result;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- Update existing merchants with a short_id
|
||||
UPDATE merchants SET short_id = generate_short_id() WHERE short_id IS NULL;
|
||||
|
||||
-- Make short_id required for further inserts
|
||||
-- ALTER TABLE merchants ALTER COLUMN short_id SET NOT NULL; -- Can do this after update
|
||||
|
||||
-- Add owner_id to merchants to link with Supabase Auth users
|
||||
ALTER TABLE merchants ADD COLUMN IF NOT EXISTS owner_id UUID REFERENCES auth.users(id);
|
||||
Reference in New Issue
Block a user