Пример #1
0
class Gender(db.Model):
    __table_args__ = {'extend_existing': True}
    genderid = db.Column(db.Integer, primary_key=True)
    gender_name = db.Column(db.String(30), nullable=False)

    def __repr__(self):
        return f"Gender('{self.genderid}', '{self.gender_name}')"
Пример #2
0
class ProductGender(db.Model):
    __table_args__ = {'extend_existing': True}
    genderid = db.Column(db.Integer, db.ForeignKey('gender.genderid'), nullable=False, primary_key=True)
    productid = db.Column(db.Integer, db.ForeignKey('product.productid'), nullable=False, primary_key=True)
    created_on = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    def __repr__(self):
        return f"Product('{self.genderid}', '{self.productid}')"
Пример #3
0
class Category(db.Model):
    __table_args__ = {'extend_existing': True}
    categoryid = db.Column(db.Integer, primary_key=True)
    category_name = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    def __repr__(self):
        return f"Category('{self.categoryid}', '{self.category_name}')"
Пример #4
0
class Cart(db.Model):
    __table_args__ = {'extend_existing': True}
    userid = db.Column(db.Integer, db.ForeignKey('user.userid'), nullable=False, primary_key=True)
    productid = db.Column(db.Integer, db.ForeignKey('product.productid'), nullable=False, primary_key=True)
    sizeid = db.Column(db.Integer, db.ForeignKey('size.sizeid'), nullable=False)
    quantity = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Cart('{self.userid}', '{self.productid}, '{self.sizeid}, '{self.quantity}')"
Пример #5
0
class Size(db.Model):
    __table_args__ = {'extend_existing': True}
    sizeid = db.Column(db.Integer, primary_key=True)
    size_name = db.Column(db.String(20), nullable=False)
    productid = db.Column(db.Integer, db.ForeignKey('product.productid'), nullable=False)
    quantity = db.Column(db.Integer)

    def __repr__(self):
        return f"Size('{self.sizeid}','{self.size_name}','{self.productid}', '{self.quantity}')"
Пример #6
0
class Refund(db.Model):
    __table_args__ = {'extend_existing': True}
    refundid = db.Column(db.Integer, primary_key=True)
    ordproductid = db.Column(db.Integer, db.ForeignKey('ordered_product.ordproductid'), nullable=False)
    quantity = db.Column(db.Integer, nullable=False)
    created_on = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    def __repr__(self):
        return f"Refund('{self.ordproductid}', '{self.quantity}')"
Пример #7
0
class Order(db.Model):
    __table_args__ = {'extend_existing': True}
    orderid = db.Column(db.Integer, primary_key=True)
    order_date = db.Column(db.DateTime, nullable=False)
    total_price = db.Column(db.DECIMAL, nullable=False)
    userid = db.Column(db.Integer, db.ForeignKey('user.userid'), nullable=False)


    def __repr__(self):
        return f"Order('{self.orderid}', '{self.order_date}','{self.total_price}','{self.userid}'')"
Пример #8
0
class OrderedProduct(db.Model):
    __table_args__ = {'extend_existing': True}
    ordproductid = db.Column(db.Integer, primary_key=True)
    orderid = db.Column(db.Integer,db.ForeignKey('order.orderid'), nullable=False)
    productid = db.Column(db.Integer,db.ForeignKey('product.productid'))
    sizeid = db.Column(db.Integer, db.ForeignKey('size.sizeid'))
    quantity = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Order('{self.ordproductid}', '{self.orderid}','{self.productid}', '{self.sizeid},'{self.quantity}')"
Пример #9
0
class User(db.Model):
    __table_args__ = {'extend_existing': True}
    userid = db.Column(db.Integer, primary_key=True)
    fname = db.Column(db.String(20), nullable=False)
    lname = db.Column(db.String(20), nullable=False)
    username = db.Column(db.String(20), nullable=False)
    password = db.Column(db.String(60), nullable=False)
    address = db.Column(db.String(20), unique=False, nullable=False)
    email = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(8), nullable=False)
    image_file = db.Column(db.String(20), nullable=False, default='default.jpg')
    usertype = db.Column(db.String(20), nullable=False, default='customer')

    def __repr__(self):
        return f"User('{self.fname}', '{self.lname}'), '{self.username}', '{self.password}', " \
               f"'{self.email}','{self.phone}', '{self.usertype}')"
Пример #10
0
class SaleTransaction(db.Model):
    __table_args__ = {'extend_existing': True}
    transactionid = db.Column(db.Integer, primary_key=True)
    orderid = db.Column(db.Integer,db.ForeignKey('order.orderid'), nullable=False)
    transaction_date = db.Column(db.DateTime,nullable=False)
    amount = db.Column(db.DECIMAL, nullable=False)
    cc_number=db.Column(db.String(50), nullable=False)
    cc_type = db.Column(db.String(50), nullable=False)
    full_name = db.Column(db.String(50))
    address = db.Column(db.String(100))
    response = db.Column(db.String(50))


    def __repr__(self):
        return f"Order('{self.transactionid}', '{self.orderid}','{self.transactiondate}','{self.amount}', '{self.cc_number}','{self.cc_type}','{self.response}')"
Пример #11
0
class Product(db.Model):
    __table_args__ = {'extend_existing': True}
    productid = db.Column(db.Integer, primary_key=True)
    product_name = db.Column(db.String(100), nullable=False)
    description = db.Column(db.String(100), nullable=False)
    image = db.Column(db.String(100), nullable=False)
    image2 = db.Column(db.String(100), nullable=False)
    regular_price = db.Column(db.DECIMAL)
    discounted_price = db.Column(db.DECIMAL)

    def __repr__(self):
        return f"Product('{self.productid}','{self.product_name}','{self.description}', '{self.image}', '{self.regular_price}', '{self.discounted_price}')"