|
|
@@ -5,8 +5,6 @@ It is included in `init.sh` script.
|
|
|
By defualt `main` create a superuser if not exists
|
|
|
"""
|
|
|
|
|
|
-import asyncio
|
|
|
-
|
|
|
from sqlalchemy import select
|
|
|
|
|
|
from app.core import config, security
|
|
|
@@ -14,12 +12,10 @@ from app.core.session import session
|
|
|
from app.models import User
|
|
|
|
|
|
|
|
|
-async def main() -> None:
|
|
|
+def main() -> None:
|
|
|
print("Start initial data")
|
|
|
with session() as db:
|
|
|
- result = db.execute(
|
|
|
- select(User).where(User.email == config.settings.FIRST_SUPERUSER_EMAIL)
|
|
|
- )
|
|
|
+ result = db.execute(select(User).where(User.email == config.settings.FIRST_SUPERUSER_EMAIL))
|
|
|
user = result.scalars().first()
|
|
|
|
|
|
if user is None:
|
|
|
@@ -39,4 +35,4 @@ async def main() -> None:
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- asyncio.run(main())
|
|
|
+ main()
|