mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 19:34:19 +00:00
23 lines
572 B
Python
23 lines
572 B
Python
|
from flask import current_app
|
||
|
from threading import Thread
|
||
|
from app import db
|
||
|
from app.models import User
|
||
|
from . import bp
|
||
|
|
||
|
|
||
|
@bp.route('/users/<hashid:user_id>/delete', methods=['DELETE'])
|
||
|
def delete_user(user_id):
|
||
|
def _delete_user(app, user_id):
|
||
|
with app.app_context():
|
||
|
user = User.query.get(user_id)
|
||
|
user.delete()
|
||
|
db.session.commit()
|
||
|
|
||
|
User.query.get_or_404(user_id)
|
||
|
thread = Thread(
|
||
|
target=_delete_user,
|
||
|
args=(current_app._get_current_object(), user_id)
|
||
|
)
|
||
|
thread.start()
|
||
|
return {}, 202
|