Fix UI bugs, admin bulk upload limits, test ingestion bugs, and reset demo users
This commit is contained in:
30
backend/reset_demo_users.py
Normal file
30
backend/reset_demo_users.py
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
from uuid import UUID
|
||||
from sqlmodel import Session
|
||||
from database import engine
|
||||
import models
|
||||
from main import ensure_demo_user
|
||||
|
||||
demo_ids = [
|
||||
UUID("11111111-1111-1111-1111-111111111111"),
|
||||
UUID("22222222-2222-2222-2222-222222222222"),
|
||||
UUID("33333333-3333-3333-3333-333333333333"),
|
||||
UUID("44444444-4444-4444-4444-444444444444")
|
||||
]
|
||||
|
||||
with Session(engine) as session:
|
||||
for uid in demo_ids:
|
||||
existing = session.get(models.User, uid)
|
||||
if existing:
|
||||
print(f"Deleting {existing.name}...")
|
||||
session.exec(models.Subscription.__table__.delete().where(models.Subscription.user_id == uid))
|
||||
session.exec(models.Mistake.__table__.delete().where(models.Mistake.user_id == uid))
|
||||
session.exec(models.Attempt.__table__.delete().where(models.Attempt.user_id == uid))
|
||||
session.exec(models.StudyPlan.__table__.delete().where(models.StudyPlan.user_id == uid))
|
||||
session.exec(models.Transaction.__table__.delete().where(models.Transaction.user_id == uid))
|
||||
session.delete(existing)
|
||||
session.commit()
|
||||
|
||||
user = ensure_demo_user(uid, session)
|
||||
print(f"Recreated: {user.name}")
|
||||
|
||||
Reference in New Issue
Block a user