Пример #1
0
class ApiMsg(db.Model):
    __tablename__ = 'api_msg'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    num = db.Column(db.Integer(), nullable=True, comment='接口序号')
    name = db.Column(db.String(128), nullable=True, comment='接口名称')
    desc = db.Column(db.String(256), nullable=True, comment='接口描述')
    variable_type = db.Column(db.String(32), nullable=True, comment='参数类型选择')
    status_url = db.Column(db.String(32),
                           nullable=True,
                           comment='基础url,序号对应项目的环境')
    up_func = db.Column(db.String(128), comment='接口执行前的函数')
    down_func = db.Column(db.String(128), comment='接口执行后的函数')
    method = db.Column(db.String(32), nullable=True, comment='请求方式')
    variable = db.Column(db.Text(), comment='form-data形式的参数')
    json_variable = db.Column(db.Text(), comment='json形式的参数')
    param = db.Column(db.Text(), comment='url上面所带的参数')
    url = db.Column(db.String(256), nullable=True, comment='接口地址')
    skip = db.Column(db.String(256), comment='跳过判断')
    extract = db.Column(db.String(2048), comment='提取信息')
    validate = db.Column(db.String(2048), comment='断言信息')
    header = db.Column(db.String(2048), comment='头部信息')
    module_id = db.Column(db.Integer,
                          db.ForeignKey('module.id'),
                          comment='所属的接口模块id')
    project_id = db.Column(db.Integer, nullable=True, comment='所属的项目id')
    created_time = db.Column(db.DateTime, index=True, default=datetime.now)
    update_time = db.Column(db.DateTime,
                            index=True,
                            default=datetime.now,
                            onupdate=datetime.now)
Пример #2
0
class CaseData(db.Model):
    __tablename__ = 'case_data'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    num = db.Column(db.Integer(), nullable=True, comment='步骤序号,执行顺序按序号来')
    status = db.Column(db.String(16), comment='状态,true表示执行,false表示不执行')
    name = db.Column(db.String(128), comment='步骤名称')
    up_func = db.Column(db.String(256), comment='步骤执行前的函数')
    down_func = db.Column(db.String(256), comment='步骤执行后的函数')
    skip = db.Column(db.String(64), comment='跳过判断函数')
    time = db.Column(db.Integer(), default=1, comment='执行次数')
    param = db.Column(db.Text(), default=u'[]')
    status_param = db.Column(db.String(64), default=u'[true, true]')
    variable = db.Column(db.Text())
    json_variable = db.Column(db.Text())
    status_variables = db.Column(db.String(64))
    extract = db.Column(db.String(2048))
    status_extract = db.Column(db.String(64))
    validate = db.Column(db.String(2048))
    status_validate = db.Column(db.String(64))
    header = db.Column(db.String(2048))
    status_header = db.Column(db.String(64))
    case_id = db.Column(db.Integer, db.ForeignKey('case.id'))
    api_msg_id = db.Column(db.Integer, db.ForeignKey('api_msg.id'))
    created_time = db.Column(db.DateTime, index=True, default=datetime.now)
    update_time = db.Column(db.DateTime,
                            index=True,
                            default=datetime.now,
                            onupdate=datetime.now)
Пример #3
0
class Project(db.Model):
    __tablename__ = 'project'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    user_id = db.Column(db.Integer(), nullable=True, comment='所属的用户id')
    name = db.Column(db.String(64), nullable=True, unique=True, comment='项目名称')
    host = db.Column(db.String(1024), nullable=True, comment='测试环境')
    host_two = db.Column(db.String(1024), comment='开发环境')
    host_three = db.Column(db.String(1024), comment='线上环境')
    host_four = db.Column(db.String(1024), comment='备用环境')
    environment_choice = db.Column(db.String(16), comment='环境选择,first为测试,以此类推')
    principal = db.Column(db.String(16), nullable=True)
    variables = db.Column(db.String(2048), comment='项目的公共变量')
    headers = db.Column(db.String(1024), comment='项目的公共头部信息')
    func_file = db.Column(db.String(64),
                          nullable=True,
                          unique=True,
                          comment='函数文件')
    modules = db.relationship('Module',
                              order_by='Module.num.asc()',
                              lazy='dynamic')
    configs = db.relationship('Config',
                              order_by='Config.num.asc()',
                              lazy='dynamic')
    case_sets = db.relationship('CaseSet',
                                order_by='CaseSet.num.asc()',
                                lazy='dynamic')
    created_time = db.Column(db.DateTime,
                             index=True,
                             default=datetime.now,
                             comment='创建时间')
    update_time = db.Column(db.DateTime,
                            index=True,
                            default=datetime.now,
                            onupdate=datetime.now)
Пример #4
0
class Paciente(db.Model):

    # table name
    __tablename__ = 'paciente'
    idpaciente = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    idpersona = db.Column(db.Integer(), nullable=False)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
class PacienteObraSocial(db.Model):

    # table name
    __tablename__ = 'pacienteobrasocial'
    IdPaciente = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    IdObraSocial = db.Column(db.Integer(), nullable=False)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
Пример #6
0
class Room(GenericModel):
    id = db.Column('room_id', db.Integer(), primary_key=True)
    type = db.Column('room_type', db.String(40),)
    charge = db.Column('room_charge',db.Float())
    status = db.Column('room_status',db.String(30))
    qty = db.Column('room_qry',db.Integer())

    @staticmethod
    def dummy_room():
        return Room(id=0,type='',charge='',status='',qty=0)
Пример #7
0
class Naming(db.Model):
    __tablename__ = "resourceDefinition"
    index = db.Column(db.Integer)
    name = db.Column(db.String(64), primary_key=True,
                     unique=True, nullable=False)
    regex = db.Column(db.String(256))
    scope = db.Column(db.String(16))
    slug = db.Column(db.String(16))
    dashes = db.Column(db.Boolean())
    lengthmin = db.Column(db.Integer())
    lengthmax = db.Column(db.Integer())
Пример #8
0
class Consulta(db.Model):

    # table name
    __tablename__ = 'consulta'
    IdConsulta = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    IdObraSocial = db.Column(db.Integer(), nullable=False)
    IdGestionturno = db.Column(db.Integer(), nullable=False)
    Fecha = db.Column(db.DateTime(), nullable=False)
    IdPaciente = db.Column(db.Integer(), nullable=False)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
Пример #9
0
class Customer(GenericModel):
    id = db.Column('cust_id', db.Integer(), primary_key=True)
    name = db.Column('cust_name', db.String(40), unique=True)
    address = db.Column('cust_address', db.String(40),)
    contact = db.Column('cust_contact',db.Integer())
    email = db.Column('cust_email',db.String(40))
    accno = db.Column("acc_id", db.ForeignKey("account.acc_no"), unique=True, nullable=True)
    orderref = db.relationship("Mainorder",lazy=True,backref="custref",uselist=True)

    @staticmethod
    def dummy_cust():
        return Customer(id='', name='', address='', contact='', email='')
Пример #10
0
class Pagos(db.Model):

    # table name
    __tablename__ = 'pagos'
    IdPagos  = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    IdConsulta = db.Column(db.Integer(), nullable=False)
    IdPaciente = db.Column(db.Integer(), nullable=False)
    Monto = db.Column(db.Float(), nullable=False)
    Observaciones = db.Column(db.String(), nullable=False)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
Пример #11
0
class Visits(db.Model):
    __tablename__ = 'visits'
    id = db.Column(db.Integer(), primary_key=True)

    cluster_id = db.Column(db.Integer())
    start = db.Column(db.DateTime)
    end = db.Column(db.DateTime)

    @staticmethod
    def add_db(objs):
        db.session.bulk_save_objects(objs)
        db.session.commit()
Пример #12
0
class SolutionEnvironment(db.Model):
    __tablename__ = "solutionenvironment"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    solutionId = db.Column(db.Integer(), db.ForeignKey("eagle_db.solution.id"))
    environmentId = db.Column(db.Integer(),
                              db.ForeignKey("eagle_db.lzenvironment.id"))
    lastUpdated = db.Column(db.String(20))
    isActive = db.Column(db.Boolean())

    def __repr__(self):
        return "<Solution(id={self.id!r}, solutionId={self.solutionId!r}, solutionId={self.environmentId!r})>".format(
            self=self)
Пример #13
0
class ActivatorCD(db.Model):
    __tablename__ = "activatorCD"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    activatorId = db.Column(db.Integer(),
                            db.ForeignKey("eagle_db.activator.id"))
    cdId = db.Column(db.Integer(), db.ForeignKey("eagle_db.cd.id"))
    lastUpdated = db.Column(db.String(20))
    isActive = db.Column(db.Boolean())

    def __repr__(self):
        return "<Activator(id={self.id!r}, activatorId={self.activatorId!r}, activatorId={self.cdId!r})>".format(
            self=self)
Пример #14
0
class NotificationApplicationDeployment(db.Model):
    __tablename__ = "notificationApplicationDeployment"
    __table_args__ = {"schema": "eagle_db"}
    isActive = db.Column(db.Boolean())
    lastUpdated = db.Column(db.String(20))
    notificationId = db.Column(db.Integer(),
                               db.ForeignKey("eagle_db.notification.id"),
                               primary_key=True)
    applicationId = db.Column(db.Integer(),
                              db.ForeignKey("eagle_db.application.id"),
                              primary_key=True)

    def __repr__(self):
        return "<NotificationApplicationDeployment(notificationId={self.notificationId!r}, applicationId={self.applicationId!r})>".format(
            self=self)
Пример #15
0
class ActivatorMetadataVariable(db.Model):
    __tablename__ = "activatorMetadataVariables"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    activatorMetadataId = db.Column(
        db.Integer(), db.ForeignKey("eagle_db.activatorMetadata.id"))
    name = db.Column(db.String(255))
    type = db.Column(db.String(255))
    value = db.Column(db.String(255))
    defaultValue = db.Column(db.String(255))
    isOptional = db.Column(db.Boolean())

    def __repr__(self):
        return "<ActivatorMetadataVariable(id={self.id!r}, activatorMetadataId={self.activatorMetadataId!r})>".format(
            self=self)
Пример #16
0
class Notification(db.Model):
    __tablename__ = "notification"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True)
    isActive = db.Column(db.Boolean())
    lastUpdated = db.Column(db.String(20))
    toUserId = db.Column(db.Integer(), db.ForeignKey("eagle_db.user.id"))
    fromUserId = db.Column(db.Integer, db.ForeignKey("eagle_db.user.id"))
    importance = db.Column(db.Integer())
    message = db.Column(db.String(255))
    isRead = db.Column(db.Boolean())
    typeId = db.Column(db.Integer(),
                       db.ForeignKey("eagle_db.notificationType.id"))

    def __repr__(self):
        return "<Notification(id={self.id!r})>".format(self=self)
Пример #17
0
class Venue(db.Model):
    __tablename__ = "venue"
    id = db.Column('venue_id', db.Integer, primary_key=True)
    college = db.Column('college_id', db.Integer, primary_key=True)
    name = db.Column('venue_name', db.String())
    capacity = db.Column('capacity', db.Integer())
    rate = db.Column('rate', db.Integer)
    equipment = db.Column('equipment', db.String())
    image_file = db.Column('venue_img',
                           db.String(),
                           nullable=False,
                           default='defaultvenue.jp   g')

    def __init__(self, name, college, capacity, rate, equipment, image_file):
        self.name = name
        self.college = college
        self.capacity = capacity
        self.rate = rate
        self.equipment = equipment
        self.image_file = image_file

    def get_id(self):
        return unicode(self.id)

    def __repr__(self):
        return '{} - {}'.format(COLLEGEID.get(self.college), self.name)
class ReceiversEvents(db.Model):
    __tablename__ = 'RECEIVERS_EVENTS'
    id_receiver_event = db.Column(db.Integer(),
                                  primary_key=True,
                                  nullable=False)
    id_receiver = db.Column(db.Integer(),
                            db.ForeignKey("RECEIVERS.id_receiver"),
                            nullable=False)
    id_event = db.Column(db.Integer(),
                         db.ForeignKey("EVENTS.id_event"),
                         nullable=False)
    receiver = db.relationship('ReceiverModel',
                               backref=db.backref(
                                   'receivers_events',
                                   cascade='all, delete-orphan'))
    event = db.relationship('Events')
class Student(db.Model):
    __tablename__ = "student"
    id = db.Column(db.Integer(),
                   primary_key=True)
    name = db.Column(db.String(256), nullable=False)
    email = db.Column(db.String(256), nullable=False, unique=True)
    classes = db.relationship("Class", secondary=student_identifier)
Пример #20
0
class User(db.Model):
    __tablename__ = "users"
    id = db.Column(db.Integer, primary_key=True)
    uuid = db.Column(db.String(50), nullable=False, unique=True)
    username = db.Column(db.String(20), nullable=False, unique=True)
    password = db.Column(db.String(255), nullable=False)
    email = db.Column(db.String(255), nullable=False, unique=True)
    activity = db.Column(db.Integer(), default=0)

    @classmethod
    def find_by_name(cls, name):
        return cls.query.filter_by(username=name).first()

    @classmethod
    def find_by_email(cls, mail):
        return cls.query.filter_by(email=mail).first()

    @classmethod
    def find_by_uuid(cls, uuid):
        return cls.query.filter_by(uuid=uuid).first()

    def save_to_db(self):
        db.session.add(self)
        db.session.commit()

    def delete_from_db(self):
        db.session.delete(self)
        db.session.commit()
Пример #21
0
class Solution(db.Model):
    __tablename__ = "solution"
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(255))
    description = db.Column(db.String(255))
    businessUnit = db.Column(db.String(255))
    costCentre = db.Column(db.String(255))
    ci = db.Column(db.String(255))
    cd = db.Column(db.String(255))
    sourceControl = db.Column(db.String(255))
    environments = db.Column(db.String(255))
    active = db.Column(db.Boolean())
    favourite = db.Column(db.Boolean())
    teams = db.Column(db.Integer())
    lastUpdated = db.Column(db.String(255))

    applications = db.relationship('Application')
Пример #22
0
class Report(db.Model):
    __tablename__ = 'report'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    case_names = db.Column(db.String(128), nullable=True, comment='用例的名称集合')
    read_status = db.Column(db.String(16), nullable=True, comment='阅读状态')
    performer = db.Column(db.String(16), nullable=True, comment='执行者')
    project_id = db.Column(db.String(16), nullable=True)
    create_time = db.Column(db.DateTime(), index=True, default=datetime.now)
Пример #23
0
class Category(db.Model):
    __tablename__ = 'category'

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

    def __repr__(self):
        return self.name
Пример #24
0
class ActivatorMetadata(db.Model):
    __tablename__ = "activatorMetadata"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    activatorId = db.Column(db.Integer(),
                            db.ForeignKey("eagle_db.activator.id"))
    name = db.Column(db.String(255))
    description = db.Column(db.String(255))
    category = db.Column(db.String(255))
    typeId = db.Column(db.Integer(), db.ForeignKey("eagle_db.type.id"))
    activatorLink = db.Column(db.String(255))
    lastUpdated = db.Column(db.String(20))
    latestVersion = db.Column(db.String(30))

    def __repr__(self):
        return "<ActivatorMetadata(id={self.id!r}, name={self.name!r})>".format(
            self=self)
Пример #25
0
class CaseSet(db.Model):
    __tablename__ = 'case_set'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    num = db.Column(db.Integer(), nullable=True, comment='用例集合序号')
    name = db.Column(db.String(256), nullable=True, comment='用例集名称')
    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.id'),
                           comment='所属的项目id')
    cases = db.relationship('Case', order_by='Case.num.asc()', lazy='dynamic')
    created_time = db.Column(db.DateTime,
                             index=True,
                             default=datetime.now,
                             comment='创建时间')
    update_time = db.Column(db.DateTime,
                            index=True,
                            default=datetime.now,
                            onupdate=datetime.now)
Пример #26
0
class Solution(db.Model):
    __tablename__ = "solution"
    __table_args__ = {"schema": "eagle_db"}
    id = db.Column(db.Integer(), primary_key=True)
    isActive = db.Column(db.Boolean)
    lastUpdated = db.Column(db.String(20))
    isFavourite = db.Column(db.Boolean)
    name = db.Column(db.String(30))
    description = db.Column(db.String(255))
    businessUnitId = db.Column(db.Integer())
    costCentre = db.Column(db.String(255))
    ciId = db.Column(db.Integer())
    cdId = db.Column(db.Integer())
    sourceControlId = db.Column(db.Integer())
    teamId = db.Column(db.Integer())
    deployed = db.Column(db.Boolean())
    deploymentState = db.Column(db.String(45))
    statusId = db.Column(db.Integer())
    statusCode = db.Column(db.String(45))
    statusMessage = db.Column(db.String(255))
    taskId = db.Column(db.String(100))
    deploymentFolderId = db.Column(db.String(50))
    isSandbox = db.Column(db.Boolean)

    def __repr__(self):
        return "<Solution(id={self.id!r}, name={self.name!r})>".format(
            self=self)
Пример #27
0
class PostInstagram(db.Model):
    __tablename__ = 'posts_instagram'
    id = db.Column(db.BigInteger, primary_key=True)
    post_id = db.Column(db.BigInteger(), nullable=True, unique=True)
    user_id = db.Column(db.BigInteger(), nullable=True, unique=False)
    post_time = db.Column(db.DateTime, nullable=True)
    post_likes = db.Column(db.Integer(), nullable=True, server_default=0)
    post_comments = db.Column(db.Integer(), nullable=True, server_default=0)
    post_caption = db.Column(db.UnicodeText(), nullable=True)
    post_image = db.Column(db.UnicodeText(), nullable=True)

    IMAGES_FOLDER_PATH = app.config['IMAGES_FOLDER']

    def to_dict(self):
        row = {}
        for c in self.__table__.columns:
            row[c.name] = getattr(self, c.name)
        return row

    @staticmethod
    def add_db(raw, image=None):
        obj = PostInstagram()
        for r in raw:
            if r not in (
                    'id',
                    'post_image',
            ):
                if r in PostInstagram.__table__.columns:
                    setattr(obj, r, raw[r])

        db.session.add(obj)
        db.session.commit()
        return obj

    @staticmethod
    def create_image_path():
        pass

    @staticmethod
    def create_image_filename():
        pass

    @staticmethod
    def add_image():
        pass
Пример #28
0
class Menu(GenericModel):
    id = db.Column('menu_id', db.Integer(), primary_key=True)
    name = db.Column('menu_name', db.String(40),)
    price = db.Column('menu_price', db.Float(),default=350.0)
    href = db.relationship('Hotel',secondary=menu_hotel, backref=db.backref("menuref", lazy=True))

    @staticmethod
    def dummy_menu():
        return Menu(id=0, name='', price=0.0)
Пример #29
0
class Config(db.Model):
    __tablename__ = 'config'
    id = db.Column(db.Integer(), primary_key=True, comment='主键,自增')
    num = db.Column(db.Integer(), nullable=True, comment='配置序号')
    name = db.Column(db.String(128), comment='配置名称')
    variables = db.Column(db.String(21000), comment='配置参数')
    func_address = db.Column(db.String(128), comment='配置函数')
    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.id'),
                           comment='所属的项目id')
    created_time = db.Column(db.DateTime,
                             index=True,
                             default=datetime.now,
                             comment='创建时间')
    update_time = db.Column(db.DateTime,
                            index=True,
                            default=datetime.now,
                            onupdate=datetime.now)
class User(db.Model):
    ''' The data model'''
    # table name
    __tablename__ = 'users'
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    handle = db.Column(db.String(200), nullable=False)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}