예제 #1
0
def users_user_id_get(userId):
    """ method to retrieve user using user id """
    try:
        user = User.get(userId)
        buildings = Building.scan(ownerId__eq=userId)
        #add ownedBuildings to the user object without having it reflect in the model
        user.__dict__["attribute_values"].update({"ownedBuildings": []}) 
        #look at all the builings the user owns
        for building in buildings:
            #add the builings to the ownedBuildings list
            user.__dict__["attribute_values"]["ownedBuildings"].append(building.attribute_values["id"])
    except Exception as inst:
        print(inst.args)
        return 'User with id=%s does not exist.' % (userId)
    return user.attribute_values
예제 #2
0
def users_user_id_get(userId):
    """ method to retrieve user using user id """
    try:
        user = User.get(userId)
        buildings = Building.scan(ownerId__eq=userId)
        #add ownedBuildings to the user object without having it reflect in the model
        user.__dict__["attribute_values"].update({"ownedBuildings": []})
        #look at all the builings the user owns
        for building in buildings:
            #add the builings to the ownedBuildings list
            user.__dict__["attribute_values"]["ownedBuildings"].append(
                building.attribute_values["id"])
    except Exception as inst:
        print(inst.args)
        return 'User with id=%s does not exist.' % (userId)
    return user.attribute_values
예제 #3
0
def buildings_get() -> str:
    resultList = []
    for item in Building.scan():
        resultList.append(item.attribute_values)
    return resultList
예제 #4
0
def buildings_delete() -> str:
    temp = []
    for item in Building.scan():
        temp.append(item.delete())
    return "%s items deleted." % len(temp)
def buildings_get():
    """ method to get all buildings """
    resultlist = []	
    for item in Building.scan():
        resultlist.append(item.attribute_values)
    return resultlist
def buildings_delete():
    """ method to delete all buildings """
    temp = []
    for item in Building.scan():
        temp.append(item.delete())
    return "%s items deleted." % len(temp)
예제 #7
0
def buildings_get():
    """ method to get all buildings """
    resultlist = []
    for item in Building.scan():
        resultlist.append(item.attribute_values)
    return resultlist
예제 #8
0
def buildings_delete():
    """ method to delete all buildings """
    temp = []
    for item in Building.scan():
        temp.append(item.delete())
    return "%s items deleted." % len(temp)
예제 #9
0
def buildings_get() -> str:
    resultList = []
    for item in Building.scan():
        resultList.append(item.attribute_values)
    return resultList
예제 #10
0
def buildings_delete() -> str:
    temp = []
    for item in Building.scan():
        temp.append(item.delete())
    return "%s items deleted." % len(temp)