feat: APScheduler integration for maintenance flow auto-session creation

- Add backend/app/core/scheduler.py with AsyncIOScheduler, CronTrigger-based
  job registration, and _fire_maintenance_schedule to create batch sessions
- Wire scheduler.start()/load_all_schedules()/shutdown() into main.py lifespan
- Call register_schedule() in create_schedule endpoint after commit
- Call register_schedule()/unregister_schedule() in update_schedule based on is_active
- Add TreeShare to models/__init__.py so all SQLAlchemy mapper relationships
  resolve before ORM queries in the scheduler context

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-17 14:21:29 -05:00
parent 55cd481e48
commit 5abff028bc
4 changed files with 162 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ from .subscription import Subscription
from .plan_limits import PlanLimits
from .account_invite import AccountInvite
from .tree import Tree
from .tree_share import TreeShare
from .session import Session
from .attachment import Attachment
from .invite_code import InviteCode
@@ -33,6 +34,7 @@ __all__ = [
"PlanLimits",
"AccountInvite",
"Tree",
"TreeShare",
"Session",
"Attachment",
"InviteCode",