Esempio n. 1
0
class Customer(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    promo_points = db.Column(db.Integer,
                             default=0,
                             unique=False,
                             nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    address_id = db.Column(db.Integer,
                           db.ForeignKey('address.id'),
                           nullable=True)
    order = db.relationship('Order', backref='customer', lazy=True)
Esempio n. 2
0
class Order(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    # 0 = Preparing
    # 1 = Delivering
    # 2 = Cancelled
    # 3 = Finished
    status = db.Column(db.Integer, nullable=False, default=0)
    customer_id = db.Column(db.Integer,
                            db.ForeignKey('customer.id'),
                            nullable=False)
Esempio n. 3
0
class Stock(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    quantity = db.Column(db.Float, nullable=False, default=0)
    ingredient_id = db.Column(db.Integer,
                              db.ForeignKey('ingredient.id'),
                              nullable=False)
Esempio n. 4
0
class Employee(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    registration = db.Column(db.String(20), unique=True, nullable=False)
    admin = db.Column(db.Boolean, default=False, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
Esempio n. 5
0
    stock = db.relationship('Stock', backref='ingredient', lazy=True)


class Stock(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    quantity = db.Column(db.Float, nullable=False, default=0)
    ingredient_id = db.Column(db.Integer,
                              db.ForeignKey('ingredient.id'),
                              nullable=False)


products_ingredients = db.Table(
    'products_ingredients',
    db.Column('product_id',
              db.Integer,
              db.ForeignKey('product.id'),
              primary_key=True),
    db.Column('ingredient_id',
              db.Integer,
              db.ForeignKey('ingredient.id'),
              primary_key=True),
    db.Column('quantity', db.Float, nullable=False, default=1))

order_products = db.Table(
    'order_products',
    db.Column('product_id',
              db.Integer,
              db.ForeignKey('product.id'),
              primary_key=True),
    db.Column('order_id',
              db.Integer,