def post(self, resource_id=None): request_data = request.json device_ids = request_data['device_ids'] interval = request_data['interval'] user_id = request_data['user_id'] return response_handler.success( self.resource_service.get_graph_data(device_ids=device_ids, interval=interval, user_id=user_id))
def post(self, user_id, device_id=None): request_data = request.json user = UserService().get_by_id(resource_id=user_id) if device_id: device = self.resource_service.update(device_id, request_data) else: device = self.resource_service.create(request_data) user.update(add_to_set__devices=device, upsert=True) user.save() return response_handler.success(response_data=device.to_json())
def post(self, status, device_id): self.resource_service.remote_control_device(device_id=device_id, status=status) return response_handler.success("Success")
def get(self, resource_id=None): return response_handler.success( response_data=self.resource_service.get_all())
def post(self): request_data = request.json for data in request_data['data']: self.resource_service.create(data) return response_handler.success()
def post(self, resource_id=None): return response_handler.success(self.resource_service.get_devices_status())
def post(self): request_data = request.json return response_handler.success(self.resource_service.create(request_data))