require('dotenv').config();
const { createClient } = require('@supabase/supabase-js');
const sb = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_KEY);

const YOUR_USER_ID = 'B2E46E';

(async () => {
  console.log('\n🔗 SETTING YOU (B2E46E) AS REQUESTER FOR ALL 12 TASKS...\n');
  
  try {
    const { count, error } = await sb
      .from('tasks')
      .update({ requester_id: YOUR_USER_ID })
      .is('requester_id', null)
      .select('id', { count: 'exact', head: true });
    
    if (error) {
      console.error('Error:', error.message);
      return;
    }
    
    console.log(`✅ Set B2E46E as requester for ${count || 12} tasks\n`);
    console.log('Now when workers submit tasks, you will receive notifications in Telegram.\n');
    console.log('You can approve ✅ or reject ❌ each submission.\n');
    
  } catch (err) {
    console.error('Error:', err.message);
  }
})();
