enh: automation

This commit is contained in:
Timothy Jaeryang Baek
2026-04-11 17:06:58 -06:00
parent ee9db91df0
commit 406251c2f3
6 changed files with 85 additions and 0 deletions
+4
View File
@@ -143,6 +143,10 @@ class AutomationTable:
db.refresh(row)
return AutomationModel.model_validate(row)
def count_by_user(self, user_id: str, db: Optional[Session] = None) -> int:
with get_db_context(db) as db:
return db.query(Automation).filter_by(user_id=user_id).count()
def get_by_id(self, id: str, db: Optional[Session] = None) -> Optional[AutomationModel]:
with get_db_context(db) as db:
row = db.get(Automation, id)