Esempio n. 1
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(255), unique=True)
    password = db.Column(db.String(255))
    active = db.Column(db.Boolean())
    confirmed_at = db.Column(db.DateTime())
    roles = db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic'))
Esempio n. 2
0
class CissEmbalagens(db.Model):
    """"""
    __tablename__ = 'PRODUTO_EMBALAGEM'
    __bind_key__ = 'ciss'

    unidadeembalagem = db.Column(db.String(2), primary_key=True)
    descrembalagem = db.Column(db.String(40))
Esempio n. 3
0
class MagTasks(db.Model):
    """
    representa as categorias do magento
    sendo a seção a categoria primaria
    o grupo a categoria secundária e o
    subgrupo a terciaria.
    """
    __tablename__ = 'mag_tasks'

    task_id = db.Column(db.String(100), primary_key=True)
    task_name = db.Column(db.String(60))
    create_at = db.Column(db.Date(), default=date.today)
    update_at = db.Column(db.Date(), onupdate=date.today)
    is_active = db.Column(
        db.String(1),
        db.CheckConstraint("is_active='T' or is_active='F'")
    )

    @classmethod
    def get_active_tasks(cls):
        return db.session.query(
            cls
        ).filter(
            cls.is_active == 'T'
        ).all()
Esempio n. 4
0
class StokyMetasView(db.Model):
    """
    Representa a View STOKY_METAS do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'STOKY_METAS'

    id_planilha = db.Column('IDPLANILHA', db.Integer, primary_key=True)
    id_empresa = db.Column('IDEMPRESA',
                           db.Integer,
                           db.ForeignKey('EMPRESA.IDEMPRESA'),
                           primary_key=True)
    id_sequencia = db.Column('NUMSEQUENCIA', db.Integer, primary_key=True)
    id_vendedor = db.Column('IDVENDEDOR',
                            db.Integer,
                            db.ForeignKey('CLIENTE_FORNECEDOR.IDCLIFOR'),
                            nullable=False)
    dt_movimento = db.Column('DTMOVIMENTO', db.Date())
    id_produto = db.Column('IDSUBPRODUTO',
                           db.Integer,
                           db.ForeignKey('PRODUTOS_VIEW.IDSUBPRODUTO'),
                           nullable=False)
    id_marca = db.Column('IDMARCAFABRICANTE', db.Integer,
                         db.ForeignKey('MARCA.IDMARCAFABRICANTE'))
    val_venda = db.Column('VENDA', db.Numeric(10, 2))
    val_devolucao = db.Column('DEVOLUCAO', db.Numeric(10, 2))
    val_lucro = db.Column('LUCRO', db.Numeric(10, 2))

    # Relacionamentos da View
    vendedor = db.relationship("ClienteFornecedor")
    produto = db.relationship('ViewProduto')
    marca = db.relationship('Marca')
Esempio n. 5
0
class CissProdutoFornecedor(db.Model):
    """
        Representa a tabela PRODUTO_FORNECEDOR
        do Ciss
    """
    __bind_key__ = 'ciss'
    __tablename__ = 'PRODUTO_FORNECEDOR'

    idclifor = db.Column(
        db.Integer(),
        db.ForeignKey('CLIENTE_FORNECEDOR.idclifor'), 
        primary_key=True
    )
    idproduto = db.Column(
        db.Integer(),
        db.ForeignKey('PRODUTO_GRADE.idproduto'), 
        primary_key=True
    )
    idsubproduto = db.Column(
        db.Integer(),
        db.ForeignKey('PRODUTO_GRADE.idsubproduto'), 
        primary_key=True
    )
    
    codigointernoforn = db.Column(db.String(60))

    fornecedor = db.relationship('CissClienteFornecedor')
Esempio n. 6
0
class UsersRoles(db.Model):
    __tablename__ = 'users_roles'
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('users.id', ondelete='CASCADE'))
    role_id = db.Column(db.Integer(),
                        db.ForeignKey('roles.id', ondelete='CASCADE'))
Esempio n. 7
0
class Location(db.Model):
    __tablename__ = 'location'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(200), nullable=False)
    slug = db.Column(db.String(100), nullable=False, unique=True)

    stop_points = db.relationship('StopPoint')
Esempio n. 8
0
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50),
                     nullable=False,
                     server_default=u'',
                     unique=True)  # for @roles_accepted()
    label = db.Column(db.Unicode(255),
                      server_default=u'')  # for display purposes
Esempio n. 9
0
class StopPoint(db.Model):
    __tablename__ = 'stop_point'

    id = db.Column(db.Integer, primary_key=True)
    city = db.Column(db.String(200), nullable=False)
    name = db.Column(db.String(300), nullable=False)
    ref = db.Column(db.String(30), nullable=False)

    location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
Esempio n. 10
0
class TimeMixin(db.Model):
    __abstract__ = True
    created_on = db.Column(db.DateTime,
                           default=datetime.utcnow,
                           server_default=db.func.now())
    updated_on = db.Column(db.DateTime,
                           default=datetime.utcnow,
                           onupdate=datetime.utcnow,
                           server_default=db.func.now())
class YearCode(db.Model):
    __tablename__ = 'yearcodes'
    id = db.Column(db.Integer, primary_key=True)
    year = db.Column(db.Integer)
    semester = db.Column(db.Integer)
    section = db.Column(db.String(1))

    def __str__(self):
        return f'{self.year} - {self.semester} - {self.section}'
class Branch(db.Model):
    __tablename__ = 'branches'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text)
    code = db.Column(db.String(10))
    phone = db.Column(db.Integer)
    email = db.Column(db.String(40))

    def __str__(self):
        return self.code
Esempio n. 13
0
class Terms(db.Model):
    __tablename__ = '2c191c_terms'
    term_id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(200))
    slug = db.Column(db.String(200))
    term_group = db.Column(db.Integer)
    term_order = db.Column(db.Integer)

    def __repr__(self):
        return 'id: {}, name: {}'.format(self.term_id, self.name)
Esempio n. 14
0
class TermTaxonomies(db.Model):
    __tablename__ = '2c191c_term_taxonomy'
    term_taxonomy_id = db.Column(db.Integer, primary_key=True)
    term_id = db.Column(db.Integer)
    taxonomy = db.Column(db.String(32))
    description = db.Column(db.Text())

    def __repr__(self):
        return 'term_id: {}, taxonomy: {}, description: {}'.format(
            self.term_id, self.taxonomy, self.description)
Esempio n. 15
0
class Marca(db.Model):
    """
    Representa a tabela MARCA do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'MARCA'

    marca_id = db.Column('IDMARCAFABRICANTE', db.Integer, primary_key=True)
    descricao = db.Column('DESCRICAO', db.String(100))
Esempio n. 16
0
class Empresa(db.Model):
    """
    Representa a tabela EMPRESA do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'EMPRESA'

    cli_id = db.Column('IDEMPRESA', db.Integer, primary_key=True)
    descricao = db.Column('NOMEFANTASIA', db.String(120))
Esempio n. 17
0
class MagSincronizacao(db.Model):
    """
        Contem os dados das ultima sincronizacoes
        com o magento
    """
    __tablename__ = 'mag_sincronizacao'

    sinc_id = db.Column(db.Integer, primary_key=True)
    dthr_preco = db.Column(db.DateTime())
    dthr_estoque = db.Column(db.DateTime())
Esempio n. 18
0
class CissProdutoPreco(db.Model):
    """"""
    __tablename__ = 'POLITICA_PRECO_PRODUTO'
    __bind_key__ = 'ciss'

    idproduto = db.Column(
        db.ForeignKey('PRODUTO_GRADE.idproduto'), 
        primary_key=True
    )
    idsubproduto = db.Column(
        db.ForeignKey('PRODUTO_GRADE.idsubproduto'), 
        primary_key=True
    )
    idempresa = db.Column(db.Integer, primary_key=True)
    valprecovarejo = db.Column(db.Numeric(15, 6))
    valpromvarejo = db.Column(db.Numeric(15, 6))
    dtalteracaovar = db.Column(db.DateTime())
    dtalteracaopromovar = db.Column(db.DateTime())
    dtinipromocaovar = db.Column(db.Date())
    dtfimpromocaovar = db.Column(db.Date())

    join = "and_("
    join = join + "CissProdutoPreco.idproduto==CissProdutoGrade.idproduto,"
    join = join + "CissProdutoPreco.idsubproduto==CissProdutoGrade.idsubproduto,"
    join = join + "CissProdutoPreco.idempresa==2)"

    produto = db.relationship(
        'CissProdutoGrade',
        backref=db.backref('preco', uselist=False),
        primaryjoin=join
    )
Esempio n. 19
0
class AuthToken(db.Model):
    __tablename__ = 'auth_token'
    id = db.Column(db.Integer, primary_key=True)
    token = db.Column(db.String(32), nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    #user = db.relationship('User', back_populates='auth_tokens')

    def __init__(self, user_id):
        self.token = uuid4().hex
        self.user_id = user_id
Esempio n. 20
0
class Participate(db.Model):
    __tablename__ = "participate"
    id = db.Column(db.Integer, primary_key=True)
    signaler_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    meeting_id = db.Column(db.Integer, db.ForeignKey("meetings.id"))
    signaler = relationship("User", backref="participate_meetings")
    meeting = relationship("Meeting", back_populates="participate_users")
    short_opinion = db.Column(db.String(100))

    def __repr__(self):
        return "<%s %s->%s>" % (self.__class__.__name__,
                                self.signaler.username, self.meeting.title)
Esempio n. 21
0
class CissProduto(db.Model):
    """"""
    __tablename__ = 'PRODUTO'
    __bind_key__ = 'ciss'

    idproduto = db.Column(db.Integer, primary_key=True)
    descrcomproduto = db.Column(db.String(60))
    fabricante = db.Column(db.String(40))
    embalagemsaida = db.Column(db.String(2), db.ForeignKey(
        'PRODUTO_EMBALAGEM.unidadeembalagem'))
    
    embalagem = db.relationship('CissEmbalagens')
Esempio n. 22
0
class Metas(db.Model):
    """
    Representa a tabela METAS do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'METAS'

    id = db.Column('IDMETA', db.Integer, primary_key=True)
    descricao = db.Column('DESCRMETA', db.String(60))
    dataInicial = db.Column('DTINICIAL', db.Date())
    dataFinal = db.Column('DTFINAL', db.Date())
Esempio n. 23
0
class CissNcm(db.Model):
    """
        Representa a tabela NCM
        do Ciss
    """
    __bind_key__ = 'ciss'
    __tablename__ = 'NCM'

    ncm = db.Column(db.String(8), primary_key=True)
    descricao = db.Column(db.String(820))
    flagcargatributariamedia = db.Column(
        db.String(1), 
        db.CheckConstraint("flagcargatributariamedia=='T' or flagcargatributariamedia=='F'")
    )
Esempio n. 24
0
class ViewProduto(db.Model):
    """
    Representa a View PRODUTOS_VIEW do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'PRODUTOS_VIEW'

    id_produto = db.Column('IDPRODUTO', db.Integer, primary_key=True)
    id_subproduto = db.Column('IDSUBPRODUTO', db.Integer, primary_key=True)
    descricao = db.Column('DESCRICAOPRODUTO', db.String(100))
    fabricante = db.Column('FABRICANTE', db.String(50))
    flag_inativo = db.Column(
        'FLAGINATIVO', db.String(1),
        db.CheckConstraint("flag_inativo=='T' or flag_inativo=='F'"))
Esempio n. 25
0
class MetasPrevisao(db.Model):
    """
    Representa a tabela METAS_PREVISAO do Ciss
    """

    __bind_key__ = 'ciss'
    __tablename__ = 'METAS_PREVISAO'

    idMeta = db.Column('IDMETA',
                       db.ForeignKey('METAS.IDMETA'),
                       primary_key=True)
    idSeq = db.Column('NUMSEQUENCIA', db.Integer, primary_key=True)
    valorVenda = db.Column('METAVLRVENDA', db.Numeric(10, 2))

    meta = db.relationship("Metas", backref=db.backref('metasPrevisao'))
Esempio n. 26
0
class Exhibition(Base):
    __tablename__ = 'exhibitions'

    id = db.Column(Integer, primary_key=True, index=True)
    title = Column(String, index=True)

    galleries = relationship("Gallery", back_populates="exhibition")
Esempio n. 27
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(100), unique=True, nullable=False)
    password_digest = db.Column(db.String(64), nullable=False)

    def __init__(self, username, password):
        self.username = username
        self.password_digest = password

    def __repr__(self):
        return 'User<{}>'.format(self.username)

    def set_password(self, password: str) -> None:
        self.password_digest = hash_password(password)

    def check_password(self, password: str) -> bool:
        return hash_password(password) == self.password_digest
Esempio n. 28
0
class CissPreVendaProd(db.Model):
    """
        Representa a tabela PRE_VENDA_PROD
        do Ciss
    """
    __bind_key__ = 'ciss'
    __tablename__ = 'PRE_VENDA_PROD'

    idempresa = db.Column(db.Integer, primary_key=True)
    dtmovimento = db.Column(db.Date(), primary_key=True)
    idprevenda = db.Column(db.Integer,
                           db.ForeignKey('PRE_VENDA.idprevenda'),
                           primary_key=True)
    idproduto = db.Column(db.ForeignKey('PRODUTO_GRADE.idproduto'),
                          primary_key=True)
    idsubproduto = db.Column(db.ForeignKey('PRODUTO_GRADE.idsubproduto'),
                             primary_key=True)
Esempio n. 29
0
class User(db.Model, UserMixin):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)

    # User authentication information (required for Flask-User)
    username = db.Column(db.Unicode(50),
                         nullable=False,
                         server_default=u'',
                         unique=True)
    password = db.Column(db.String(255), nullable=False, server_default='')
    # reset_password_token = db.Column(db.String(100), nullable=False, server_default='')
    active = db.Column(db.Boolean(), nullable=False, server_default='0')

    # User information
    active = db.Column('is_active',
                       db.Boolean(),
                       nullable=False,
                       server_default='0')
    first_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    last_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')

    # Relationships
    roles = db.relationship('Role',
                            secondary='users_roles',
                            backref=db.backref('users', lazy='dynamic'))
Esempio n. 30
0
class MagErrosProdutos(db.Model):
    """
        representa os erros gerados ao
        realizar ações de cadastro de
        informações de produtos no
        integrador.
    """
    __tablename__ = 'mag_error_produtos'

    id_erro = db.Column(db.Integer, primary_key=True)
    sku = db.Column(db.Integer)
    origem = db.Column(db.String(40))
    message = db.Column(db.String(100))
    update_at = db.Column(
        db.DateTime(),
        default=datetime.now,
        onupdate=datetime.now
    )