chinak2 / server /check-admin-users.js
shanshel6
chore: bump version to 1.0.18, fix type errors, prepare for release
9913f6e
Raw History Blame Contribute Delete
835 Bytes
import { PrismaClient } from '@prisma/client';
async function checkAdminUsers() {
const prisma = new PrismaClient();
try {
const adminUsers = await prisma.user.findMany({
where: { role: 'ADMIN' },
select: { id: true, email: true, role: true, name: true }
});
console.log('Admin users found:', adminUsers.length);
console.log(JSON.stringify(adminUsers, null, 2));
// If no admin users, check all users
if (adminUsers.length === 0) {
const allUsers = await prisma.user.findMany({
select: { id: true, email: true, role: true, name: true }
});
console.log('All users:', JSON.stringify(allUsers, null, 2));
}
} catch (error) {
console.error('Error checking users:', error);
} finally {
await prisma.$disconnect();
}
}
checkAdminUsers();