def delete(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"wrong"}) id = int(request.json['wordId']) collect.remove({"word_id":id}) return{ "status":200 }
def put(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"wrong"}) id = int(request.json['wordId']) collect.update({"word_id":id},{"$set":{"make_sent3":request.json["makeSent3"]}}) return{ "status":200 }
def put(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"wrong"}) id = int(request.json['wordId']) collect.update_one({"word_id":id},{"$set":{"paraphrase":request.json['paraphrase']}}) return{ "status":200 }
def put(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"no this user"}) user.user_name = request.json['username'] user.user_nikename = request.json['nikename'] user.user_email = request.json['email'] user.user_pass = request.json['password'] db.session.commit() return jsonify({"status":200})
def put(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status": "no this user"}) user.user_name = request.json['username'] user.user_nikename = request.json['nikename'] user.user_email = request.json['email'] user.user_pass = request.json['password'] db.session.commit() return jsonify({"status": 200})
def delete(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"wrong"}) wordId = request.json['wordId'] field = request.json['delete_field'] value = request.json['delete_value'] collect.update({"word_id":wordId},{"$unset":{field:value}}) return{ "status":200 }
def verify_token(): """ Required in body: token: String """ data = request.get_json(force=True) token = data.get("token") user = verify_auth_token(token) if user is None: abort(404, "Token does not match any user") return jsonify(user.serialize)
def post(self): token = request.json['token'] user = verify_auth_token(token) if user is None: return jsonify({"status":"wrong"}) count = collect.find_one({"count_id":1},{"_id":0}) word_id = count['count']+1 word = request.json del word['token'] word["word_id"] = word_id word["word_time"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") collect.insert(word) collect.update({"count_id":1},{"$set":{"count":word_id}}) return{ "status":200 }