niming_backend/blueprints/admin/ig.py
2024-12-22 18:03:55 +00:00

37 lines
868 B
Python

from flask import Blueprint, jsonify
from utils import ighelper
from blueprints.admin.utils import role_required
# prefix: /admin/ig
bl_admin_ig = Blueprint("admin_ig", __name__)
# get ig account info
@bl_admin_ig.route("/accinfo", methods=["GET"])
@role_required(["ig.accinfo"])
def ig_accinfo():
result, err = ighelper.request_account_info()
if err:
return jsonify(result), 500
else:
return jsonify(result), 200
# execute login
@bl_admin_ig.route("/login", methods=["GET"])
@role_required(["ig.login"])
def ig_login():
result, err = ighelper.request_login()
if err:
return jsonify(result), 500
else:
return jsonify(result), 200
# check queue
@bl_admin_ig.route("/queue", methods=["GET"])
@role_required(["ig.queue"])
def ig_queue():
result = ighelper.request_queue()
return jsonify(result), 200