Exemple #1
0
def add_user_book():
    """Adds a new book to a user's books"""
    if session.get("user"):
        user_id = session["user"]
        label = request.json.get("label")
        book_dict = request.json.get("book")
        
        isbn = book_dict["id"]

        book = crud.get_book_by_isbn(isbn)
        category = crud.get_category_by_label(user_id, label)
        
        if not book:
            book = crud.create_book(isbn, 
                                        book_dict["volumeInfo"]["title"], 
                                        book_dict["volumeInfo"]["authors"], 
                                        book_dict["volumeInfo"]["description"], 
                                        book_dict["volumeInfo"]["pageCount"], 
                                        book_dict["volumeInfo"]["imageLinks"]["thumbnail"])

        if not category:
            category = crud.create_category(user_id, label)

            added_books = crud.create_book_category(book, category)
            return jsonify ({"success": f"""A new category, {category.label}, has been added to your bookshelf and {book.title} has been added to it"""})

        if book in crud.get_all_books_in_category(user_id, label):
            return jsonify ({"error": f"{book.title} is already in your {category.label} books"})

        added_books = crud.create_book_category(book, category)
        # Right now, added_books is a list of all of the book objects in category
        
        return jsonify ({"success": f"{book.title} has been added to {category.label} books"})
Exemple #2
0
def create_or_get_user():
    """Create a new user or get info about existing user."""

    if request.method == "GET":
        if session.get("user_id"):
            user_id = session["user_id"]
            user = crud.get_user_by_id(user_id)
            user = user.to_dict()
            return jsonify(user)

    if request.method == "POST":
        first_name = request.json.get("first_name")
        last_name = request.json.get("last_name")
        email = request.json.get("email")
        password = request.json.get("password")
        city = request.json.get("city")
        state = request.json.get("state")

        if crud.get_user_by_email(email):
            return jsonify({
                "error":
                f"An account with the email, {email}, already exists."
            })

        user = crud.create_user(first_name, last_name, email, password, city,
                                state)
        first_category = crud.create_category(user.id, "My Favorite Books")
        return jsonify({"user": user.to_dict()})
Exemple #3
0
def add_a_toy():
    print('*' * 20)
    # print('\n')
    # print(request.form.get('category'))
    # print('\n')
    print('*' * 20)
    category_name = request.form.get('Category')
    category = crud.create_category(
        category_name=category_name,
        category_description="No description available")

    user = crud.get_user_by_email(session["user_email"])
    toy_name = request.form.get('toy_name')
    toy_description = request.form.get('toy_description')
    toy_manufacture = request.form.get('toy_manufacture')
    toy_age_range = request.form.get('toy_age_range')

    toy = crud.create_toy(category=category,
                          user=user,
                          toy_name=toy_name,
                          toy_description=toy_description,
                          toy_manufacture=toy_manufacture,
                          toy_age_range=toy_age_range)

    return redirect('/features')
 async def mutate(root, info, name):
     try:
         category_schema = schemas.CreateCategory(name=name)
         category = crud.create_category(db=database.SessionLocal(),
                                         category=category_schema)
         return CreateCategory(success=True, category=category)
     except:
         raise GraphQLError('The category could not be created!')
def seed_category():

    with open('data/seed_category.json') as f:
        category_data = json.loads(f.read())

    for category in category_data:
        category_name = category['category_name']

        new_category = crud.create_category(category_name)
Exemple #6
0
def test_example_data():

    with open('test_melon_news.json') as f:
        melon_news_data = json.loads(f.read())

    melon_news_in_db = []
    for melon_news in melon_news_data:
        comment = melon_news['comment']
        news = melon_news['news']
        user = melon_news['user']
        category = melon_news['category']

        db_melon_news = crud.create_melon_news(comment, news, user, category)

    model.Comment.query.delete()
    model.News.query.delete()
    model.User.query.delete()
    model.Category.query.delete()

    users_in_db = {}
    categories_in_db = {}
    news_in_db = {}

    for user in melon_news_data['users']:
        db_user = crud.create_user(user_name=user['user_name'],
                                   email=user['email'],
                                   user_role=user['user_role'],
                                   password=user['password'])
        users_in_db[db_user.email] = db_user

    for category in melon_news_data['categories']:
        db_category = crud.create_category(
            category_type=category['category_type'],
            description=category['description'])
        categories_in_db[db_category.category_type] = db_category

    for news in melon_news_data['news']:
        db_news = crud.create_news(
            user=users_in_db[news['email']],
            category=categories_in_db[news['category_type']],
            title=news['title'],
            summary=news['summary'],
            article_text=news['article_text'],
            external_link=news['external_link'],
            picture_link=news['picture_link'],
            date_post=DateTime(news['date_post'][0], news['date_post'][1],
                               news['date_post'][2]))
        news_in_db[db_news.title] = db_news

    for comment in melon_news_data['comments']:
        crud.create_comment(user=users_in_db[comment['email']],
                            news=news_in_db[comment['title']],
                            comment_text=comment['comment_text'])

    return melon_news_in_db
def example_data():

    f = open('seeddata.json', )

    data = json.load(f)

    f.close()

    f2 = open('direct-link.json', )

    direct_link_data = json.load(f2)

    f2.close()

    users_in_db = {}
    categories_in_db = {}
    news_in_db = {}

    for user in data['users']:
        db_user = crud.create_user(user_name=user['user_name'],
                                   email=user['email'],
                                   user_role=user['user_role'],
                                   password=user['password'])
        users_in_db[db_user.email] = db_user

    for category in data['categories']:
        db_category = crud.create_category(
            category_type=category['category_type'],
            description=category['description'])
        categories_in_db[db_category.category_type] = db_category

    for news in data['news']:
        db_news = crud.create_news(
            user=users_in_db[news['email']],
            category=categories_in_db[news['category_type']],
            title=news['title'],
            summary=news['summary'],
            article_text=news['article_text'],
            external_link=news['external_link'],
            picture_link=news['picture_link'],
            date_post=datetime(news['date_post'][0], news['date_post'][1],
                               news['date_post'][2]))
        news_in_db[db_news.title] = db_news

    for comment in data['comments']:
        crud.create_comment(user=users_in_db[comment['email']],
                            news=news_in_db[comment['title']],
                            comment_text=comment['comment_text'])

    for direct_link_item in direct_link_data:
        crud.create_external_news(
            direct_title=direct_link_item['direct_title'],
            direct_link=direct_link_item['direct_link'],
            image=direct_link_item['image'])
def example_data():

    os.system('dropdb testmelonnews')
    os.system('createdb testmelonnews')

    model.connect_to_db(server.app)
    model.db.create_all()

    f = open('seeddata.json', )

    data = json.load(f)

    f.close()

    model.Comment.query.delete()
    model.News.query.delete()
    model.User.query.delete()
    model.Category.query.delete()

    users_in_db = {}
    categories_in_db = {}
    news_in_db = {}

    for user in data['users']:
        db_user = crud.create_user(user_name=user['user_name'],
                                   email=user['email'],
                                   user_role=user['user_role'],
                                   password=user['password'])
        users_in_db[db_user.email] = db_user

    for category in data['categories']:
        db_category = crud.create_category(
            category_type=category['category_type'],
            description=category['description'])
        categories_in_db[db_category.category_type] = db_category

    for news in data['news']:
        db_news = crud.create_news(
            user=users_in_db[news['email']],
            category=categories_in_db[news['category_type']],
            title=news['title'],
            summary=news['summary'],
            article_text=news['article_text'],
            external_link=news['external_link'],
            picture_link=news['picture_link'],
            date_post=datetime(news['date_post'][0], news['date_post'][1],
                               news['date_post'][2]))
        news_in_db[db_news.title] = db_news

    for comment in data['comments']:
        crud.create_comment(user=users_in_db[comment['email']],
                            news=news_in_db[comment['title']],
                            comment_text=comment['comment_text'])
Exemple #9
0
def create_test_categories():
    """Create test categories."""

    test_categories_in_db = []

    # Capture test categories from get_test_categories() function
    test_categories = get_test_categories()

    for test_category in test_categories:
        category = crud.create_category(test_category)
        test_categories_in_db.append(category)

    return test_categories_in_db
Exemple #10
0
def add_user_category():
    """Adds a new category to a user"""

    if session.get("user"):
        user_id = session["user"]
        # user = session["user"]
        label = request.json.get("label")

        user = crud.get_user_by_id(user_id)
        
        if crud.get_category_by_label(user_id, label):
            return ({"error": f"{label} is already in {user.first_name}'s bookshelf!"})

        new_category = crud.create_category(user_id, label)

        return jsonify ({"success": f"{new_category.label} has been added to {user.first_name}'s bookshelf!"})
Exemple #11
0
def create_new_user():
    """Create a new user."""

    first_name = request.json.get("first_name")
    last_name = request.json.get("last_name")
    email = request.json.get("email")
    password = request.json.get("password")
    city = request.json.get("city")
    state = request.json.get("state")

    if crud.get_user_by_email(email):
        return jsonify ({"error": f"An account with the email, {email}, already exists."})
        
    user = crud.create_user(first_name, last_name, email, password, city, state)
    first_category = crud.create_category(user.id, "My Favorite Books")
    # return jsonify ({'status': '200',
    #                 'message': 'Account has successfully been created'})
    return jsonify ({"user": user.to_dict()})
Exemple #12
0
# Load transaction data from JSON file
with open('data/transactions.json') as f:
    transaction_data = json.loads(f.read())

# Load account and balance data from JSON file
with open('data/balances.json') as f:
    balances_data = json.loads(f.read())

# Populate category table in budgetapp db
categories_in_db = []
for item in transaction_data['transactions']:
    category_id = (item['category_id'])
    title = (item['category'])  #It stores as a dict not a list or str.

    db_category = crud.create_category(category_id, title, user)

    categories_in_db.append(db_category)

# Populate Merchant_Name table in budgetapp db
merchant_names_in_db = []
for item in transaction_data['transactions']:
    merchant_name = (item['name'])

    db_merchant_name = crud.create_merchant_name(merchant_name, user)

    merchant_names_in_db.append(db_merchant_name)

# Populate budget table in budgetapp db , LATER through user inputs.

# Populate account table in budgetapp db
Exemple #13
0
def get_and_update_categories():
    """Gets or updates a user's categories"""

    if session.get("user_id"):
        user_id = session["user_id"]

        if request.method == "GET":
            categories = []

            category_objects = crud.get_all_user_categories(user_id)

            for category_object in category_objects:

                dict_category = category_object.to_dict()
                categories.append(dict_category)

            return jsonify({"categories": categories})

        elif request.method == "POST":
            if request.json.get("label"):
                label = request.json.get("label")

                user = crud.get_user_by_id(user_id)

                if crud.get_category_by_label(user_id, label):
                    return ({
                        "error":
                        f"{label} is already in {user.first_name}'s bookshelf!"
                    })

                new_category = crud.create_category(user_id, label)

                return jsonify({
                    "success":
                    f"{new_category.label} has been added to {user.first_name}'s bookshelf!"
                })
            else:
                old_label = request.json.get("old_label")
                new_label = request.json.get("new_label")

                crud.update_category_label(user_id, old_label, new_label)

                return jsonify({
                    "success": f"{old_label} has been changed to {new_label}!",
                    "label": new_label
                })

        elif request.method == "PUT":
            label = request.json.get("label")
            book_dict = request.json.get("book")
            isbn = book_dict["id"]
            book = crud.get_book_by_isbn(isbn)
            category = crud.get_category_by_label(user_id, label)

            if not book:
                authors = ""
                for author in book_dict["volumeInfo"]["authors"]:
                    authors += f"{author} "
                page_count = book_dict["volumeInfo"].get("pageCount")
                if not page_count:
                    page_count = 000
                book = crud.create_book(
                    isbn, book_dict["volumeInfo"]["title"], authors,
                    book_dict["volumeInfo"]["description"], page_count,
                    book_dict["volumeInfo"]["imageLinks"]["thumbnail"])

            if not category:
                category = crud.create_category(user_id, label)

                added_books = crud.create_book_category(book, category)
                return jsonify({
                    "success":
                    f"""A new category, {category.label}, has been added to your bookshelf and {book.title} has been added to it"""
                })

            if book in crud.get_all_books_in_category(user_id, label):
                return jsonify({
                    "error":
                    f"{book.title} is already in your {category.label} books"
                })

            added_books = crud.create_book_category(book, category)
            return jsonify({
                "success":
                f"{book.title} has been added to {category.label} books"
            })

        elif request.method == "DELETE":
            if request.json.get("label"):
                label = request.json.get("label")
                crud.delete_category(label, user_id)

                return jsonify({
                    "success":
                    f"{label} has successfully been removed from your bookshelf.",
                    "label": ""
                })

            else:
                label = request.json.get("category")
                isbn = request.json.get("isbn")
                title = request.json.get("title")

                this_category = crud.get_category_by_label(user_id, label)

                crud.remove_book_from_category(isbn, this_category.id)

                return jsonify({
                    "success":
                    f"{title} has successfully been removed from {label}.",
                })

    else:
        return jsonify({"error": "User must be logged in to view this page."})
Exemple #14
0
 def Create(self, request, context):
     response = category_pb2.Category()
     response = crud.create_category(request.parent_id, request.name,
                                     request.description, request.user_id)
     return response
Exemple #15
0
# db.create_all()

model.connect_to_db(server.app)
model.db.create_all()

model.Price.query.delete()
model.Toy_Feature.query.delete()
model.Toy.query.delete()
model.User.query.delete()
model.Category.query.delete()
model.Feature.query.delete()
model.Store.query.delete()
model.Address.query.delete()

A = crud.create_category("Outdoor game", "kids toy")
B = crud.create_category("indoor toy", "kids toy")
C = crud.create_category("soft toy", "everyone loves it")

u = crud.create_user("deena", "bhatt", "*****@*****.**", "test")
I = crud.create_user("Jiya", "Dave", "*****@*****.**", "test")
L = crud.create_user("Aanya", "Pandya", "*****@*****.**", "test")
N = crud.create_user("Miraya", "Pandya", "*****@*****.**", "test")
O = crud.create_user("Angiras", "Pandya", "*****@*****.**", "test")
V = crud.create_user("Rohan", "Bhatt", "*****@*****.**", "test")

x = crud.create_toy(A, I, "bear", "kids toy", "disney", 5)
y = crud.create_toy(B, u, "bear", "kids toy", "disney", 5)

z = crud.create_feature(2.5, 4.0, 1.8, "blue", "Disney")
k = crud.create_feature(1.2, 5.6, 3.4, "yellow", "build_a_bear")
Exemple #16
0
        cat_name = None
        org = None
        contact = None
        address = None
        location = None

        for key, val in line.items():

            if key == "Category":

                cat_name = line['Category']

                if crud.get_category_by_id(cat_name) == []:
                
                    crud.create_category(val)
    
            elif key == "Org Name":
                org = val
            
            elif key == "Contact":
                contact = val
                
            elif key == "Address":
                address = val

            else: 
                location = val

        crud.create_resource(org_name=org, contact=contact, address=address, location=location, category_id=cat_name)
         
Exemple #17
0
# script begin

# reset database
os.system('dropdb nookcookbook')
os.system('createdb nookcookbook')

model.connect_to_db(server.app)
model.db.create_all()

# seed categories table
## get categories data from file
with open('data/categories.json') as f:
    cat_data = json.loads(f.read())

for entry in cat_data:
    category = crud.create_category(entry['cat_code'], entry['name'])

# seed series table
## get series data from file
with open('data/series.json') as f:
    series_data = json.loads(f.read())

for entry in series_data:
    series = crud.create_series(entry['series_code'], entry['name'])

# seed recipes table
## get recipes data from file
with open('data/recipes.json') as f:
    recipes_data = json.loads(f.read())

for entry in recipes_data:
async def create_category(category: schemas.CreateCategory,
                          db: Session = Depends(get_db)):
    return crud.create_category(db=db, category=category)
Exemple #19
0
    new_events.append(new_event)

    # Create fake user_events for testing
    for n in range(4):
        random_user = choice(new_users)
        event = new_event
        crud.create_event_attendee(random_user.id, event.id)

        # Create fake event_books for testing
        random_book = choice(new_books)
        crud.create_event_book(event, random_book)  # CHANGE

# Create fake categories for testing
new_categories = []

for n in range(6):

    user_id = n + 1
    for i in range(10):
        label = f"Category {i}"

        new_category = crud.create_category(user_id, label)

        new_categories.append(new_category)

        # Create fake book_categories for testing
        for n in range(1, 6):
            random_book = choice(new_books)
            category = new_category
            book_categories = crud.create_book_category(random_book, category)
    mechanic_data = json.loads(f.read())

    for mechanic in mechanic_data:
        name = mechanic["name"]
        atlas_id = mechanic["id"]

        crud.create_mechanic(name, atlas_id)

with open('data/categories.json') as f:
    category_data = json.loads(f.read())

    for category in category_data:
        name = category["name"]
        atlas_id = category["id"]

        crud.create_category(name, atlas_id)

# Create empty list to hold new game objects
games_list = []
with open('data/games.json') as f:
    game_data = json.loads(f.read())

    for game in game_data:
        name = game["name"]
        description = game["description"]
        publish_year = game["year_published"]
        min_age = game["min_age"]
        min_players = game["min_players"]
        max_players = game["max_players"]
        min_playtime = game["min_playtime"]
        max_playtime = game["max_playtime"]
Exemple #21
0
# db.create_all()

model.connect_to_db(server.app)
model.db.create_all()

model.Price.query.delete()
model.Toy_Feature.query.delete()
model.Toy.query.delete()
model.User.query.delete()
model.Category.query.delete()
model.Feature.query.delete()
model.Store.query.delete()
model.Address.query.delete()

A = crud.create_category("Outdoor game", "kids toy")
B = crud.create_category("indoor toy", "kids toy")
C = crud.create_category("soft toy", "everyone loves it")
d = crud.create_category("All other", "everyone's favorite")
e = crud.create_category("board Game", "All age group")

u = crud.create_user("deena", "bhatt", "*****@*****.**", "test")
I = crud.create_user("Jiya", "Dave", "*****@*****.**", "test")
L = crud.create_user("Aanya", "Pandya", "*****@*****.**", "test")
N = crud.create_user("Miraya", "Pandya", "*****@*****.**", "test")
O = crud.create_user("Angiras", "Pandya", "*****@*****.**", "test")
V = crud.create_user("Rohan", "Bhatt", "*****@*****.**", "test")

x = crud.create_toy(C, I, "rainbowbear", "kids toy", "build a bear", 5,
                    "rainbowbear.jpg")
y = crud.create_toy(C, u, "Gient bears", "kids toy", "build a bear", 5,
Exemple #22
0
def test_data():

    #create books for testing
    harry_potter = crud.create_book(
        "oxxszQEACAAJ", "Harry Potter and the Half-Blood Prince",
        "J. K. Rowling",
        "Harry Potter, now sixteen-years-old, begins his sixth year at school in the midst of the battle between good and evil which has heated up with the return of the Dark Lord Voldemort.",
        652,
        "http://books.google.com/books/content?id=oxxszQEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
    )
    neverwhere = crud.create_book(
        "yuCUZ3km3qIC", "Neverwhere", "Neil Gaiman",
        "Richard Mayhew is a young man with a good heart and an ordinarylife, which is changed forever when he stops to help a girl he finds bleeding on a London sidewalk. His small act of kindness propels him into a world he never dreamed existed. There are people who fall through the cracks, and Richard has become one of them. And he must learn to survive in this city of shadows and darkness, monsters and saints, murderers and angels, if he is ever to return to the London that he knew.",
        400,
        "http://books.google.com/books/content?id=yuCUZ3km3qIC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    bees = crud.create_book(
        "FiIXot_e10sC", "The Secret Life of Bees", "Sue Monk Kidd",
        "After her \"stand-in mother,\" a bold black woman named Rosaleen, insults the three biggest racists in town, Lily Owens joins Rosaleen on a journey to Tiburon, South Carolina, where they are taken in by three black, bee-keeping sisters.",
        317,
        "http://books.google.com/books/content?id=FiIXot_e10sC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    hidden = crud.create_book(
        "bxahDwAAQBAJ", "Hidden Valley Road", "Robert Kolker",
        "OPRAH’S BOOK CLUB PICK #1 NEW YORK TIMES BESTSELLER ONE OF THE NEW YORK TIMES TOP TEN BOOKS OF THE YEAR ONE OF THE WALL STREET JOURNAL TOP TEN BOOKS OF THE YEAR PEOPLE'S #1 BEST BOOK OF THE YEAR Named a BEST BOOK OF THE YEAR by The New York Times, The Washington Post, NPR, TIME, Slate, Smithsonian, The New York Post, and Amazon The heartrending story of a midcentury American family with twelve children, six of them diagnosed with schizophrenia, that became science's great hope in the quest to understand the disease. Don and Mimi Galvin seemed to be living the American dream. After World War II, Don's work with the Air Force brought them to Colorado, where their twelve children perfectly spanned the baby boom: the oldest born in 1945, the youngest in 1965. In those years, there was an established script for a family like the Galvins--aspiration, hard work, upward mobility, domestic harmony--and they worked hard to play their parts. But behind the scenes was a different story: psychological breakdown, sudden shocking violence, hidden abuse. By the mid-1970s, six of the ten Galvin boys, one after another, were diagnosed as schizophrenic. How could all this happen to one family? What took place inside the house on Hidden Valley Road was so extraordinary that the Galvins became one of the first families to be studied by the National Institute of Mental Health. Their story offers a shadow history of the science of schizophrenia, from the era of institutionalization, lobotomy, and the schizophrenogenic mother to the search for genetic markers for the disease, always amid profound disagreements about the nature of the illness itself. And unbeknownst to the Galvins, samples of their DNA informed decades of genetic research that continues today, offering paths to treatment, prediction, and even eradication of the disease for future generations. With clarity and compassion, bestselling and award-winning author Robert Kolker uncovers one family's unforgettable legacy of suffering, love, and hope.",
        400,
        "http://books.google.com/books/content?id=bxahDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    crawdads = crud.create_book(
        "CGVDDwAAQBAJ", "Where the Crawdads Sing", "Delia Owens",
        "#1 New York Times Bestseller A Reese Witherspoon x Hello Sunshine Book Club Pick \"I can't even express how much I love this book! I didn't want this story to end!\"--Reese Witherspoon \"Painfully beautiful.\"--The New York Times Book Review \"Perfect for fans of Barbara Kingsolver.\"--Bustle For years, rumors of the \"Marsh Girl\" have haunted Barkley Cove, a quiet town on the North Carolina coast. So in late 1969, when handsome Chase Andrews is found dead, the locals immediately suspect Kya Clark, the so-called Marsh Girl. But Kya is not what they say. Sensitive and intelligent, she has survived for years alone in the marsh that she calls home, finding friends in the gulls and lessons in the sand. Then the time comes when she yearns to be touched and loved. When two young men from town become intrigued by her wild beauty, Kya opens herself to a new life--until the unthinkable happens. Perfect for fans of Barbara Kingsolver and Karen Russell, Where the Crawdads Sing is at once an exquisite ode to the natural world, a heartbreaking coming-of-age story, and a surprising tale of possible murder. Owens reminds us that we are forever shaped by the children we once were, and that we are all subject to the beautiful and violent secrets that nature keeps.",
        384,
        "http://books.google.com/books/content?id=CGVDDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    wind = crud.create_book(
        "BcG2dVRXKukC", "The Name of the Wind", "Patrick Rothfuss",
        "'This is a magnificent book' Anne McCaffrey 'I was reminded of Ursula K. Le Guin, George R. R. Martin, and J. R. R. Tolkein, but never felt that Rothfuss was imitating anyone' THE TIMES 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep. My name is Kvothe. You may have heard of me' So begins the tale of Kvothe - currently known as Kote, the unassuming innkeepter - from his childhood in a troupe of traveling players, through his years spent as a near-feral orphan in a crime-riddled city, to his daringly brazen yet successful bid to enter a difficult and dangerous school of magic. In these pages you will come to know Kvothe the notorious magician, the accomplished thief, the masterful musician, the dragon-slayer, the legend-hunter, the lover, the thief and the infamous assassin.",
        672,
        "http://books.google.com/books/content?id=BcG2dVRXKukC&printsec=frontcover&img=1&zoom=1&source=gbs_api"
    )
    addie = crud.create_book(
        "vH3LDwAAQBAJ", "The Invisible Life of Addie LaRue", "V. E. Schwab",
        "AN INSTANT NEW YORK TIMES BESTSELLER USA TODAY BESTSELLER NATIONAL INDIE BESTSELLER THE WASHINGTON POST BESTSELLER #1 Indie Next Pick and #1 LibraryReads Pick - October 2020 Recommended by Entertainment Weekly, Real Simple, NPR, Slate, and Oprah Magazine A “Best Of” Book From: CNN *Amazon Editors * Goodreads * Bustle * PopSugar * BuzzFeed * Barnes & Noble * Kirkus Reviews * Lambda Literary * Nerdette * The Nerd Daily * Polygon * Library Reads * io9 * Smart Bitches Trashy Books * LiteraryHub * Medium * BookBub * The Mary Sue * Chicago Tribune * NY Daily News * SyFy Wire * Powells.com * Bookish * Book Riot * In the vein of The Time Traveler’s Wife and Life After Life, The Invisible Life of Addie LaRue is New York Times bestselling author V. E. Schwab’s genre-defying tour de force. A Life No One Will Remember. A Story You Will Never Forget. France, 1714: in a moment of desperation, a young woman makes a Faustian bargain to live forever—and is cursed to be forgotten by everyone she meets. Thus begins the extraordinary life of Addie LaRue, and a dazzling adventure that will play out across centuries and continents, across history and art, as a young woman learns how far she will go to leave her mark on the world. But everything changes when, after nearly 300 years, Addie stumbles across a young man in a hidden bookstore and he remembers her name. At the Publisher's request, this title is being sold without Digital Rights Management Software (DRM) applied.",
        480,
        "http://books.google.com/books/content?id=vH3LDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    mistborn = crud.create_book(
        "t_ZYYXZq4RgC", "Mistborn", "Brandon Sanderson",
        "From #1 New York Times bestselling author Brandon Sanderson, the Mistborn series is a heist story of political intrigue and magical, martial-arts action. For a thousand years the ash fell and no flowers bloomed. For a thousand years the Skaa slaved in misery and lived in fear. For a thousand years the Lord Ruler, the \"Sliver of Infinity,\" reigned with absolute power and ultimate terror, divinely invincible. Then, when hope was so long lost that not even its memory remained, a terribly scarred, heart-broken half-Skaa rediscovered it in the depths of the Lord Ruler's most hellish prison. Kelsier \"snapped\" and found in himself the powers of a Mistborn. A brilliant thief and natural leader, he turned his talents to the ultimate caper, with the Lord Ruler himself as the mark. Kelsier recruited the underworld's elite, the smartest and most trustworthy allomancers, each of whom shares one of his many powers, and all of whom relish a high-stakes challenge. Only then does he reveal his ultimate dream, not just the greatest heist in history, but the downfall of the divine despot. But even with the best criminal crew ever assembled, Kel's plan looks more like the ultimate long shot, until luck brings a ragged girl named Vin into his life. Like him, she's a half-Skaa orphan, but she's lived a much harsher life. Vin has learned to expect betrayal from everyone she meets, and gotten it. She will have to learn to trust, if Kel is to help her master powers of which she never dreamed. This saga dares to ask a simple question: What if the hero of prophecy fails? Other Tor books by Brandon Sanderson The Cosmere The Stormlight Archive The Way of Kings Words of Radiance Edgedancer (Novella) Oathbringer The Mistborn trilogy Mistborn: The Final Empire The Well of Ascension The Hero of Ages Mistborn: The Wax and Wayne series Alloy of Law Shadows of Self Bands of Mourning Collection Arcanum Unbounded Other Cosmere novels Elantris Warbreaker The Alcatraz vs. the Evil Librarians series Alcatraz vs. the Evil Librarians The Scrivener's Bones The Knights of Crystallia The Shattered Lens The Dark Talent The Rithmatist series The Rithmatist Other books by Brandon Sanderson The Reckoners Steelheart Firefight Calamity At the Publisher's request, this title is being sold without Digital Rights Management Software (DRM) applied.",
        544,
        "http://books.google.com/books/content?id=t_ZYYXZq4RgC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    kings = crud.create_book(
        "QVn-CgAAQBAJ", "The Way of Kings", "Brandon Sanderson",
        "Introduces the world of Roshar through the experiences of a war-weary royal compelled by visions, a highborn youth condemned to military slavery, and a woman who is desperate to save her impoverished house.",
        1007,
        "http://books.google.com/books/content?id=QVn-CgAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )
    evelyn = crud.create_book(
        "PxNcDwAAQBAJ", "The 7 1⁄2 Deaths of Evelyn Hardcastle",
        "Stuart Turton",
        "\"Agatha Christie meets Groundhog Day...quite unlike anything I've ever read, and altogether triumphant.\"—A. J. Finn, #1 New York Times-bestselling author of The Woman in the Window The Rules of Blackheath Evelyn Hardcastle will be murdered at 11:00 p.m. There are eight days, and eight witnesses for you to inhabit. We will only let you escape once you tell us the name of the killer. Understood? Then let's begin... *** Evelyn Hardcastle will die. Every day until Aiden Bishop can identify her killer and break the cycle. But every time the day begins again, Aiden wakes up in the body of a different guest. And some of his hosts are more helpful than others. For fans of Claire North and Kate Atkinson, The 71⁄2 Deaths of Evelyn Hardcastle is a breathlessly addictive novel that follows one man's race against time to find a killer—but an astonishing time-turning twist means that nothing and no one are quite what they seem. Praise for The 7 1⁄2 Deaths of Evelyn Hardcastle: Costa First Novel Award 2018 Winner One of Stylist Magazine's 20 Must-Read Books of 2018 One of Harper's Bazaar's 10 Must-Read Books of 2018 One of Guardian's Best Books of 2018",
        480,
        "http://books.google.com/books/content?id=PxNcDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
    )

    #create users for testing
    new_users = []

    hunter = crud.create_user("Hunter", "Laine", "*****@*****.**",
                              "test")
    haley = crud.create_user("Haley", "Laine", "*****@*****.**", "test")
    connor = crud.create_user("Connor", "Laine", "*****@*****.**", "test")
    steven = crud.create_user("Steven", "Laine", "*****@*****.**", "test")
    mary = crud.create_user("Mary", "Laine", "*****@*****.**", "test")
    jake = crud.create_user("Jake", "Laine", "*****@*****.**", "test")

    # Create fake events for testing
    event_1 = crud.create_event(1, "Pleasanton", "2021-03-26", "18:00",
                                "20:00", "CA")
    event_2 = crud.create_event(2, "Berkeley", "2021-03-19", "19:00", "21:00",
                                "CA")
    event_3 = crud.create_event(3, "San Francisco", "2021-04-09", "20:00",
                                "22:00", "CA")
    event_4 = crud.create_event(4, "Remote", "2021-04-22", "18:00", "20:00")
    event_5 = crud.create_event(5, "Lafayette", "2021-04-14", "17:00", "19:00",
                                "CA")
    event_6 = crud.create_event(6, "Oakland", "2021-05-05", "18:00", "20:00",
                                "CA")

    # Create fake events_attendees for testing
    crud.create_event_attendee(hunter.id, event_1.id)
    crud.create_event_attendee(haley.id, event_1.id)
    crud.create_event_attendee(mary.id, event_2.id)
    crud.create_event_attendee(steven.id, event_2.id)
    crud.create_event_attendee(hunter.id, event_3.id)
    crud.create_event_attendee(connor.id, event_3.id)
    crud.create_event_attendee(jake.id, event_4.id)
    crud.create_event_attendee(haley.id, event_4.id)
    crud.create_event_attendee(hunter.id, event_5.id)
    crud.create_event_attendee(steven.id, event_5.id)
    crud.create_event_attendee(mary.id, event_6.id)
    crud.create_event_attendee(jake.id, event_6.id)
    crud.create_event_attendee(connor.id, event_3.id)
    crud.create_event_attendee(haley.id, event_2.id)
    crud.create_event_attendee(steven.id, event_1.id)

    # Create fake event_books for testing
    crud.create_event_book(event_1, evelyn)
    crud.create_event_book(event_2, harry_potter)
    crud.create_event_book(event_3, wind)
    crud.create_event_book(event_4, bees)
    crud.create_event_book(event_5, mistborn)
    crud.create_event_book(event_6, kings)
    crud.create_event_book(event_1, harry_potter)
    crud.create_event_book(event_2, mistborn)
    crud.create_event_book(event_3, crawdads)
    crud.create_event_book(event_4, neverwhere)
    crud.create_event_book(event_5, hidden)
    crud.create_event_book(event_6, evelyn)
    crud.create_event_book(event_1, addie)
    crud.create_event_book(event_2, wind)
    crud.create_event_book(event_3, harry_potter)
    crud.create_event_book(event_4, hidden)
    crud.create_event_book(event_5, crawdads)
    crud.create_event_book(event_6, addie)
    crud.create_event_book(event_1, bees)
    crud.create_event_book(event_2, evelyn)
    crud.create_event_book(event_3, addie)
    crud.create_event_book(event_4, crawdads)
    crud.create_event_book(event_5, neverwhere)
    crud.create_event_book(event_6, mistborn)

    # Create fake categories for testing
    hunter_cat_1 = crud.create_category(1, "Book Club")
    hunter_cat_2 = crud.create_category(1, "Want to Read")
    hunter_cat_3 = crud.create_category(1, "My Favorite Books")
    haley_cat_1 = crud.create_category(2, "Book Club")
    haley_cat_2 = crud.create_category(2, "Thrillers")
    haley_cat_3 = crud.create_category(2, "Beach Reads")
    connor_cat_1 = crud.create_category(3, "Non-Fiction")
    connor_cat_2 = crud.create_category(3, "Learn Something New")
    connor_cat_3 = crud.create_category(3, "My Favorite Books")
    steven_cat_1 = crud.create_category(4, "Want to Read")
    steven_cat_2 = crud.create_category(4, "Books to Recommend")
    steven_cat_3 = crud.create_category(4, "My Favorite Books")
    mary_cat_1 = crud.create_category(5, "Book Club")
    mary_cat_2 = crud.create_category(5, "Beach Reads")
    mary_cat_3 = crud.create_category(5, "Classics")
    jake_cat_1 = crud.create_category(6, "Historical Fiction")
    jake_cat_2 = crud.create_category(6, "Classics")
    jake_cat_3 = crud.create_category(6, "My Favorite Books")

    # Create fake book_categories for testing
    crud.create_book_category(hidden, hunter_cat_1)
    crud.create_book_category(addie, hunter_cat_1)
    crud.create_book_category(wind, hunter_cat_2)
    crud.create_book_category(kings, hunter_cat_2)
    crud.create_book_category(mistborn, hunter_cat_2)
    crud.create_book_category(wind, hunter_cat_3)
    crud.create_book_category(harry_potter, hunter_cat_3)
    crud.create_book_category(addie, haley_cat_1)
    crud.create_book_category(hidden, haley_cat_1)
    crud.create_book_category(wind, haley_cat_2)
    crud.create_book_category(evelyn, haley_cat_2)
    crud.create_book_category(mistborn, haley_cat_2)
    crud.create_book_category(bees, haley_cat_3)
    crud.create_book_category(crawdads, haley_cat_3)
    crud.create_book_category(addie, connor_cat_1)
    crud.create_book_category(hidden, connor_cat_1)
    crud.create_book_category(wind, connor_cat_1)
    crud.create_book_category(evelyn, connor_cat_2)
    crud.create_book_category(mistborn, connor_cat_2)
    crud.create_book_category(bees, connor_cat_3)
    crud.create_book_category(crawdads, connor_cat_3)
    crud.create_book_category(addie, steven_cat_1)
    crud.create_book_category(hidden, steven_cat_1)
    crud.create_book_category(wind, steven_cat_1)
    crud.create_book_category(evelyn, steven_cat_2)
    crud.create_book_category(mistborn, steven_cat_2)
    crud.create_book_category(bees, steven_cat_3)
    crud.create_book_category(crawdads, steven_cat_3)
    crud.create_book_category(addie, mary_cat_1)
    crud.create_book_category(neverwhere, mary_cat_1)
    crud.create_book_category(wind, mary_cat_1)
    crud.create_book_category(evelyn, mary_cat_2)
    crud.create_book_category(mistborn, mary_cat_2)
    crud.create_book_category(bees, mary_cat_3)
    crud.create_book_category(crawdads, mary_cat_3)
    crud.create_book_category(harry_potter, jake_cat_1)
    crud.create_book_category(hidden, jake_cat_1)
    crud.create_book_category(wind, jake_cat_1)
    crud.create_book_category(evelyn, jake_cat_2)
    crud.create_book_category(mistborn, jake_cat_2)
    crud.create_book_category(bees, jake_cat_3)
    crud.create_book_category(kings, jake_cat_3)