Exemple #1
0
def search_book_intro_index_version_in_store():
    book_intro = request.json.get("book_intro", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code, message = u.search_book_intro_index_version_in_store(
        book_intro=book_intro, store_id=store_id)
    return jsonify({"message": message}), code
def get_store_id():
    user_id = request.json.get("user_id", "")
    book_id = request.json.get("book_id", "")
    u = user.User()
    code, message, store_id_list = u.get_store_id(user_id=user_id,
                                                  book_id=book_id)
    return jsonify({"message": message, "store_id_list": store_id_list}), code
Exemple #3
0
def change_password():
    user_id = request.json.get("user_id", "")
    old_password = request.json.get("oldPassword", "")
    new_password = request.json.get("newPassword", "")
    u = user.User()
    code, message = u.change_password(user_id=user_id, old_password=old_password, new_password=new_password)
    return jsonify({"message": message}), code
Exemple #4
0
def login():
    user_id = request.json.get("user_id", "")
    password = request.json.get("password", "")
    terminal = request.json.get("terminal", "")
    u = user.User()
    code, message, token = u.login(user_id=user_id, password=password, terminal=terminal)
    return jsonify({"message": message, "token": token}), code
Exemple #5
0
def search_tags_in_store():
    tags = request.json.get("tags", "")
    page = request.json.get("page", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code = u.search_tags_in_store(tags=tags, store_id=store_id,page=page)
    return '', code
Exemple #6
0
def search_title_in_store():
    title = request.json.get("title", "")
    page = request.json.get("page", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code = u.search_title_in_store(title=title,store_id=store_id, page=page)
    return '', code
Exemple #7
0
def search_author_in_store():
    author = request.json.get("author", "")
    page = request.json.get("page", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code = u.search_author_in_store(author=author,store_id=store_id,page=page)
    return '', code
Exemple #8
0
def search_book_intro_in_store():
    book_intro = request.json.get("book_intro", "")
    page = request.json.get("page", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code = u.search_book_intro_in_store(book_intro=book_intro, store_id=store_id,page=page)
    return '', code
Exemple #9
0
def unregister():
    username = request.json.get("username", "")
    password = request.json.get("password", "")
    u = user.User()
    if u.unregister(username=username, password=password):
        return jsonify({"message": "ok"}), 200
    else:
        return jsonify({"message": "Invalid username or password"}), 401
Exemple #10
0
def register():
    username = request.json.get("username", "")
    password = request.json.get("password", "")
    u = user.User()
    if u.register(username=username, password=password):
        return jsonify({"message": "ok"}), 200
    else:
        return jsonify({"message": "fail, username has exists"}), 401
Exemple #11
0
def logout():
    username: str = request.json.get("username", "")
    token: str = request.headers.get("token", "")
    u = user.User()
    if u.logout(username=username, token=token):
        return jsonify({"message": "ok"}), 200
    else:
        return jsonify({"message": "Invalid token"}), 401
def global_search_book_intro():
    user_id = request.json.get("user_id", "")
    search_info = request.json.get("search_info", "")
    page = request.json.get("page", "")
    u = user.User()
    code, message, book_id = u.global_search_book_intro(
        user_id=user_id, search_info=search_info, page=page)
    return jsonify({"message": message, "book_id": book_id}), code
Exemple #13
0
def login():
    username = request.json.get("username", "")
    password = request.json.get("password", "")
    terminal = request.json.get("terminal", "")
    u = user.User()
    ok, token = u.login(username=username, password=password, terminal=terminal)
    if ok:
        return jsonify({"message": "ok", "token": token}), 200
    else:
        return jsonify({"message": "Invalid username or password"}), 401
Exemple #14
0
def change_password():
    username = request.json.get("username", "")
    old_password = request.json.get("oldPassword", "")
    new_password = request.json.get("newPassword", "")
    u = user.User()
    if u.change_password(
        username=username, old_password=old_password, new_password=new_password
    ):
        return jsonify({"message": "ok"}), 200
    else:
        return jsonify({"message": "Invalid username or password"}), 401
def store_search_content():
    user_id = request.json.get("user_id", "")
    store_id = request.json.get("store_id", "")
    search_info = request.json.get("search_info", "")
    page = request.json.get("page", "")
    u = user.User()
    code, message, book_id = u.store_search_content(user_id=user_id,
                                                    store_id=store_id,
                                                    search_info=search_info,
                                                    page=page)
    return jsonify({"message": message, "book_id": book_id}), code
Exemple #16
0
def search():
    target_store_id: list = None
    target_id: list = None
    target_title: list = None
    target_tags: list = None
    target_author: list = None
    target_publisher: list = None
    target_original_title: list = None
    target_translator: list = None
    target_pub_year: list = None
    target_pages: list = None
    target_price: list = None
    target_binding: list = None
    target_isbn: list = None
    target_author_intro: list = None
    target_book_intro: list = None
    target_content: list = None
    target_stock_level: int = None
    target_store_id = request.json.get("store_id")

    target_id = request.json.get("id")

    target_title = request.json.get("title")

    target_author = request.json.get("author")

    target_publisher = request.json.get("publisher")
    target_original_title = request.json.get("original_title")
    target_translator = request.json.get("translator")
    target_pub_year = request.json.get("pub_year")
    target_pages = request.json.get("pages")
    target_price = request.json.get("price")
    target_binding = request.json.get("binding")
    target_isbn = request.json.get("isbn")
    target_author_intro = request.json.get("author_intro")
    target_book_intro = request.json.get("book_intro")
    target_content = request.json.get("content")
    target_tags = request.json.get("tags")
    target_stock_level = request.json.get("stock_level")

    u = user.User()
    code, ret = u.search_by_arguments(
        target_store_id, target_id, target_title, target_tags, target_author,
        target_publisher, target_original_title, target_translator,
        target_pub_year, target_pages, target_price, target_binding,
        target_isbn, target_author_intro, target_book_intro, target_content,
        target_stock_level)
    return jsonify("results:", ret), code
Exemple #17
0
def unregister():
    user_id = request.json.get("user_id", "")
    password = request.json.get("password", "")
    u = user.User()
    code, message = u.unregister(user_id=user_id, password=password)
    return jsonify({"message": message}), code
Exemple #18
0
def search_title():
    title = request.json.get("title", "")
    page = request.json.get("page", "")
    u = user.User()
    code = u.search_title(title=title, page=page)
    return '', code
Exemple #19
0
def search_author_in_store():
    author = request.json.get("author", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code, message = u.search_author_in_store(author=author,store_id=store_id)
    return jsonify({"message": message}), code
Exemple #20
0
def logout():
    user_id: str = request.json.get("user_id")
    token: str = request.headers.get("token")
    u = user.User()
    code, message = u.logout(user_id=user_id, token=token)
    return jsonify({"message": message}), code
Exemple #21
0
def search_tags():
    tags = request.json.get("tags", "")
    u = user.User()
    code, message = u.search_tags(tags=tags)
    return jsonify({"message": message}), code
Exemple #22
0
def search_title():
    title = request.json.get("title", "")
    u = user.User()
    code, message = u.search_title(title=title)
    return jsonify({"message": message}), code
Exemple #23
0
def search_author():
    author = request.json.get("author", "")
    u = user.User()
    code, message = u.search_author(author=author)
    return jsonify({"message": message}), code
Exemple #24
0
def search_book_intro():
    book_intro = request.json.get("book_intro", "")
    u = user.User()
    code, message = u.search_book_intro(book_intro=book_intro)
    return jsonify({"message": message}), code
Exemple #25
0
def search_author():
    author = request.json.get("author", "")
    page = request.json.get("page", "")
    u = user.User()
    code = u.search_author(author=author, page=page)
    return '', code
Exemple #26
0
def search_title_in_store():
    title = request.json.get("title", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code, message = u.search_title_in_store(title=title,store_id=store_id)
    return jsonify({"message": message}), code
Exemple #27
0
def search_tags_in_store():
    tags = request.json.get("tags", "")
    store_id = request.json.get("store_id", "")
    u = user.User()
    code, message = u.search_tags_in_store(tags=tags, store_id=store_id)
    return jsonify({"message": message}), code
Exemple #28
0
def search_book_intro():
    book_intro = request.json.get("book_intro", "")
    page = request.json.get("page", "")
    u = user.User()
    code = u.search_book_intro(book_intro=book_intro, page=page)
    return '', code
Exemple #29
0
def search_tags():
    tags = request.json.get("tags", "")
    page = request.json.get("page", "")
    u = user.User()
    code = u.search_tags(tags=tags, page=page)
    return '', code