def _userdata(self, _conversation): _redis = self._redis _conversation_uuid = _conversation["uuid"] _values = { "uuid": str(uuid.uuid1()), "user_uuid": self._user_uuid, "peer_uuid": self._peer_uuid, "conversation_uuid": _conversation_uuid, "conversation_name": self._peer_name, "conversation_icon": self._peer_icon, "conversation_status": CONVERSATION_STATUS.NEW, } _row = ConversationUserData(**_values) _row.async_add(self._redis) _row.create_redis_keys(self._redis) _values = { "uuid": str(uuid.uuid1()), "user_uuid": self._peer_uuid, "peer_uuid": self._user_uuid, "conversation_uuid": _conversation_uuid, "conversation_name": self._user_name, "conversation_icon": self._user_icon, "conversation_status": CONVERSATION_STATUS.NEW, } _row = ConversationUserData(**_values) _row.async_add(self._redis) _row.create_redis_keys(self._redis) return
def _datarow(self, _user_uuid, _user_name, _conversation_type, _conversation_uuid, _conversation_name, _conversation_icon): _values = { "uuid": str(uuid.uuid1()), "user_uuid": _user_uuid, "user_name": _user_name, "conversation_type": _conversation_type, "conversation_uuid": _conversation_uuid, "conversation_name": _conversation_name, "conversation_icon": _conversation_icon, "conversation_status": CONVERSATION_STATUS.NEW, } _row = ConversationUserData(**_values) _row.async_add(self._redis) _row.create_redis_keys(self._redis) return
def _datarow(self, _user_uuid, _user_name, _conversation_type, _conversation_uuid, _conversation_name, _conversation_icon): _values = { "uuid": str(uuid.uuid1()), "app_uuid": self._app_uuid, "user_uuid": _user_uuid, "user_name": _user_name, "conversation_type": _conversation_type, "conversation_uuid": _conversation_uuid, "conversation_name": _conversation_name, "conversation_icon": _conversation_icon, "conversation_status": CONVERSATION_STATUS.NEW, } _row = ConversationUserData(**_values) _row.async_add(self._redis) _row.create_redis_keys(self._redis) return
def _add(self): _redis = self.application.redis for _user_uuid in self._member_list: key = ConversationUserData.__tablename__ + \ ".user_uuid." + _user_uuid + \ ".conversation_uuid." + self._conv_uuid if _redis.exists(key): continue _values = { "uuid": str(uuid.uuid1()), "user_uuid": _user_uuid, "conversation_uuid": self._conv_uuid, "conversation_status": CONVERSATION_STATUS.OPEN, "conversation_type": self._conv["conversation_type"], } _row = ConversationUserData(**_values) _row.async_add(_redis) _row.create_redis_keys(_redis) return
def _add(self): _redis = self.application.redis for _user_uuid in self._member_list: key = ConversationUserData.__tablename__ + \ ".app_uuid." + self._app_uuid + \ ".user_uuid." + _user_uuid + \ ".conversation_uuid." + self._conv_uuid if _redis.exists(key): continue _values = { "uuid": str(uuid.uuid1()), "user_uuid": _user_uuid, "app_uuid": self._app_uuid, "conversation_uuid": self._conv_uuid, "conversation_status": CONVERSATION_STATUS.OPEN, "conversation_type": self._conv["conversation_type"], } _row = ConversationUserData(**_values) _row.async_add() _row.create_redis_keys(_redis) return