Exemplo n.º 1
0
class Client(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    firstName = db.Column(db.String(40))
    lastName = db.Column(db.String(40))
    email = db.Column(db.Integer, db.ForeignKey('email.id'), nullable=False)
    notes = db.relationship('Note',
                            secondary=clientNote,
                            backref=db.backref('client', lazy='dynamic'))
    tickets = db.relationship('Ticket',
                              secondary=clientTicket,
                              backref=db.backref('client', lazy='dynamic'))
    phones = db.relationship('Phone',
                             secondary=clientPhone,
                             backref=db.backref('client', lazy='dynamic'))
Exemplo n.º 2
0
class Phone(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    number = db.Column(db.String(10), unique=True, nullable=False)
    phoneType = db.relationship('PhoneType',
                                backref='phone',
                                lazy=True,
                                uselist=False)
Exemplo n.º 3
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    password = db.Column(db.String(64), nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.png')
    email = db.Column(db.String(120), unique=True, nullable=False)
    fName = db.Column(db.String(40), nullable=False)
    lName = db.Column(db.String(40), nullable=False)
    isActive = db.Column(db.Boolean, nullable=False)
    group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
    group = db.relationship('Group',
                            backref=db.backref('users',
                                               uselist=True,
                                               cascade='delete,all'))

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
Exemplo n.º 4
0
class Group(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(25), unique=True, nullable=False)
    desc = db.Column(db.Text, nullable=False)

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

    def __repr__(self):
        return f"Group('{self.id}', '{self.name}', '{self.desc}')"
Exemplo n.º 5
0
class Organization(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(40), nullable=False, unique=True)
    isActive = db.Column(db.Boolean, nullable=False)
    address = db.Column(db.Integer,
                        db.ForeignKey('organization.id'),
                        nullable=False)
    phone = db.relationship('Phone',
                            secondary=orgPhone,
                            backref='organization',
                            lazy='dynamic')
Exemplo n.º 6
0
class Address(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    street_1 = db.Column(db.String(100), nullable=False)
    street_2 = db.Column(db.String(100))
    city = db.Column(db.String(100), nullable=False)
    county = db.Column(db.String(100))
    state = db.Column(db.String(100), nullable=False)
    country = db.Column(db.String(100), nullable=False)
    zip = db.Column(db.Integer, nullable=False)
Exemplo n.º 7
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(25), unique=True, nullable=False)
    password = db.Column(db.String(64), nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.png')
    email = db.Column(db.String(120), unique=True, nullable=False)
    fName = db.Column(db.String(40), nullable=False)
    lName = db.Column(db.String(40), nullable=False)
    isActive = db.Column(db.Boolean)
    #themes    = db.relationship('Theme', backref='user', lazy=True, uselist=False)
    groups = db.relationship('Group',
                             secondary=userGroup,
                             backref=db.backref('user', lazy='dynamic'))
Exemplo n.º 8
0
class Note(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(60), nullable=False)
    content = db.Column(db.Text, nullable=False)
Exemplo n.º 9
0
class Group(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(25), unique=True, nullable=False)
Exemplo n.º 10
0
class Email(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    address = db.Column(db.String(64), unique=True, nullable=False)
    clientID = db.Column(db.Integer,
                         db.ForeignKey('client.id'),
                         nullable=False)
Exemplo n.º 11
0
class Status(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(25), unique=True, nullable=False)