Browse Source

restore bdlg 2023 V0

Clovis JAQUIN 2 years ago
parent
commit
b15c523318
1 changed files with 30 additions and 0 deletions
  1. 30 0
      app/restore_project.py

+ 30 - 0
app/restore_project.py

@@ -0,0 +1,30 @@
+"""
+
+"""
+
+from sqlalchemy import select
+from datetime import datetime, timedelta
+from app.core import config, security
+from app.core.session import session
+from app.models import User, Sms, Project
+
+TEST_SMS_PROJECT_NAME = "522e62c3-9620-47e1-bdd6-d856095533e7"
+NUMBER_OF_SMS = 80
+
+
+def main() -> None:
+    print("Create SMS ")
+    with session() as db:
+        # Get or create the project hosting the sms
+        result = db.execute(select(Project).where(Project.id == TEST_SMS_PROJECT_NAME))
+        project = result.scalars().first()
+        if project is None:
+            project = Project(id=TEST_SMS_PROJECT_NAME, name="BDLG 2023 V0", is_public=False)
+            db.add(project)
+            db.commit()
+            db.refresh(project)
+        db.commit()
+
+
+if __name__ == "__main__":
+    main()