feat: Complete platform enhancement with multi-tenant architecture
Major additions: - Territory manager system with application workflow - Custom pricing and page builder with Craft.js - Enhanced Stripe Connect onboarding - CodeReadr QR scanning integration - Kiosk mode for venue sales - Super admin dashboard and analytics - MCP integration for AI-powered operations Infrastructure improvements: - Centralized API client and routing system - Enhanced authentication with organization context - Comprehensive theme management system - Advanced event management with custom tabs - Performance monitoring and accessibility features Database schema updates: - Territory management tables - Custom pages and pricing structures - Kiosk PIN system - Enhanced organization profiles - CodeReadr integration tables 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
60
promote-to-admin.js
Normal file
60
promote-to-admin.js
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import { config } from 'dotenv';
|
||||
|
||||
// Load environment variables
|
||||
config();
|
||||
|
||||
const supabaseUrl = process.env.SUPABASE_URL || process.env.PUBLIC_SUPABASE_URL;
|
||||
const supabaseServiceKey = process.env.SUPABASE_SERVICE_KEY;
|
||||
|
||||
if (!supabaseUrl || !supabaseServiceKey) {
|
||||
console.error('Missing required environment variables: SUPABASE_URL and SUPABASE_SERVICE_KEY');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
||||
|
||||
async function promoteUserToAdmin() {
|
||||
const email = process.argv[2];
|
||||
|
||||
if (!email) {
|
||||
console.error('Usage: node promote-to-admin.js <email>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`Promoting ${email} to admin...`);
|
||||
|
||||
// First, find the user
|
||||
const { data: users, error: userError } = await supabase.auth.admin.listUsers();
|
||||
if (userError) throw userError;
|
||||
|
||||
const user = users.users.find(u => u.email === email);
|
||||
if (!user) {
|
||||
console.error(`User with email ${email} not found`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Update user role to admin
|
||||
const { error: updateError } = await supabase
|
||||
.from('users')
|
||||
.upsert({
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
role: 'admin'
|
||||
});
|
||||
|
||||
if (updateError) throw updateError;
|
||||
|
||||
console.log(`✅ Successfully promoted ${email} to admin!`);
|
||||
console.log(`User ID: ${user.id}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error promoting user to admin:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
promoteUserToAdmin();
|
||||
Reference in New Issue
Block a user