From 375bbe9b98feb3f951b581343accc89d4c57398f Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 29 Dec 2020 15:18:40 -0800 Subject: [PATCH] add command to manually reset wallet data for a user --- bin/cmd | 4 ++-- wowstash/factory.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/cmd b/bin/cmd index d7f7cf4..d85f200 100755 --- a/bin/cmd +++ b/bin/cmd @@ -3,5 +3,5 @@ source .venv/bin/activate export FLASK_APP=wowstash/app.py export FLASK_SECRETS=config.py -export FLASK_DEBUG=1 -flask $1 +export FLASK_DEBUG=0 +flask $@ diff --git a/wowstash/factory.py b/wowstash/factory.py index d070b0e..e1b2def 100644 --- a/wowstash/factory.py +++ b/wowstash/factory.py @@ -1,3 +1,4 @@ +import click from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_wtf.csrf import CSRFProtect @@ -68,6 +69,14 @@ def create_app(): from wowstash.library.docker import docker docker.cleanup() + @app.cli.command('reset_wallet') + @click.argument('user_id') + def reset_wallet(user_id): + from wowstash.models import User + user = User.query.get(user_id) + user.clear_wallet_data() + print(f'Wallet data cleared for user {user.id}') + # Routes/blueprints from wowstash.blueprints.auth import auth_bp from wowstash.blueprints.wallet import wallet_bp