|
@@ -2,9 +2,11 @@
|
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
-from fastapi import APIRouter, HTTPException, Query
|
|
|
+from fastapi import APIRouter, Depends, HTTPException, Query
|
|
|
from loguru import logger
|
|
|
+from sqlalchemy.orm import Session
|
|
|
|
|
|
+from app.api.dependencies.db import get_db
|
|
|
from app.controllers.targets.temperature import (
|
|
|
temperature_target_control_v1,
|
|
|
temperature_target_control_v2,
|
|
@@ -22,14 +24,15 @@ async def readjust_target(
|
|
|
project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
|
|
|
space_id: str = Query(..., max_length=50, regex='^Sp', alias='roomId'),
|
|
|
timestamp: Optional[str] = Query(None, min_length=14, max_length=14, alias='time'),
|
|
|
- feedback: Optional[FeedbackValue] = Query(None, alias='itemId')
|
|
|
+ feedback: Optional[FeedbackValue] = Query(None, alias='itemId'),
|
|
|
+ db: Session = Depends(get_db)
|
|
|
):
|
|
|
if not timestamp:
|
|
|
timestamp = get_time_str()
|
|
|
try:
|
|
|
if feedback != FeedbackValue.null:
|
|
|
if project_id == 'Pj1101050030':
|
|
|
- need_run_room_control = await temperature_target_control_v1(project_id, space_id, feedback)
|
|
|
+ need_run_room_control = await temperature_target_control_v1(project_id, space_id, feedback, db)
|
|
|
else:
|
|
|
need_run_room_control = await temperature_target_control_v2(project_id, space_id, feedback)
|
|
|
else:
|