Пример #1
0
class Vehicle(db.Model):
    vec_id = db.Column(db.Integer, primary_key=True)
    Image_Front = db.Column(db.String(120),
                            default='default.jpg',
                            nullable=False)
    Image_Back = db.Column(db.String(120),
                           default='default.jpg',
                           nullable=False)
    Image_rside = db.Column(db.String(120),
                            default='default.jpg',
                            nullable=False)
    Image_lside = db.Column(db.String(120),
                            default='default.jpg',
                            nullable=False)

    Company = db.Column(db.String(100), nullable=False)
    Model = db.Column(db.String(100), nullable=False)
    Colour = db.Column(db.String(100), nullable=False)
    check = db.relationship('Check', backref='check', lazy=True)
    buyer_id = db.Column(db.Integer, db.ForeignKey('buyers.buy_id'))
    seller_id = db.Column(db.Integer,
                          db.ForeignKey('sellers.sel_id'),
                          nullable=False)

    def __repr__(self):
        return (f'{self.vec_id},{self.buyer_id},{self.seller_id}')
Пример #2
0
class Sellers(db.Model):
    sel_id = db.Column(db.Integer, primary_key=True)
    User_i = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    vec_seller = db.relationship('Vehicle', backref='vec_seller', lazy=True)

    def __repr__(self):
        return (f'{self.User_i},{self.sel_id}')
Пример #3
0
class Buyers(db.Model):
    buy_id = db.Column(db.Integer, primary_key=True)
    User_i = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    vec_buyer = db.relationship('Vehicle', backref='vec_buyer', lazy=True)
    b_user = db.relationship('User',
                             backref=backref("b_user", uselist=False),
                             lazy=True)

    def __repr__(self):
        return (f'{self.User_id},{self.buy_id}')
Пример #4
0
class Check(db.Model):
    ckeck_id = db.Column(db.Integer, primary_key=True)
    cvec_id = db.Column(db.Integer,
                        db.ForeignKey('vehicle.vec_id'),
                        nullable=False)
    mil = db.Column(db.String(120), default='default.jpg', nullable=False)
    vin = db.Column(db.String(120), default='default.jpg', nullable=False)
    fin = db.Column(db.String(120), default='default.jpg', nullable=False)

    def __repr__(self):
        return (f'{self.ckeck_id},{self.cvec_id}')
Пример #5
0
class User(db.Model):
    id=db.Column(db.Integer,primary_key=True)
    public_id=db.Column(db.Text())
    name=db.Column(db.Text(),nullable=False)
    accredited=db.Column(db.Boolean(),nullable=False)
    password=db.Column(db.Text(),nullable=False)
    samples = db.relationship('Sample',
      backref= 'lab',
      lazy=True
    )

    def __repr__(self):
        return 'user {}'.format(self.name)
Пример #6
0
class Check(db.Model):
    ckeck_id = db.Column(db.Integer, primary_key=True)
    cvec_id = db.Column(db.Integer,
                        db.ForeignKey('vehicle.vec_id'),
                        nullable=False)
    mil = db.Column(db.String(120), default='default.pdf', nullable=False)
    vin = db.Column(db.String(120), default='default.pdf', nullable=False)
    fin = db.Column(db.String(120), default='default.pdf', nullable=False)
    vec_rel = db.relationship('Vehicle',
                              backref=backref("vec_rel", uselist=False),
                              lazy=True)

    def __repr__(self):
        return (f'{self.ckeck_id},{self.cvec_id}')
Пример #7
0
class Sample(db.Model):
    id=db.Column(db.Integer,primary_key=True)
    patient_name=db.Column(db.Text(),nullable=False)
    Sample_type=db.Column(db.Text(),nullable=False)
    med_record_no=db.Column(db.Text(),nullable=False)
    patient_location=db.Column(db.Text(),nullable=False)
    collection_time=db.Column(db.DateTime(),default=datetime.utcnow)
    ordering_lab=db.Column(db.Text(),nullable=False)
    accepted=db.Column(db.Boolean())
    lab_id=db.Column(db.Integer(),db.ForeignKey('user.id'))


    def __repr__(self):
        return 'sample of %s {}  at %d'.format(self.patient_name,self.collection_time)
Пример #8
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    Username = db.Column(db.String(100), unique=True, nullable=False)
    Email = db.Column(db.String(120), unique=True, nullable=False)
    Password = db.Column(db.Text, nullable=False)
    count = db.Column(db.Integer, nullable=False, default=0)
    phone = db.Column(db.String(13), nullable=False, unique=True)
    Address = db.Column(db.String(100), nullable=False)
    buyer = db.relationship('Buyers', backref='buyer', lazy=True)
    seller = db.relationship('Sellers', backref='seller', lazy=True)

    def __repr__(self):
        return (f'{self.Username},{self.Email},{self.Password}')
Пример #9
0
class activity(db.Model):
    act_id = db.Column(db.Integer, primary_key=True)
    at = db.Column(db.String(150), nullable=False)
    action = db.Column(db.String(50), nullable=False)
    time = db.Column(db.DateTime, default=datetime.now, nullable=False)