feat: processes and process runs CRUD
This commit is contained in:
@@ -29,6 +29,9 @@ SEED_IDS = {
|
||||
"weblink": "a0000000-0000-0000-0000-00000000000d",
|
||||
"capture": "a0000000-0000-0000-0000-00000000000e",
|
||||
"focus": "a0000000-0000-0000-0000-00000000000f",
|
||||
"process": "a0000000-0000-0000-0000-000000000010",
|
||||
"process_step": "a0000000-0000-0000-0000-000000000011",
|
||||
"process_run": "a0000000-0000-0000-0000-000000000012",
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +199,27 @@ def all_seeds(sync_conn):
|
||||
ON CONFLICT (id) DO NOTHING
|
||||
""", (d["focus"], d["task"]))
|
||||
|
||||
# Process
|
||||
cur.execute("""
|
||||
INSERT INTO processes (id, name, process_type, status, category, is_deleted, created_at, updated_at)
|
||||
VALUES (%s, 'Test Process', 'checklist', 'active', 'Testing', false, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING
|
||||
""", (d["process"],))
|
||||
|
||||
# Process step
|
||||
cur.execute("""
|
||||
INSERT INTO process_steps (id, process_id, title, instructions, sort_order, is_deleted, created_at, updated_at)
|
||||
VALUES (%s, %s, 'Test Step', 'Do the thing', 0, false, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING
|
||||
""", (d["process_step"], d["process"]))
|
||||
|
||||
# Process run
|
||||
cur.execute("""
|
||||
INSERT INTO process_runs (id, process_id, title, status, process_type, task_generation, is_deleted, created_at, updated_at)
|
||||
VALUES (%s, %s, 'Test Run', 'not_started', 'checklist', 'all_at_once', false, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING
|
||||
""", (d["process_run"], d["process"]))
|
||||
|
||||
sync_conn.commit()
|
||||
except Exception as e:
|
||||
sync_conn.rollback()
|
||||
@@ -205,6 +229,9 @@ def all_seeds(sync_conn):
|
||||
|
||||
# Cleanup: delete all seed data (reverse dependency order)
|
||||
try:
|
||||
cur.execute("DELETE FROM process_runs WHERE id = %s", (d["process_run"],))
|
||||
cur.execute("DELETE FROM process_steps WHERE id = %s", (d["process_step"],))
|
||||
cur.execute("DELETE FROM processes WHERE id = %s", (d["process"],))
|
||||
cur.execute("DELETE FROM daily_focus WHERE id = %s", (d["focus"],))
|
||||
cur.execute("DELETE FROM capture WHERE id = %s", (d["capture"],))
|
||||
cur.execute("DELETE FROM folder_weblinks WHERE weblink_id = %s", (d["weblink"],))
|
||||
|
||||
Reference in New Issue
Block a user