Orbit / inject_task.py
Orbit Automations
Auto-sync from Julius-606/Orbit monorepo
4a693cf
# ================================================================================
# FILE: /Projects/Orbit/backend/inject_task.py
# PURPOSE: Direct Market Access to PostgreSQL πŸͺ
# ================================================================================
import sys
import os
# πŸ› οΈ THE HEDGE: Python is having amnesia. We forcefully inject the backend
# folder into its memory (sys.path) so it knows where the 'app' module lives.
# No more fakeouts!
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from app.db.database import SessionLocal
from app.models.task import Task
from datetime import datetime, timedelta
def inject_liquidity():
print("Opening connection to the dark pool (Postgres)... 🏦")
db = SessionLocal()
try:
# Create a new limit order (Task)
new_task = Task(
title="Review Pharmacology Flashcards",
subject="Internal Medicine",
brain_rot_level="HIGH", # Bro is cooked πŸ’€
completed=False,
due_date=datetime.now() + timedelta(days=2)
)
# Add to the session and commit the transaction
db.add(new_task)
db.commit()
print(f"βœ… W Secured! Task '{new_task.title}' injected into Orbit.")
print("Go tap the Refresh button on your phone now! πŸ“±βœ¨")
except Exception as e:
print(f"❌ Stop Loss Hit! Transaction failed: {e}")
db.rollback()
finally:
db.close()
if __name__ == "__main__":
inject_liquidity()