def generate_book_id(): if not current_user.is_authenticated or current_user.type != 'book_admin': return get_response(status='fail: have no permission.') return get_response(status='success', data=Book.generate_book_id())