Beispiel #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)
    count = db.Column(db.Integer, nullable=False, default=0)
    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)
    buyer = db.relationship('Buyers',
                            backref=backref("buyers", uselist=False),
                            lazy=True)
    seller = db.relationship('Sellers',
                             backref=backref("seller", uselist=False),
                             lazy=True)

    def __repr__(self):
        return (f'{self.vec_id},{self.buyer_id},{self.seller_id}')
Beispiel #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}')
Beispiel #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}')
Beispiel #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}')
Beispiel #5
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)
Beispiel #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}')