import mongoose from 'mongoose'; import dotenv from 'dotenv'; // Load environment variables dotenv.config(); const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/turbotrades'; const STEAM_ID = '76561198027608071'; // Your Steam ID async function makeAdmin() { try { console.log('šŸ”Œ Connecting to MongoDB...'); await mongoose.connect(MONGODB_URI); console.log('āœ… Connected to MongoDB'); const User = mongoose.model('User', new mongoose.Schema({ username: String, steamId: String, avatar: String, staffLevel: Number, })); console.log(`šŸ” Looking for user with Steam ID: ${STEAM_ID}`); const user = await User.findOne({ steamId: STEAM_ID }); if (!user) { console.error(`āŒ User with Steam ID ${STEAM_ID} not found!`); console.log(' Make sure you have logged in via Steam at least once.'); process.exit(1); } console.log(`āœ… Found user: ${user.username}`); console.log(` Current staff level: ${user.staffLevel || 0}`); // Update staff level to 3 (admin) user.staffLevel = 3; await user.save(); console.log('āœ… Successfully updated user to admin (staffLevel: 3)'); console.log(' You now have access to admin routes:'); console.log(' - POST /api/admin/prices/update'); console.log(' - GET /api/admin/prices/status'); console.log(' - GET /api/admin/prices/missing'); console.log(' - POST /api/admin/prices/estimate'); console.log(' - GET /api/admin/stats'); console.log(' - And more...'); await mongoose.disconnect(); console.log('\nšŸŽ‰ Done! Please restart your backend server.'); process.exit(0); } catch (error) { console.error('āŒ Error:', error.message); process.exit(1); } } makeAdmin();