Pārlūkot izejas kodu

add CRUD for early start model path

highing666 3 gadi atpakaļ
vecāks
revīzija
1a152028b1
2 mainītis faili ar 18 papildinājumiem un 0 dzēšanām
  1. 2 0
      app/crud/__init__.py
  2. 16 0
      app/crud/model_path/early_start.py

+ 2 - 0
app/crud/__init__.py

@@ -7,3 +7,5 @@
 # from app.schemas.item import ItemCreate, ItemUpdate
 
 # item = CRUDBase[Item, ItemCreate, ItemUpdate](Item)
+
+from .model_path.early_start import model_path_early_start_dtr

+ 16 - 0
app/crud/model_path/early_start.py

@@ -0,0 +1,16 @@
+from sqlalchemy.orm import Session
+
+from app.crud.base import CRUDBase
+from app.models.ml_models_path.early_start import EarlyStartDTRModelPath
+from app.schemas.model_path.early_start import EarlyStartDTRModelPathCreate, EarlyStartDTRModelPathUpdate
+
+
+class CRUDModelPathEarlyStartDTR(
+    CRUDBase[EarlyStartDTRModelPath, EarlyStartDTRModelPathCreate, EarlyStartDTRModelPathUpdate]
+):
+
+    def get_path_by_device(self, db: Session, device_id: str) -> EarlyStartDTRModelPath:
+        return db.query(self.model).filter(EarlyStartDTRModelPath.device_id == device_id).first()
+
+
+model_path_early_start_dtr = CRUDModelPathEarlyStartDTR(EarlyStartDTRModelPath)