27 lines
534 B
Python
27 lines
534 B
Python
"""# Summary
|
|
|
|
Operator script — seed demo data through the composition root.
|
|
|
|
Run from the project root:
|
|
|
|
python -m scripts.seed
|
|
"""
|
|
import asyncio
|
|
|
|
from init import init, shutdown
|
|
|
|
|
|
async def main() -> None:
|
|
"""Seed one demo item and shut down cleanly."""
|
|
resources = await init()
|
|
try:
|
|
item_svc = resources["item_svc"]
|
|
await item_svc.create({"name": "seed", "quantity": 1})
|
|
print("Seeded one item.")
|
|
finally:
|
|
await shutdown()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|