示例#1
0
def hold_controller():
    while (True):
        time.sleep(60 * 10)
        with DatabaseClient() as db:
            print("Making everyones hold to zero")
            with db_changing_lock:
                db.substract_hold_of_every_sub()
示例#2
0
def load_db_from_json(addition=None):
    with DatabaseClient() as db:
        print(f"json['addition'] from POST request: {addition}")
        with db_changing_lock:
            db.load_from_json(addition)
        return jsonify({"status": 200, "result": True, "addition": addition})
示例#3
0
def refresh_db():
    with DatabaseClient() as db:
        with db_changing_lock:
            db.drop_table()
            db.create_table()
        return jsonify({"status": 200, "result": True})
示例#4
0
def substract(sum=None, uuid=None, addition=None):
    with DatabaseClient() as db:
        print(f"extracted params is : {(sum, uuid)}")
        with db_changing_lock:
            db.substract_money_from_sub(uuid, sum)
        return jsonify({"status": 200, "result": True, "addition": addition})
示例#5
0
def add(sum=None, uuid=None, addition=None):
    with DatabaseClient() as db:
        with db_changing_lock:
            db.add_money_to_sub(uuid, sum)
        return jsonify({"status": 200, "result": True, "addition": addition})
示例#6
0
def user_from_json(uuid=None, addition=None):
    with DatabaseClient() as db:
        addition = db.select_user_by_uuid(uuid).dict_for_json()
        return jsonify({"status": 200, "result": True, "addition": addition})
示例#7
0
def users():
    with DatabaseClient() as db:
        return jsonify({"addition": db.dump_users_to_dict_for_json()})