Esempio n. 1
0
class Order(Base):
    __tablename__ = 'order'
    id = db.Column(db.Integer, index=True, primary_key=True)

    items = db.relationship('OrderItem')
    user_id = db.Column(
        db.Integer, db.ForeignKey('user.id'), index=True, nullable=False)
    user = db.relationship('User')
Esempio n. 2
0
class Product(Base):
    __tablename__ = 'product'

    id = db.Column(db.Integer, index=True, primary_key=True)
    name = db.Column(db.String(255), index=True, nullable=False)
    price = db.Column(db.Float(precision=2), index=True, nullable=False)
    image_name = db.Column(db.String(255), index=True)
    description = db.Column(db.String(1000))
    composition = db.relationship('Composition')
Esempio n. 3
0
class OrderItem(Base):
    __tablename__ = 'order_item'

    id = db.Column(db.Integer, index=True, primary_key=True)
    number = db.Column(db.Integer, index=True, nullable=False)

    order_id = db.Column(
        db.Integer, db.ForeignKey('order.id'), index=True, nullable=False)
    product_id = db.Column(
        db.Integer, db.ForeignKey('product.id'), index=True, nullable=False)
    product = db.relationship('Product')
Esempio n. 4
0
class Composition(Base):
    __tablename__ = 'composition'

    id = db.Column(db.Integer, index=True, primary_key=True)
    percentage = db.Column(db.Integer, index=True, nullable=False)

    product_id = db.Column(
        db.Integer, db.ForeignKey('product.id'), index=True, nullable=False)
    fiber_id = db.Column(
        db.Integer, db.ForeignKey('fiber.id'), index=True, nullable=False)
    fiber = db.relationship('Fiber')
Esempio n. 5
0
class User(Base):
    __tablename__ = 'user'
    id = db.Column(db.Integer, index=True, primary_key=True)
    admin = db.Column(db.Boolean, index=True)
    username = db.Column(db.String(1000))
    password = db.Column(db.String(1000))
Esempio n. 6
0
class Fiber(Base):
    __tablename__ = 'fiber'

    id = db.Column(db.Integer, index=True, primary_key=True)
    name = db.Column(db.String(255), index=True, nullable=False, unique=True)
    description = db.Column(db.String(1000))