def removeFriend(first_user_id, second_user_id): result_list = q.selectInfoByConditions( "Friends", "user_id", "user_id = '%s' AND friend_id = '%s'", (first_user_id, second_user_id), ) res = {} if len(result_list) == 0: res["status"] = False else: res["status"] = True q.deleteRecordByCondition( "Friends", "user_id = '%s' AND friend_id = '%s'", (first_user_id, second_user_id), ) q.deleteRecordByCondition( "Friends", "user_id = '%s' AND friend_id = '%s'", (second_user_id, first_user_id), ) return res
def pollingMessage(receiver): result_list = q.selectInfoByConditions( "MessageQueue", "sender, receiver, event, receipt_id, data", "receiver = '%s'", ( receiver ), ) q.deleteRecordByCondition("MessageQueue", "receiver = '%s'", receiver) return result_list
def pollingMessage(receiver): if not receiver: return [] result_list = q.selectInfoByConditions( "MessageQueue", "sender_id, receiver_id, event, receipt_id, data", "receiver_id = '%s'", ( receiver ), ) if result_list and result_list.__len__() > 0: q.deleteRecordByCondition( "MessageQueue", "receiver_id = '%s'", receiver) return result_list
def removeAllMembersFromGroup(groupId): if not groupExists(groupId): return False return q.deleteRecordByCondition( "GroupUsers", "group_id = '%s'", str(groupId), )
def removeMemberFromGroupById(groupId, memberId): if not userInGroup(groupId, memberId): return False else: return q.deleteRecordByCondition( "GroupUsers", "group_id = '%s' AND " "member_id = '%s'", (groupId, memberId), )
def deleteAllocation(alloId): if not allocationExists(alloId): return False result = q.selectAllByConditions( "Allocations", "allo_id = '%s'", alloId, )[0] itemId = result['item_id'] alloAmount = result['allo_amount'] curAmount = q.selectInfoByConditions( "Items", "left_amount", "item_id = '%s'", itemId, )[0]['left_amount'] if not modifyItemAmount(itemId, curAmount + alloAmount): return False return q.deleteRecordByCondition("Allocations", "allo_id = '%s'", alloId)
def deleteGroupById(groupId): if not groupExists(groupId): return False else: return q.deleteRecordByCondition("gGroups", "group_id = '%s'", groupId)
def deleteUserByUserId(userId): return q.deleteRecordByCondition("Users", "user_id = '%s'", userId)
def deleteItemById(itemId): return q.deleteRecordByCondition("Items", "item_id = '%s'", itemId)
def deleteReceipt(orderId, receiptIdx): return q.deleteRecordByCondition( "OrderReceipts", " order_id = '%s' AND receipt_idx = '%s'", (orderId, receiptIdx), )
def deleteOrderById(orderId): return q.deleteRecordByCondition("Orders", "order_id = '%s'", str(orderId))