Пример #1
0
 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
     }
Пример #2
0
 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
     }
Пример #3
0
    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
        }