bluetooth.py 656 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. from fastapi import APIRouter
  3. from loguru import logger
  4. from app.controllers.location.ble.space import get_space_location
  5. from app.models.domain.bluetooth import BluetoothUserResponse
  6. from app.schemas.bluetooth import IBeaconBase
  7. router = APIRouter()
  8. @router.post("/user/{user_id}", response_model=BluetoothUserResponse)
  9. async def create_bluetooth_info(user_id: str, bluetooth_info: list[IBeaconBase]):
  10. info_list = [item.dict() for item in bluetooth_info]
  11. logger.info(f"{user_id}: {info_list}")
  12. sp_id = await get_space_location("Pj1101080259", bluetooth_info)
  13. response = {"Result": sp_id}
  14. return response