예제 #1
0
def delete_saiyan(name):
    for index, dbz_obj in enumerate(dbz_list):
        if dbz_obj.get('name') == name:
            dbz_list.pop(index)
            return resp.success_json(dbz_list)
    return resp.error_json(
        resp.InvalidInput(msg="Could Not find this character"))
예제 #2
0
def add_saiyan():
    dbz_input = request.json
    for dbz_obj in dbz_list:
        if dbz_input.get('id') == dbz_obj.get('id'):
            return resp.error_json(
                resp.InvalidInput(
                    msg="Already have some character from this id."))
    dbz_list.append(request.json)
    return resp.success_json(dbz_list)
예제 #3
0
def update_saiyan():
    dbz_input = request.json
    for index, dbz_obj in enumerate(dbz_list):
        if dbz_input.get('id') == dbz_obj.get('id'):
            dbz_list.pop(index)
            dbz_list.append(dbz_input)
            return resp.success_json(dbz_list)
    return resp.error_json(
        resp.InvalidInput(msg="Could Not find this character"))
예제 #4
0
def get_dbz_char(name):
    for index, dbz_obj in enumerate(dbz_list):
        if dbz_obj.get('name') == name:
            return resp.success_json(dbz_obj)
    return resp.error_json(
        resp.InvalidInput(msg="Could Not find this character"))
예제 #5
0
def get_dbz_list():
    return resp.success_json(dbz_list)