early_start.py 774 B

12345678910111213141516171819202122232425262728
  1. from sqlalchemy.orm import Session
  2. from app.crud.base import CRUDBase
  3. from app.models.ml_models_path.early_start import EarlyStartDTRModelPath
  4. from app.schemas.model_path.early_start import (
  5. EarlyStartDTRModelPathCreate,
  6. EarlyStartDTRModelPathUpdate,
  7. )
  8. class CRUDModelPathEarlyStartDTR(
  9. CRUDBase[
  10. EarlyStartDTRModelPath,
  11. EarlyStartDTRModelPathCreate,
  12. EarlyStartDTRModelPathUpdate,
  13. ]
  14. ):
  15. def get_path_by_device(
  16. self, db: Session, device_id: str
  17. ) -> EarlyStartDTRModelPath | None:
  18. return (
  19. db.query(self.model)
  20. .filter(EarlyStartDTRModelPath.device_id == device_id)
  21. .first()
  22. )
  23. model_path_early_start_dtr = CRUDModelPathEarlyStartDTR(EarlyStartDTRModelPath)