示例#1
0
def login():
    username = request.json.get('username') or http_error(
        500, 'USERNAME is required!')
    password = request.json.get('password') or http_error(
        500, 'PASSWORD is required!')
    user = User.query.filter_by(username=username).first() or http_error(
        401, 'Unauthorized! USER not found!')
    last_login(username)
    if user.check_password(password):
        return jsonify({
            'user': user_schema.dump(user),
            "token": token(user.id)
        })
    else:
        return http_error(401, 'Unauthorized! PASSWORD not found!')
示例#2
0
def get():
    systemconfiguration = SystemConfiguration.query.all() or http_error(204)
    return jsonify({"data": systemconfiguration}), 200
示例#3
0
def find(systemconfiguration_id):
    systemconfiguration = SystemConfiguration.query.filter_by(
        id=systemconfiguration_id).first() or http_error(204)
    return jsonify({"message": systemconfiguration}), 200
示例#4
0
def get():
    user = User.query.all() or http_error(204)
    return jsonify({"data": user}), 200
示例#5
0
def find(user_id):
    user = User.query.filter_by(id=user_id).first() or http_error(204)
    return jsonify({"message": user}), 200
示例#6
0
def user_exists():
    username = request.json.get('username') or http_error(
        500, 'USERNAME is required!')
    user = User.query.filter_by(username=username).first() or http_error(
        204, 'USERNAME is required!')
    return jsonify({"username": user.username}), 200
示例#7
0
def get():
    country = Country.query.all() or http_error(204)
    return jsonify({"data": country}), 200
示例#8
0
def find(file_id):
    file = File.query.filter_by(id=file_id).first() or http_error(204)
    return jsonify({"message": file}), 200
示例#9
0
def find(site_id):
    site = Site.query.filter_by(id=site_id).first() or http_error(204)
    return jsonify({"message": site}), 200
示例#10
0
def get():
    mailaccount = MailAccount.query.all() or http_error(204)
    return jsonify({"data": mailaccount}), 200
示例#11
0
def find(mailaccount_id):
    mailaccount = MailAccount.query.filter_by(
        id=mailaccount_id).first() or http_error(204)
    return jsonify({"message": mailaccount}), 200
示例#12
0
def get():
    maildomain = MailDomain.query.all() or http_error(204)
    return jsonify({"data": maildomain}), 200
示例#13
0
def find(maildomain_id):
    maildomain = MailDomain.query.filter_by(
        id=maildomain_id).first() or http_error(204)
    return jsonify({"message": maildomain}), 200
示例#14
0
def get():
    template = Template.query.all() or http_error(204)
    return jsonify({"data": template}), 200
示例#15
0
def find(template_id):
    template = Template.query.filter_by(id=template_id).first() or http_error(204)
    return jsonify({"message": template}), 200
示例#16
0
def find(customer_id):
    customer = Customer.query.filter_by(
        id=customer_id).first() or http_error(204)
    return jsonify({"message": customer}), 200
示例#17
0
def get():
    customer = Customer.query.all() or http_error(204)
    return jsonify({"data": customer}), 200
示例#18
0
def get():
    site = Site.query.all() or http_error(204)
    return jsonify({"data": site}), 200
示例#19
0
def get():
    file = File.query.all() or http_error(204)
    return jsonify({"data": file}), 200
示例#20
0
def find(country_id):
    country = Country.query.filter_by(id=country_id).first() or http_error(204)
    return jsonify({"message": country}), 200