devices.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from fastapi import APIRouter, Query
  2. from app.controllers.equipment.ahu.supply_air_temperature_set import get_next_supply_air_temperature_set
  3. from app.controllers.equipment.ahu.thermal_mode import get_thermal_mode
  4. from app.models.domain.devices import ACATAHThermalModeSetResponse, ACATAHSupplyAirTemperatureSetResponse
  5. router = APIRouter()
  6. @router.get('/instructions/acatah/thermal-mode-set', response_model=ACATAHThermalModeSetResponse)
  7. async def get_acatah_thermal_mode_set(
  8. project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
  9. device_id: str = Query(..., max_length=50, regex='^Eq', alias='equipId')
  10. ):
  11. thermal_mode = await get_thermal_mode(project_id, device_id)
  12. return {
  13. 'projectId': project_id,
  14. 'equipId': device_id,
  15. 'thermalModeSet': thermal_mode
  16. }
  17. @router.get('/instructions/acatah/supply-air-temperature-set', response_model=ACATAHSupplyAirTemperatureSetResponse)
  18. async def get_acatah_supply_air_temperature_set(
  19. project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
  20. device_id: str = Query(..., max_length=50, regex='^Eq', alias='equipId')
  21. ):
  22. next_supply_air_temperature_set = await get_next_supply_air_temperature_set(project_id, device_id)
  23. return {
  24. 'projectId': project_id,
  25. 'equipId': device_id,
  26. 'supplyAirTemperatureSet': next_supply_air_temperature_set
  27. }