bluetooth.py 711 B

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