Spaces:
Sleeping
Sleeping
File size: 1,525 Bytes
4a693cf | 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 43 44 45 46 | # ================================================================================
# 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() |