Monorepo for Aesthetic.Computer aesthetic.computer
at main 31 lines 943 B view raw
1#!/usr/bin/env node 2// query-unhandled.mjs - Find an unhandled user 3 4import { connect } from '../../../system/backend/database.mjs'; 5 6try { 7 const database = await connect(); 8 const handles = database.db.collection('@handles'); 9 const verifications = database.db.collection('verifications'); 10 11 console.log(`\n🔍 Finding unhandled users...\n`); 12 13 // Get a verified user who is NOT in @handles 14 const allVerified = await verifications.find({}).limit(100).toArray(); 15 16 for (const verified of allVerified) { 17 const handleRecord = await handles.findOne({ _id: verified._id }); 18 if (!handleRecord) { 19 console.log('Found unhandled user:'); 20 console.log('Sub:', verified._id); 21 console.log('Verification count:', verified.count); 22 console.log('No @handles record\n'); 23 break; 24 } 25 } 26 27 await database.disconnect(); 28} catch (error) { 29 console.error('❌ Error:', error.message); 30 process.exit(1); 31}