Пример #1
0
class User(db.Model):
    userid=db.Column(db.Integer(),primary_key=True)
    username=db.Column(db.String(255),nullable=False)
    # email = db.Column(db.String(50),unique=True)
    pwd=db.Column(db.String(255),nullable=False)
    user_created_on=db.Column(db.DateTime(),default=datetime.utcnow)

    def __repr__(self):
        return "<{}:{}>".format(self.userid,self.username)
Пример #2
0
class Transaction(db.Model):
    trans_id = db.Column(db.Integer(), primary_key=True)
    trans_status = db.Column(db.Integer())
    trans_date = db.Column(db.DateTime(), default=datetime.utcnow)
    trans_phone = db.Column(db.String(255))
    trans_amt = db.Column(db.Integer()) 
    trans_customer = db.Column(db.String(255), nullable=False)
    trans_ref = db.Column(db.String(255))
    trans_paystackref = db.Column(db.String(255))
    trans_others = db.Column(db.Text())
    trans_email = db.Column(db.String(255), nullable=False)

    # create a Foreign Key Column
    trans_productid = db.Column(db.Integer(), db.ForeignKey('items.item_id'))
Пример #3
0
class Brand(db.Model):
    __tablename__ = 'brand'
    brand_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    brand_name = db.Column(db.String(255), nullable=False)
    product_model_id = db.Column(db.Integer(),
                                 db.ForeignKey('product.product_id'))

    #relationship table
    brands = db.relationship('Car_models',
                             secondary='brand_model',
                             backref=db.backref('members'))
Пример #4
0
class Profile(db.Model):
    __tablename__= 'userprofile'
    profile_id=db.Column(db.Integer(),primary_key=True)
    firstname=db.Column(db.String(255),nullable=False)
    lastname=db.Column(db.String(255),nullable=False)
    email=db.Column(db.String(255),nullable=False)
    surname=db.Column(db.String(255),nullable=False)
    password=db.Column(db.String(255),nullable=False)
    profile_pix =  db.Column(db.String(255),nullable=False)
    user_created_on=db.Column(db.DateTime(),default=datetime.utcnow)
    #define the relationship here
    skills = db.relationship("Skills",secondary="member_skills",backref=db.backref('members'))
Пример #5
0
class Buyer(db.Model):
    buyer_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    buyer_fname = db.Column(db.String(255), nullable=False)
    buyer_lname = db.Column(db.String(255), nullable=False)
    buyer_email = db.Column(db.String(255), nullable=False)
    buyer_address = db.Column(db.String(255), nullable=False)
    buyer_phone = db.Column(db.String(255), nullable=False)
    password = db.Column(db.String(255), nullable=False)
    user_created_on = db.Column(db.DateTime(), default=datetime.utcnow)

    def __repr__(self):
        return "<{}:{}>".format(self.buyer_id, self.buyer_fname,
                                self.buyer_lname)
Пример #6
0
class Product(db.Model):
    __tablename__ = 'product'
    product_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    product_brand = db.Column(db.String(255), nullable=False)
    product_model = db.Column(db.String(255), nullable=False)
    product_year = db.Column(db.String(4), nullable=False)
    product_condition = db.Column(db.String(255), nullable=False)
    product_fuel_type = db.Column(db.String(255), nullable=False)
    product_price = db.Column(db.Float(), nullable=False)
    product_color = db.Column(db.String(255), nullable=False)
    product_seller_id = db.Column(db.Integer(),
                                  db.ForeignKey('seller.seller_id'),
                                  nullable=False)
    product_image = db.Column(db.String(255), nullable=False)
    product_uploaded_on = db.Column(db.DateTime(), default=datetime.utcnow)

    def __repr__(self):
        return "<{}:{}>".format(self.product_id, self.product_brand,
                                self.product_price)

    #relationship table
    sell_product = db.relationship('Seller',
                                   secondary='seller_product',
                                   backref=db.backref('cars'))
Пример #7
0
class Items(db.Model):
    item_id = db.Column(db.Integer(), primary_key=True)
    item_amt = db.Column(db.Integer())
    item_name = db.Column(db.String(255), nullable=False)
    # the relationship can be used to retrieve many instances of the child class
    transactions = db.relationship('Transaction', backref='item')
Пример #8
0
class Deal(db.Model):
    deal_id=db.Column(db.Integer(),primary_key=True)
    deal_name=db.Column(db.String(255),nullable=False)
    deal_url=db.Column(db.String(255),nullable=False)
    user_created_on=db.Column(db.DateTime(),default=datetime.utcnow)
Пример #9
0
class Skills(db.Model):
    id = db.Column(db.Integer(),primary_key=True)
    skills_name = db.Column(db.String(255),nullable=False)
Пример #10
0
class Contactus(db.Model):
    __tablename__ = 'contactus'
    message_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    sender_email = db.Column(db.String(255), nullable=False)
    sender_phone = db.Column(db.String(255), nullable=False)
    message_content = db.Column(db.String(255), nullable=False)
Пример #11
0
class Car_models(db.Model):
    __tablename__ = 'car_models'
    model_id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    model_year = db.Column(db.String(4), nullable=False)
    model_name = db.Column(db.String(255), nullable=False)