cli: Support dropping registrations

This commit is contained in:
Cara Salter 2022-12-06 18:07:57 -05:00
parent b43779063d
commit bd7d7c4637
No known key found for this signature in database
GPG key ID: 90C66610C82B29CA

View file

@ -102,3 +102,23 @@ def waitlist_user(email):
msg.body = render_template("emails/waitlist_promotion.txt", user=user)
mail.send(msg)
click.echo(f"Promoted {user.first_name} from the waitlist")
@gr.command("drop")
@click.option("--email", prompt=True)
@click.option("--confirm/--noconfirm", prompt=False, default=True)
def drop_user(email, confirm):
"""
Drops a user's registration
"""
user = User.query.filter_by(email=email).one()
if not confirm:
pass
else:
if click.confirm(f"Are you sure you want to drop {user.first_name} {user.last_name}'s registration? **THIS IS IRREVERSIBLE**"):
pass
else:
return
db.session.delete(user)
db.session.commit()
click.echo(f"Dropped {user.first_name}'s registration")