aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-backend/scripts/seed.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-08-19 01:05:27 +0100
committerGravatar Chris Lovering <[email protected]>2024-08-19 01:05:27 +0100
commitfe6abd8a5719cbcab1d1207918136f19042e4fa3 (patch)
treedf09b6c83653189f668fce044c41096386e5bde0 /thallium-backend/scripts/seed.py
parentCaddy local support (diff)
Add debug endpoints and implement token auth
Co-authored-by: Joe Banks <[email protected]>
Diffstat (limited to 'thallium-backend/scripts/seed.py')
-rw-r--r--thallium-backend/scripts/seed.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/thallium-backend/scripts/seed.py b/thallium-backend/scripts/seed.py
new file mode 100644
index 0000000..b27a586
--- /dev/null
+++ b/thallium-backend/scripts/seed.py
@@ -0,0 +1,20 @@
+import asyncio
+
+from src.orm import Voucher
+from src.settings import Connections
+
+
+async def main() -> None:
+ """Seed the database with some test data."""
+ async with Connections.DB_SESSION_MAKER() as session, session.begin():
+ session.add_all(
+ [
+ Voucher(voucher_code="k1p", balance="13.37", active=False),
+ Voucher(voucher_code="k1p", balance="13.37", active=False),
+ Voucher(voucher_code="k1p", balance="13.37"),
+ ]
+ )
+
+
+if __name__ == "__main__":
+ asyncio.run(main())