Browse Source

add models for early start model path

highing666 3 years ago
parent
commit
ff38caa8f1

+ 6 - 0
app/models/domain/devices.py

@@ -14,3 +14,9 @@ class DevicesInstructionsBaseResponse(BaseModel):
     projectId: str
     equipId: str
     output: Dict
+
+
+class DevicesEarlyStartTime(BaseModel):
+    projectId: str
+    spaceId: str
+    minutes: float

+ 3 - 4
app/models/ml_models_path/early_start.py

@@ -5,11 +5,10 @@ from sqlalchemy import Column, Integer, String
 from app.db.session import Base
 
 
-class EarlyStartDTRModel(Base):
+class EarlyStartDTRModelPath(Base):
     __tablename__ = 'early_start_DTR_models'
 
     id = Column(Integer, primary_key=True, index=True)
-    project_id = Column(String, index=True, nullable=False)
-    space_id = Column(String, index=True, nullable=False)
-    device_id = Column(String, index=True, nullable=False)
+    project_id = Column(String, nullable=False)
+    device_id = Column(String, unique=True, nullable=False)
     model_path = Column(String)

+ 32 - 0
app/schemas/model_path/early_start.py

@@ -0,0 +1,32 @@
+from typing import Optional
+
+from pydantic import BaseModel
+
+
+class EarlyStartDTRModelPathBase(BaseModel):
+    project_id: Optional[str] = None
+    device_id: Optional[str] = None
+    model_path: Optional[str] = None
+
+
+class EarlyStartDTRModelPathCreate(EarlyStartDTRModelPathBase):
+    pass
+
+
+class EarlyStartDTRModelPathUpdate(EarlyStartDTRModelPathBase):
+    pass
+
+
+class EarlyStartDTRModelPathInDBBase(EarlyStartDTRModelPathBase):
+    id: Optional[int] = None
+
+    class Config:
+        orm_mode = True
+
+
+class EarlyStartDTRModelPath(EarlyStartDTRModelPathInDBBase):
+    pass
+
+
+class EarlyStartDTRModelPathInDB(EarlyStartDTRModelPathInDBBase):
+    pass