File size: 652 Bytes
af567cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from app.database import SessionLocal
from app.models.db import User, UserType
from app.services.auth_service import hash_password
def setup():
db = SessionLocal()
existing = db.query(User).filter(User.email == "admin@openvar.io").first()
if not existing:
su = User(
email="admin@openvar.io",
hashed_password=hash_password("admin"),
full_name="OpenVar Admin",
user_type=UserType.enterprise,
is_superadmin=True,
)
db.add(su)
db.commit()
print("Admin created")
else:
print("Admin exists")
if __name__ == "__main__":
setup()
|