예제 #1
0
class Role(db.Model, RoleMixin):

    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(256), unique=True, nullable=False)
    access = db.Column(db.String(4000))

    users = db.relationship('User', secondary='roles_users')

    def __str__(self):
        return '%s' % self.name
예제 #2
0
class CustomerBillingReport(ModelBase, db.Model):
    customer_code = db.Column(db.Integer(), nullable=False)
    customer_name = db.Column(db.String(128), nullable=False)
    seller = db.Column(db.Integer(), nullable=False)
    current_value = db.Column(db.DECIMAL(asdecimal=False,
                                         precision=17,
                                         scale=2),
                              nullable=False)
    latest_value = db.Column(db.DECIMAL(asdecimal=False, precision=17,
                                        scale=2),
                             nullable=False)
    variation = db.Column(db.DECIMAL(asdecimal=False, precision=17, scale=2),
                          nullable=False)
    month = db.Column(db.Integer(), nullable=False)
    year = db.Column(db.Integer(), nullable=False)
    date = db.Column(db.Date())
예제 #3
0
class NumberActiveCustomers(ModelBase, db.Model):
    average_latest_year = db.Column(db.DECIMAL(asdecimal=False,
                                               precision=17,
                                               scale=2),
                                    nullable=False)
    number_current_day = db.Column(db.Integer(), nullable=False)
    number_current_month = db.Column(db.Integer(), nullable=False)
    number_latest_day = db.Column(db.Integer(), nullable=False)
    number_latest_month = db.Column(db.Integer(), nullable=False)
    seller = db.Column(db.Integer(), nullable=False)
    date = db.Column(db.Date(), nullable=False)
예제 #4
0
class ReportProducts(ModelBase, db.Model):
    brand = db.Column(db.String(128), nullable=False)
    label = db.Column(db.String(128), nullable=False)
    status = db.Column(db.Enum(*[e.value for e in ReportStatus]),
                       nullable=False)
    seller = db.Column(db.Integer(), nullable=False)
    month = db.Column(db.Integer(), nullable=False)
    latest_year = db.Column(db.Integer(), nullable=False)
    current_year = db.Column(db.Integer(), nullable=False)
    qtd_latest_year = db.Column(db.Integer(), nullable=False)
    value_latest_year = db.Column(db.DECIMAL(asdecimal=False,
                                             precision=17,
                                             scale=2),
                                  nullable=False)
    qtd_current_year = db.Column(db.Integer(), nullable=False)
    value_current_year = db.Column(db.DECIMAL(asdecimal=False,
                                              precision=17,
                                              scale=2),
                                   nullable=False)
    date = db.Column(db.Date())
예제 #5
0
class Budget(ModelBase, db.Model):
    month = db.Column(db.Integer(), nullable=False)
    year = db.Column(db.Integer(), nullable=False)
    value = db.Column(db.DECIMAL(asdecimal=False, precision=17, scale=2), nullable=False)
    ref = db.Column(db.String(256), nullable=False)
    type_ref = db.Column(db.Enum(*[e.value for e in TypeRef]), nullable=False)
예제 #6
0
class Configuration(ModelBase, db.Model):
    key = db.Column(db.Integer(), nullable=False)
    value = db.Column(db.String(256), nullable=False)
예제 #7
0
class User(ModelBase, db.Model, UserMixin):
    id = db.Column(db.Integer(), nullable=False, primary_key=True)

    name = db.Column(db.String(256), nullable=False)
    email = db.Column(db.String(256), unique=True, nullable=False)
    password = db.Column(db.String(256))
    active = db.Column(db.Boolean())
    confirmed_at = db.Column(db.DateTime())
    last_login_at = db.Column(db.DateTime())
    current_login_at = db.Column(db.DateTime())
    last_login_ip = db.Column(db.String(256))
    current_login_ip = db.Column(db.String(256))
    login_count = db.Column(db.Integer)
    last_user_agent = db.Column(db.String(1024))
    current_user_agent = db.Column(db.String(1024))

    profile_photo_id = db.Column(db.Integer, db.ForeignKey(File.id))
    profile_photo = db.relationship(File, foreign_keys=profile_photo_id)

    roles = db.relationship('Role', secondary=roles_users)

    def __str__(self):
        return '%s' % self.email
예제 #8
0
from enum import Enum
from sqlalchemy import event
from gorillaspy.business.model import ModelBase, File
from optilab_bi import db
from optilab_bi.helpers import input_audit_data_on_insert, input_audit_data_on_update
from flask_security.core import UserMixin, RoleMixin

roles_users = db.Table(
    'roles_users', db.Column('user_id', db.Integer(),
                             db.ForeignKey('user.id')),
    db.Column('role_id', db.Integer(), db.ForeignKey('role.id')))


class User(ModelBase, db.Model, UserMixin):
    id = db.Column(db.Integer(), nullable=False, primary_key=True)

    name = db.Column(db.String(256), nullable=False)
    email = db.Column(db.String(256), unique=True, nullable=False)
    password = db.Column(db.String(256))
    active = db.Column(db.Boolean())
    confirmed_at = db.Column(db.DateTime())
    last_login_at = db.Column(db.DateTime())
    current_login_at = db.Column(db.DateTime())
    last_login_ip = db.Column(db.String(256))
    current_login_ip = db.Column(db.String(256))
    login_count = db.Column(db.Integer)
    last_user_agent = db.Column(db.String(1024))
    current_user_agent = db.Column(db.String(1024))

    profile_photo_id = db.Column(db.Integer, db.ForeignKey(File.id))
    profile_photo = db.relationship(File, foreign_keys=profile_photo_id)
예제 #9
0
class AgreedDateGroup(ModelBase, db.Model):
    date = db.Column(db.JSON(), nullable=False)
    business_code = db.Column(db.Integer(), nullable=False)