accujuris-api / scripts /diagnostics.py
arnavam's picture
chore: remove legacy Node.js configuration and add project documentation note
354f315
Raw
History Blame Contribute Delete
820 Bytes
import asyncio
import sys
from pathlib import Path
BACKEND_ROOT = Path(__file__).resolve().parent.parent
if str(BACKEND_ROOT) not in sys.path:
sys.path.insert(0, str(BACKEND_ROOT))
from sqlalchemy import select
from app.database import close_db, connect_db, get_session
from app.models import User
async def run():
await connect_db()
try:
async with get_session() as session:
users = (await session.execute(select(User))).scalars().all()
print(f"Total users in DB: {len(users)}")
for u in users:
print(
f"User ID: {u.id}, Supabase UID: {u.supabase_uid}, Email: {u.email}, Role: {u.role}, Approved: {u.is_approved}"
)
finally:
await close_db()
if __name__ == "__main__":
asyncio.run(run())