Esempio n. 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!')
Esempio n. 2
0
def get():
    systemconfiguration = SystemConfiguration.query.all() or http_error(204)
    return jsonify({"data": systemconfiguration}), 200
Esempio n. 3
0
def find(systemconfiguration_id):
    systemconfiguration = SystemConfiguration.query.filter_by(
        id=systemconfiguration_id).first() or http_error(204)
    return jsonify({"message": systemconfiguration}), 200
Esempio n. 4
0
def get():
    user = User.query.all() or http_error(204)
    return jsonify({"data": user}), 200
Esempio n. 5
0
def find(user_id):
    user = User.query.filter_by(id=user_id).first() or http_error(204)
    return jsonify({"message": user}), 200
Esempio n. 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
Esempio n. 7
0
def get():
    country = Country.query.all() or http_error(204)
    return jsonify({"data": country}), 200
Esempio n. 8
0
def find(file_id):
    file = File.query.filter_by(id=file_id).first() or http_error(204)
    return jsonify({"message": file}), 200
Esempio n. 9
0
def find(site_id):
    site = Site.query.filter_by(id=site_id).first() or http_error(204)
    return jsonify({"message": site}), 200
Esempio n. 10
0
def get():
    mailaccount = MailAccount.query.all() or http_error(204)
    return jsonify({"data": mailaccount}), 200
Esempio n. 11
0
def find(mailaccount_id):
    mailaccount = MailAccount.query.filter_by(
        id=mailaccount_id).first() or http_error(204)
    return jsonify({"message": mailaccount}), 200
Esempio n. 12
0
def get():
    maildomain = MailDomain.query.all() or http_error(204)
    return jsonify({"data": maildomain}), 200
Esempio n. 13
0
def find(maildomain_id):
    maildomain = MailDomain.query.filter_by(
        id=maildomain_id).first() or http_error(204)
    return jsonify({"message": maildomain}), 200
Esempio n. 14
0
def get():
    template = Template.query.all() or http_error(204)
    return jsonify({"data": template}), 200
Esempio n. 15
0
def find(template_id):
    template = Template.query.filter_by(id=template_id).first() or http_error(204)
    return jsonify({"message": template}), 200
Esempio n. 16
0
def find(customer_id):
    customer = Customer.query.filter_by(
        id=customer_id).first() or http_error(204)
    return jsonify({"message": customer}), 200
Esempio n. 17
0
def get():
    customer = Customer.query.all() or http_error(204)
    return jsonify({"data": customer}), 200
Esempio n. 18
0
def get():
    site = Site.query.all() or http_error(204)
    return jsonify({"data": site}), 200
Esempio n. 19
0
def get():
    file = File.query.all() or http_error(204)
    return jsonify({"data": file}), 200
Esempio n. 20
0
def find(country_id):
    country = Country.query.filter_by(id=country_id).first() or http_error(204)
    return jsonify({"message": country}), 200