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)
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())
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
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
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())
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)
class Configuration(ModelBase, db.Model): key = db.Column(db.Integer(), nullable=False) value = db.Column(db.String(256), nullable=False)
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)
class AgreedDateGroup(ModelBase, db.Model): date = db.Column(db.JSON(), nullable=False) business_code = db.Column(db.Integer(), nullable=False)