mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 20:28:04 +01:00
- Move 100+ files from root to proper directories - Migration scripts → scripts/db/ - SQL files → supabase/sql/archive/ - Test/debug scripts → scripts/test/ - Documentation → docs/archive/ (organized by category) - Shell scripts → scripts/ (organized by category) - Fix test organization - Remove nested tests/unit/tests/unit/ structure - Consolidate test files to proper locations - Update documentation references - Update migration script paths in workflow docs - Update scripts/README.md with moved file notes - Delete placeholder files - Remove empty placeholder.ipynb - Result: Root directory now contains only essential config files - Result: Professional, organized codebase structure - Result: All files in proper locations per project standards See docs/CLEANUP_COMPLETE.md for full details.
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
require('dotenv').config();
|
|
const { createClient } = require('@supabase/supabase-js');
|
|
|
|
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
|
|
|
if (!supabaseUrl || !serviceRoleKey) {
|
|
console.error('Missing environment variables');
|
|
process.exit(1);
|
|
}
|
|
|
|
const supabase = createClient(supabaseUrl, serviceRoleKey);
|
|
|
|
async function checkProfile() {
|
|
const userId = 'd26e6c11-f832-49b0-b0b6-b05a7879f9a4';
|
|
|
|
try {
|
|
console.log('Checking if profile exists for user:', userId);
|
|
const { data, error } = await supabase
|
|
.from('profiles')
|
|
.select('*')
|
|
.eq('id', userId)
|
|
.maybeSingle();
|
|
|
|
if (error) {
|
|
console.error('Error checking profile:', error);
|
|
return;
|
|
}
|
|
|
|
if (data) {
|
|
console.log('Profile exists:', data);
|
|
} else {
|
|
console.log('Profile does not exist, creating...');
|
|
const { data: newProfile, error: insertError } = await supabase
|
|
.from('profiles')
|
|
.insert({
|
|
id: userId,
|
|
username: 'testuser',
|
|
name: 'Test User',
|
|
email: 'test@example.com'
|
|
})
|
|
.select()
|
|
.single();
|
|
|
|
if (insertError) {
|
|
console.error('Error creating profile:', insertError);
|
|
} else {
|
|
console.log('Profile created:', newProfile);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.error('Unexpected error:', error);
|
|
}
|
|
}
|
|
|
|
checkProfile();
|