fix: jobs router session handling, schedule creation, and tests

- Use new session in background task for thread safety
- Fix schedule creation to associate with job
- Fix schedule endpoint return type
- Update tests to use AsyncClient
- Add missing tests for list, get, delete, schedule
- Add updated_at field to Schedule model
This commit is contained in:
2026-05-11 21:20:31 +02:00
parent 1f1ed72494
commit 955ed9db49
3 changed files with 211 additions and 81 deletions
+5
View File
@@ -63,6 +63,11 @@ class Schedule(Base):
cron_expression = Column(String, nullable=False)
enabled = Column(Boolean, default=True)
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
updated_at = Column(
DateTime,
default=lambda: datetime.now(timezone.utc),
onupdate=lambda: datetime.now(timezone.utc),
)
job = relationship("Job", back_populates="schedule")