Exemple #1
0
class Order(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    good_id = db.Column(db.Integer, db.ForeignKey('good.id'))
    good_name = db.Column(db.String(80), db.ForeignKey('good.name'))
    quantity = db.Column(db.Integer)
    price = db.Column(db.Float)
    username = db.Column(db.String(80), db.ForeignKey('user.username'))
    address = db.Column(db.String(80), db.ForeignKey('user.address'))
    date = db.Column(db.String(80))
    remark = db.Column(db.String(512))
    state = db.Column(db.String(20))
    gross_profit = db.Column(db.Integer)

    def __init__(self, good_id, good_name, quantity, price, username, address, date, remark, state,gross_profit):
        self.good_id = good_id
        self.good_name = good_name
        self.quantity = quantity
        self.price = price
        self.username = username
        self.address = address
        self.date= date
        self.remark = remark
        self.state = state
        self.gross_profit = gross_profit

    def __repr__(self):
        return '<warningLoad %d %s>' % (self.id, self.state)
Exemple #2
0
class Addproduct(db.Model):

    __searchable__ = ["name", "description"]

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False)
    price = db.Column(db.Numeric)
    discount = db.Column(db.Integer, default=0)
    stock = db.Column(db.Integer, nullable=False)
    colors = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)
    pub_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))

    category_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=False)
    category = db.relationship('Category', backref=db.backref('posts', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='img.jpg.png')
    image_2 = db.Column(db.String(150), nullable=False, default='img.jpg.png')
    image_3 = db.Column(db.String(150), nullable=False, default='img.jpg.png')




    def __repr__(self):
        return '<Addproduct %r>' % self.name
Exemple #3
0
class Addproduct(db.Model):
    __seachbale__ = ['name', 'desc']
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    price = db.Column(db.Numeric(10, 2), nullable=False)
    discount = db.Column(db.Integer, default=0)
    stock = db.Column(db.Integer, nullable=False)
    colors = db.Column(db.Text, nullable=False)
    desc = db.Column(db.Text, nullable=False)
    pub_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    category = db.relationship('Category',
                               backref=db.backref('categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')

    def __repr__(self):
        return '<Addproduct %r>' % self.name
Exemple #4
0
class Cart(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    total = db.Column(db.Integer)
    quantity = db.Column(db.Integer)
    product_id = db.Column(db.Integer, db.ForeignKey('products.id'))
    category_id = db.Column(db.Integer, db.ForeignKey('categories.id'))
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
Exemple #5
0
class FilterCategories(db.Model):
    """
    Which filters should show up for different category selections
    """
    id = db.Column(db.Integer, primary_key=True)
    filter_id = db.Column(db.Integer, db.ForeignKey("filters.id"))
    category_id = db.Column(db.Integer, db.ForeignKey("categories.id"))
Exemple #6
0
class addCase(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    case_type = db.Column(db.String(30), nullable = False)
    color = db.Column(db.String(30), nullable = False)
    case_material = db.Column(db.String(30), nullable = False)
    power_supply = db.Column(db.String(30), nullable = False)
    Motherboard_Compatibility = db.Column(db.String(30), nullable = False)
    External_525_Drive_Bays = db.Column(db.String(10), nullable = False)
    External_35_Drive_Bays = db.Column(db.String(10))
    External_25_Drive_Bays = db.Column(db.String(10))
    Expansion_Slots = db.Column(db.String(10))
    Front_Ports = db.Column(db.String(10))
    Fan_Options = db.Column(db.String(50))
    Radiator_Options = db.Column(db.String(30))
    Max_GPU_Length= db.Column(db.String(10))
    Max_CPU_Cooler_Height  =  db.Column(db.String(10))
    features  =  db.Column(db.String(1000))
    Dimensions_HxWxD = db.Column(db.String(10), nullable = False)
    Weight = db.Column(db.String(10), nullable = False)
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('Case_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('Case_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')
Exemple #7
0
class Addproduct(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    price = db.Column(db.Integer, nullable=False)
    discount = db.Column(db.Integer, default=None)
    stock = db.Column(db.Integer, nullable=False)
    origin = db.Column(db.Text, nullable=False)
    condition = db.Column(db.String(80), nullable=False)
    description = db.Column(db.Text, nullable=False)
    install_service = db.Column(db.String(10), nullable=False)
    colors = db.Column(db.Text, nullable=True)
    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=True)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))
    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=True)
    category = db.relationship('Category',
                               backref=db.backref('category', lazy=True))
    image_1 = db.Column(db.String(150), nullable=False, default='image.jpg')
    image_2 = db.Column(db.String(150), nullable=True, default='image.jpg')
    image_3 = db.Column(db.String(150), nullable=True, default='image.jpg')
    certificate = db.Column(db.String(150), nullable=True)

    def __repr__(self):
        return '<Addproduct %r>' % self.name
Exemple #8
0
class addCPU(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    cpu_type = db.Column(db.String(30), nullable = False)
    socket_type = db.Column(db.String(30), nullable = False)
    num_core = db.Column(db.String(30), nullable = False)
    num_threads = db.Column(db.String(30), nullable = False)
    frequency = db.Column(db.String(30), nullable = False)
    l1 = db.Column(db.String(10))
    l2 = db.Column(db.String(10))
    l3 = db.Column(db.String(10))
    Manufacturing_Tech = db.Column(db.String(5), nullable=False)
    mem_type = db.Column(db.String(10), nullable = False)
    mem_channel = db.Column(db.Integer, nullable = False)
    PCI_Revision = db.Column(db.String(10), nullable = False)
    power = db.Column(db.String(10), nullable = False)
    features = db.Column(db.String(1000))
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('CPU_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('CPU_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')
Exemple #9
0
class Addproduct(db.Model):  # Añadir producto y caracteristicas a la BBDD
    __searchable__ = ['name', 'desc']
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    price = db.Column(db.Numeric(10, 2), nullable=False)
    cost = db.Column(db.Numeric(10, 2))
    discount = db.Column(db.Integer, default=0)
    stock = db.Column(db.Integer, nullable=False)
    sells = db.Column(db.Integer, nullable=True)
    colors = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)
    pub_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))

    category_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=False)
    category = db.relationship('Category', backref=db.backref('posts', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image.jpg')

    def __repr__(self):
        return '<Post %r>' % self.name
Exemple #10
0
class addRAM(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    capacity = db.Column(db.String(30), nullable = False)
    mem_type = db.Column(db.String(30), nullable = False)
    speed = db.Column(db.String(30), nullable = False)
    voltage = db.Column(db.String(30), nullable = False)
    buff_reg = db.Column(db.String(30), nullable = False)
    heatspreader = db.Column(db.String(5), nullable = False)
    features = db.Column(db.String(1000), nullable = False)
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('RAM_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('RAM_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')


    def __repr__(self):
        return '<addRAM %r>' % self.name
Exemple #11
0
class Good(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(80))
    quantity = db.Column(db.Integer)
    content = db.Column(db.String(512))
    type_name = db.Column(db.String(80), db.ForeignKey('good_type.name'))
    purchase_price = db.Column(db.Float)
    trade_price = db.Column(db.Float)
    retail_price = db.Column(db.Float)
    good_url = db.Column(db.String(512))
    warehouse_name = db.Column(db.String(80), db.ForeignKey('warehouse.name'))
    images = db.relationship('Image', backref='good', lazy='dynamic')

    def __init__(self, name, quantity, content, type_name, purchase_price, trade_price, retail_price,  good_url, warehouse_name):
        self.name = name
        self.quantity = quantity
        self.content = content
        self.type_name = type_name
        self.purchase_price = purchase_price
        self.trade_price = trade_price
        self.retail_price = retail_price
        self.good_url = good_url
        self.warehouse_name = warehouse_name

    def __repr__(self):
        return '<Good %s %d %s>' % (self.name, self.quantity, self.content)
Exemple #12
0
class addWaterCooling(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    cooler_type = db.Column(db.String(30), nullable = False)
    Block_Compatibility = db.Column(db.String(30), nullable = False)
    Block_Dim = db.Column(db.String(30), nullable = False)
    Pump_Dim = db.Column(db.String(30), nullable = False)
    Pump_Noise = db.Column(db.String(30), nullable = False)
    Radiator_Dim = db.Column(db.String(10), nullable = False)
    Radiator_Material = db.Column(db.String(10))
    Fan_Size = db.Column(db.String(10))
    Fan_Dim = db.Column(db.String(10))
    Fan_RPM = db.Column(db.String(10))
    Fan_Air_Flow = db.Column(db.String(50))
    Fan_Noise = db.Column(db.String(30))
    Fan_Connector = db.Column(db.String(10))
    Fan_Color  =  db.Column(db.String(10))
    Input_Current = db.Column(db.String(10), nullable = False)
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('WaterCooling_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('Water_Cooling_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')

    def __repr__(self):
        return '<addWaterCooling %r>' % self.name
Exemple #13
0
class addAirCooling(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    cooler_type = db.Column(db.String(30), nullable = False)
    Fan_Size = db.Column(db.String(30), nullable = False)
    Socket_Compatibility = db.Column(db.String(100), nullable = False)
    RPM = db.Column(db.String(30), nullable = False)
    Noise_Level = db.Column(db.String(30), nullable = False)
    Power_Connector = db.Column(db.String(10), nullable = False)
    Color = db.Column(db.String(10))
    LED = db.Column(db.String(10))
    Heatsink_Material = db.Column(db.String(10))
    Fan_Dimensions = db.Column(db.String(10))
    Heatsink_Dimensions = db.Column(db.String(50))
    Weight = db.Column(db.String(30))
    features  =  db.Column(db.String(1000))
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('AirCooler_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('AirCooler_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')


    def __repr__(self):
        return '<addAirCooler %r>' % self.name
Exemple #14
0
class addHDD(db.Model):
    id = db.Column(db.Integer, primary_key = True, nullable = False)
    name = db.Column(db.String(30), nullable = False)
    model = db.Column(db.String(30), nullable = False)
    series = db.Column(db.String(30), nullable = False)
    Interface = db.Column(db.String(30), nullable = False)
    Capacity = db.Column(db.String(30), nullable = False)
    RPM = db.Column(db.String(30), nullable = False)
    Cache = db.Column(db.String(30), nullable = False)
    features = db.Column(db.String(30), nullable = False)
    Usage = db.Column(db.String(10), nullable = False)
    Form_Factor = db.Column(db.String(10))
    Height = db.Column(db.String(10))
    Width = db.Column(db.String(10))
    Length = db.Column(db.String(10))
    date_released = db.Column(db.String(20), nullable=False,default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer, db.ForeignKey('category.id'),nullable=False)
    category = db.relationship('Category',backref=db.backref('HDD_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'),nullable=False)
    brand = db.relationship('Brand',backref=db.backref('HDD_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')

    def __repr__(self):
        return '<addHDD %r>' % self.name
class Venta(db.Model):

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    precio = db.Column(db.String(80), nullable=False)
    total = db.Column(db.String(80), nullable=False)

    cliente_id = db.Column(db.Integer,
                           db.ForeignKey('cliente.id'),
                           nullable=False)
    cliente = db.relationship('Cliente',
                              backref=db.backref('cliente', lazy=True))

    vendedor_id = db.Column(db.Integer,
                            db.ForeignKey('vendedor.id'),
                            nullable=False)
    vendedor = db.relationship('Vendedor',
                               backref=db.backref('vendedor', lazy=True))

    addproduct_id = db.Column(db.Integer,
                              db.ForeignKey('addproduct.id'),
                              nullable=False)
    addproduct = db.relationship('Addproduct',
                                 backref=db.backref('addproduct', lazy=True))

    def __repr__(self):
        return '<Venta %r>' % self.name
Exemple #16
0
class CartDetails(db.Model):
    cartdetailsid = db.Column(db.Integer, primary_key=True)
    quantity = db.Column(db.Integer, nullable=False)
    cartid = db.Column(db.Integer,
                       db.ForeignKey('cart.cartid'),
                       nullable=False)
    itemid = db.Column(db.Integer,
                       db.ForeignKey('item.itemid'),
                       nullable=False)

    def __init__(self, itemid, quantity, cartid):
        # checking to see if Cart by cartid already exists
        cart = Cart.query.filter_by(cartid=cartid).first()

        # if not instantiate new Cart object
        if cart is None:
            cart = Cart()
            cartid = cart.cartid
        else:
            cartid = cart.cartid

        self.itemid = itemid
        self.quantity = quantity
        self.cartid = cartid

    def __repr__(self):
        return f"Item ID: '{self.itemid}'/n", \
               f"Quantity: '{self.quantity}'/n", \
               f"Cart ID: '{self.cartid}'/n"
class Wishlist(db.Model):
    wishlist_user_id = db.Column(
        db.Integer, db.ForeignKey('user.id'), primary_key=True)
    wishlist_item_id = db.Column(
        db.Integer, db.ForeignKey('books.book_id'), primary_key=True)

    def __repr__(self):
        return f"Wishlist('{self.wishlist_user_id}', '{self.wishlist_item_id}')"
Exemple #18
0
class ProductCategory(db.Model):
    __tablename__ = "product_categories"
    id = db.Column(db.Integer, primary_key=True)
    product_id = db.Column(db.Integer, db.ForeignKey("products.id"))
    category_id = db.Column(db.Integer, db.ForeignKey("categories.id"))

    product = db.relationship("Product",
                              backref=db.backref("product_categories"))
Exemple #19
0
class Order_detail(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    quantity = db.Column(db.Integer)
    price = db.Column(db.Integer)
    note = db.Column(db.String(100))
    status = db.Column(db.Boolean)
    order_id = db.Column(db.Integer, db.ForeignKey('orders.id'))
    product_id = db.Column(db.Integer, db.ForeignKey('products.id'))
class Purchased_items(db.Model):
    purchase_id = db.Column(db.Integer, db.ForeignKey(
        'purchases.purchase_id'), primary_key=True)
    item_id = db.Column(db.Integer, db.ForeignKey(
        'books.book_id'), primary_key=True)
    quantity = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Purchased_items('{self.purchase_id}', '{self.item_id}', '{self.quantity})"
class Reviews(db.Model):
    book_about = db.Column(db.Integer, db.ForeignKey(
        'books.book_id'), primary_key=True)
    reviewer_id = db.Column(
        db.Integer, db.ForeignKey('user.id'), primary_key=True)
    timestamp = db.Column(db.DateTime(), nullable=False)
    star_rating = db.Column(db.Integer, nullable=False)
    content = db.Column(db.String(5000), nullable=False)

    def __repr__(self):
        return f"Reviews('{self.book_about}',  '{self.reviewer_id}', '{self.timestamp}', '{self.star_rating}', '{self.content}')"
Exemple #22
0
class Product(db.Model):
    product_id = db.Column(db.Integer(), primary_key=True)
    prod_name = db.Column(db.String(255), nullable=False, unique=True)
    selling_price = db.Column(db.Integer(), nullable=False)
    cost_price = db.Column(db.Integer(), nullable=False)
    discount = db.Column(db.Integer(), nullable=False)
    stock = db.Column(db.Integer(), nullable=False)
    prod_type = db.Column(db.String(80), nullable=False)
    seller_id = db.Column(db.Integer(), db.ForeignKey('seller.id'))
    supplier_id = db.Column(db.Integer(), db.ForeignKey('supplier.id'))

    def __repr__(self):
        return "product {}".format(self.prod_name)
Exemple #23
0
class Cart(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    good_id = db.Column(db.Integer, db.ForeignKey('good.id'))
    quantity = db.Column(db.Integer)

    def __init__(self, user_id, good_id, quantity):
        self.user_id = user_id
        self.good_id = good_id
        self.quantity = quantity

    def __repr__(self):
        return '<Cart 的用户id为%d 商品id为%d 数量为%d>' % (self.user_id, self.good_id, self.quantity)
Exemple #24
0
class Specs(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    category = db.relationship('Category',
                               backref=db.backref('cat', lazy=True))
    subcategory_id = db.Column(db.Integer, db.ForeignKey('subcategories.id'))
    subcategory = db.relationship('Subcategories',
                                  backref=db.backref('subcat', lazy=True))
    name = db.Column(db.String(30), unique=True, nullable=False)

    def __repr__(self):
        return '<Specs %r>' % self.name
Exemple #25
0
class BookSold(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(200), nullable=False)
    category = db.Column(db.String(100), nullable=True)
    isbn = db.Column(db.String(50), nullable=False)
    publisher = db.Column(db.String(50), nullable=True)
    condition = db.Column(db.String(100), nullable=False)
    defects = db.Column(db.String(300), nullable=True)
    price = db.Column(db.Numeric(10, 2), nullable=False)
    author = db.Column(db.String(100), nullable=True)
    cover = db.Column(db.String(100))
    seller_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    buyer_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    posted = db.Column(db.Boolean, nullable=False, default=False)
Exemple #26
0
class Cart(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    quantity = db.Column(db.Integer)
    phone_id = db.Column(db.Integer, db.ForeignKey('phone.id'), nullable=False)

    def __repr__(self):
        return f"Cart('{self.quantity}')"
Exemple #27
0
class Addproduct(db.Model):
    __seachbale__ = ['name', 'desc']
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    model = db.Column(db.String(80), nullable=False)
    CPU_type = db.Column(db.String(80), nullable=False)
    cpu_socket = db.Column(db.String(30))
    chipset = db.Column(db.String(80), nullable=False)
    mem_slots = db.Column(db.String(80), nullable=False)
    max_mem = db.Column(db.String(80), nullable=False)
    channels = db.Column(db.String(80), nullable=False)
    PCI = db.Column(db.String(500), nullable=False)
    storage = db.Column(db.String(80), nullable=False)
    audio_chipset = db.Column(db.String(80), nullable=False)
    audio_channels = db.Column(db.String(80), nullable=False)
    LAN_chipset = db.Column(db.String(80), nullable=False)
    form_factor = db.Column(db.String(80), nullable=False)
    features = db.Column(db.String(1000), nullable=False)
    single_url = db.Column(db.String(30))
    release_date = db.Column(db.String(20),
                             nullable=False,
                             default=datetime.utcnow)
    #price = db.Column(db.Numeric(10,2), nullable=False)
    #discount = db.Column(db.Integer, default=0)
    #stock = db.Column(db.Integer, nullable=False)
    #colors = db.Column(db.Text, nullable=False)
    #discription = db.Column(db.Text, nullable=False)
    #desc = db.Column(db.Text, nullable=False)
    #pub_date = db.Column(db.DateTime, nullable=False,default=datetime.utcnow)
    #CPU_type_id = db.Column(db.Integer, db.ForeignKey('CPU_type.id'), nullable=False)
    #CPU_type = db.relationship('CPU_type', backref=db.backref('CPU_type'), lazy=True)

    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    category = db.relationship('Category',
                               backref=db.backref('categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')

    def __repr__(self):
        return '<Post %r>' % self.name
Exemple #28
0
class Addproduct(db.Model):
    __seachbale__ = ['name', 'desc']
    id = db.Column(db.Integer, primary_key=True)
    T_Title = db.Column(db.String(80), nullable=False)
    gamename = db.Column(db.String(80), nullable=False)
    Game_Mode = db.Column(db.String(80), nullable=False)
    Tournament_Type = db.Column(db.String(80), nullable=False)
    Tournament_Title = db.Column(db.String(80), nullable=False)

    Prize_Pot = db.Column(db.Numeric(10, 2), nullable=False)
    Entery_Cost = db.Column(db.Numeric(10, 2), nullable=False)
    Maximum_Participants = db.Column(db.Numeric(10), nullable=False)
    Minimum_Participants = db.Column(db.Numeric(10), nullable=False)
    Enroled_Participants = db.Column(db.Numeric(10), nullable=False)

    Platform = db.Column(db.String(80), nullable=False)
    Starting_Date = db.Column(db.String(80), nullable=False)
    Tournament_Time = db.Column(db.String(80), nullable=False)
    Game_Settings = db.Column(db.String(80), nullable=False)
    Rule_Group = db.Column(db.String(80), nullable=False)
    Number_Of_Rounds = db.Column(db.String(80), nullable=False)
    Region = db.Column(db.String(80), nullable=False)

    name = db.Column(db.String(80), nullable=False)
    price = db.Column(db.Numeric(10, 2), nullable=False)
    discount = db.Column(db.Integer, default=0)
    stock = db.Column(db.Integer, nullable=False)
    colors = db.Column(db.Text, nullable=False)
    size = db.Column(db.Text, nullable=False)
    descrip = db.Column(db.Text, nullable=False)
    pub_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)

    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    category = db.relationship('Category',
                               backref=db.backref('categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand', backref=db.backref('brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=True, default='image3.jpg')

    def __repr__(self):
        return '<Post %r>' % self.name
Exemple #29
0
class addPSU(db.Model):
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    name = db.Column(db.String(30), nullable=False)
    model = db.Column(db.String(30), nullable=False)
    series = db.Column(db.String(30), nullable=False)
    PSU_type = db.Column(db.String(30), nullable=False)
    max_power = db.Column(db.String(30), nullable=False)
    fans = db.Column(db.String(30), nullable=False)
    Main_Connector = db.Column(db.String(30), nullable=False)
    rail_12v = db.Column(db.String(30), nullable=False)
    PCI_Express_Connector = db.Column(db.String(10), nullable=False)
    SATA_Power_Connector = db.Column(db.String(10))
    SLI = db.Column(db.String(10))
    Modular = db.Column(db.String(10))
    CrossFire = db.Column(db.String(10))
    Efficiency = db.Column(db.String(50))
    Energy_Efficient = db.Column(db.String(30))
    Input_Voltage = db.Column(db.String(10))
    Input_Frequency_Range = db.Column(db.String(10))
    Input_Current = db.Column(db.String(10), nullable=False)
    Output = db.Column(db.String(30), nullable=False)
    MTBF = db.Column(db.String(30), nullable=False)
    Dimensions = db.Column(db.String(30), nullable=False)
    Max_PSU_Length = db.Column(db.String(30), nullable=False)
    features = db.Column(db.String(1000))
    connectors = db.Column(db.String(100))
    Weight = db.Column(db.String(10), nullable=False)
    date_released = db.Column(db.String(20),
                              nullable=False,
                              default=datetime.utcnow)
    single_url = db.Column(db.String(30))
    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    category = db.relationship('Category',
                               backref=db.backref('PSU_categories', lazy=True))

    brand_id = db.Column(db.Integer, db.ForeignKey('brand.id'), nullable=False)
    brand = db.relationship('Brand',
                            backref=db.backref('PSU_brands', lazy=True))

    image_1 = db.Column(db.String(150), nullable=False, default='image1.jpg')
    image_2 = db.Column(db.String(150), nullable=False, default='image2.jpg')
    image_3 = db.Column(db.String(150), nullable=False, default='image3.jpg')

    def __repr__(self):
        return '<addPSU %r>' % self.name
Exemple #30
0
class Specsvalues(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    product_id = db.Column(db.Integer, nullable=False)
    product_id = db.Column(db.Integer,
                           db.ForeignKey('addproduct.id'),
                           nullable=False)
    category_id = db.Column(db.Integer,
                            db.ForeignKey('category.id'),
                            nullable=False)
    subcategory_id = db.Column(db.Integer, db.ForeignKey('subcategories.id'))
    spec_id = db.Column(db.Integer, db.ForeignKey('specs.id'), nullable=False)
    specs = db.relationship('Specs', backref=db.backref('specs', lazy=True))
    value = db.Column(db.String(80), unique=False, nullable=False)
    db.UniqueConstraint('product_id', 'spec_id', name='prod_spec')

    def __repr__(self):
        return '<Specs %r>' % self.value