def post(self): token = token_parser.parse_args().token account_args = register_parser.parse_args() result = create_account( account_args.username, account_args.password, account_args.confirm, account_args.role, account_args.nickname, token=token ) return result
def get(self): token = token_parser.parse_args().token args = request.args if args: accounts = get_accounts(args, token=token) else: accounts = get_all_accounts(token=token) return {'accounts': accounts}
def post(self): token = token_parser.parse_args().token vip_args = vip_post_parser.parse_args() result = create_vip(vip_args.username, vip_args.nickname, vip_args.phone, token=token) return result
def get(self): token = token_parser.parse_args().token args = request.args if args: vips = get_vips(args, token=token) else: vips = get_all_vips(token=token) return {'vips': vips}
def get(self): token = token_parser.parse_args().token args = request.args if args: books_types = get_book_types(args, token=token) else: books_types = get_all_types(token=token) return {'books_types': books_types}
def post(self): token = token_parser.parse_args().token sales_args = sales_record_post_parser.parse_args() result = create_sales_record(sales_args.count, sales_args.seller_id, sales_args.book_id, sales_args.purchaser_id, token=token) return result
def post(self): token = token_parser.parse_args().token book_args = book_post_parser.parse_args() result = create_book(book_args.name, book_args.price, book_args.count, book_args.des, token=token) return result
def put(self, book_id): token = token_parser.parse_args().token book_args = book_put_parser.parse_args() result = update_book(book_id, book_args.delta, book_args.price, book_args.des, book_args.type_ids, token=token) return result
def put(self, account_id): token = token_parser.parse_args().token account_args = account_update_parser.parse_args() result = update_account(account_id, account_args.nickname, account_args.des, account_args.old_password, account_args.new_password, account_args.confirm, token=token) return result
def get(self): token = token_parser.parse_args().token sales_records = get_all_sales_records(token=token) return {'sales_records': sales_records}
def get(self, account_id): token = token_parser.parse_args().token return get_account_by_id(account_id, token=token)
def delete(self, account_id): token = token_parser.parse_args().token result = rm_account(account_id, token=token) return result
def delete(self, vip_id): token = token_parser.parse_args().token result = rm_vip(vip_id, token=token) return result
def get(self, book_type_id): token = token_parser.parse_args().token books = get_books_by_type(book_type_id, token=token) return {'books': books}
def get(self, book_id): token = token_parser.parse_args().token return get_book_by_id(book_id, token=token)
def get(self, book_id): token = token_parser.parse_args().token sales_records = get_sales_records_by_book(book_id, token=token) return {'sales_records': sales_records}
def get(self, account_id): token = token_parser.parse_args().token sales_records = get_sales_records_by_account(account_id, token=token) return {'sales_records': sales_records}
def post(self): token = token_parser.parse_args().token book_args = book_type_post_parser.parse_args() result = create_book_type(book_args.name, token=token) return result
def delete(self, book_type_id): token = token_parser.parse_args().token result = rm_book_type(book_type_id, token=token) return result
def delete(self): token = token_parser.parse_args().token result = logout(token) return result
def get(self, vip_id): token = token_parser.parse_args().token sales_records = get_sales_records_by_vip(vip_id, token=token) return {'sales_records': sales_records}