23 lines
576 B
Python
23 lines
576 B
Python
|
from app.api import bp_user
|
||
|
from flask_jwt_extended import jwt_required, get_jwt_identity, get_jwt
|
||
|
from flask import request, abort
|
||
|
|
||
|
from flasgger import swag_from
|
||
|
|
||
|
from app.doc.user_swag import delete_swagger
|
||
|
from app.services.user import delete_service, logout_service
|
||
|
|
||
|
|
||
|
@bp_user.route("/delete", methods=["DELETE"])
|
||
|
@swag_from(delete_swagger)
|
||
|
@jwt_required()
|
||
|
def delete_user():
|
||
|
user_id = get_jwt_identity()
|
||
|
|
||
|
result, status_code = delete_service.delete_user(user_id)
|
||
|
|
||
|
jwt = get_jwt()
|
||
|
logout_service.logout(jwt, user_id, True)
|
||
|
|
||
|
return result, status_code
|