Spaces:
Paused
Paused
Download server/check-admin-users.js from shanshal66/chinak2: direct link, hf CLI and curl.
- Browser
- Download file 835 Bytes
-
https://huggingface.co/spaces/shanshal66/chinak2/resolve/main/server/check-admin-users.js
- Command line
-
hf download hf://spaces/shanshal66/chinak2/server/check-admin-users.js
-
curl -L -o check-admin-users.js https://huggingface.co/spaces/shanshal66/chinak2/resolve/main/server/check-admin-users.js
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(); |