File size: 1,569 Bytes
160f5ce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | """Seed task-manager with 1 user (Alice), 1 project (Apollo with Alice as
member), and 4 tasks across 3 statuses for the Kanban verifier."""
import sys
import requests
BASE = "http://127.0.0.1:5101"
def post(path, payload):
r = requests.post(f"{BASE}{path}", json=payload, timeout=10)
if r.status_code >= 400:
print(f"[seed] POST {path} -> {r.status_code} {r.text}", file=sys.stderr)
sys.exit(1)
return r.json()
def main():
alice = post("/api/users", {"name": "Alice", "email": "alice@example.com"})
project = post(
"/api/projects",
{"name": "Apollo", "description": "Mission control",
"owner_id": alice["id"], "member_ids": [alice["id"]]},
)
pid = project["id"]
t1 = post(f"/api/projects/{pid}/tasks",
{"title": "Wire credentials", "created_by": alice["id"],
"status": "todo", "priority": "high"})
t2 = post(f"/api/projects/{pid}/tasks",
{"title": "Draft retro doc", "created_by": alice["id"],
"status": "todo", "priority": "low"})
t3 = post(f"/api/projects/{pid}/tasks",
{"title": "Refactor adapter", "created_by": alice["id"],
"status": "in_progress", "priority": "medium"})
t4 = post(f"/api/projects/{pid}/tasks",
{"title": "Ship migration", "created_by": alice["id"],
"status": "done", "priority": "high"})
print(f"[seed] alice={alice['id']} project={pid} t1={t1['id']} t2={t2['id']} t3={t3['id']} t4={t4['id']}")
if __name__ == "__main__":
main()
|