Esempio n. 1
0
class Category(db.Model):
    __tablename__ = "category"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode, unique=True)

    def __repr__(self):
        return self.email
Esempio n. 2
0
class Address(db.Model):
    __tablename__ = "address"
    id = db.Column("id", db.Integer, primary_key=True)
    zip = db.Column("zip", db.Unicode)
    country = db.Column("country", db.Unicode)
    address = db.Column("address", db.Unicode)
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.id"))

    user = db.relationship("User", foreign_keys=user_id)
Esempio n. 3
0
class User(db.Model):
    __tablename__ = "user"
    id = db.Column("id", db.Integer, primary_key=True)
    email = db.Column("email", db.Unicode, unique=True, nullable=False)
    passwd = db.Column("passwd", db.Unicode)
    admin = db.Column("admin", db.Boolean)

    def __repr__(self):
        return self.email
Esempio n. 4
0
class Address(db.Model):
    __tablename__ = "address"
    id = db.Column('id', db.Integer, primary_key=True)
    zip = db.Column('zip', db.Unicode)
    country = db.Column('country', db.Unicode)
    address = db.Column('address', db.Unicode)
    user_id = db.Column('user_id', db.Integer, db.ForeignKey('user.id'))

    user = db.relationship('User', foreign_keys=user_id)
Esempio n. 5
0
class OrderItems(db.Model):
    __tablename__ = "order_items"
    order_id = db.Column('order_id', db.Integer, db.ForeignKey('order.id'))
    items_id = db.Column('items_id', db.Integer, db.ForeignKey('items.id'))
    quant = db.Column('quant', db.Integer)
    id = db.Column('id', db.Integer, primary_key=True)

    order = db.relationship('Order', foreign_keys=order_id)
    items = db.relationship('Items', foreign_keys=items_id)
Esempio n. 6
0
class OrderItems(db.Model):
    __tablename__ = "order_items"
    id = db.Column("id", db.Integer, primary_key=True)
    amount = db.Column("amount", db.Integer)
    items_id = db.Column("items_id", db.Integer, db.ForeignKey("items.id"))
    order_id = db.Column("order_id", db.Integer, db.ForeignKey("order.id"))

    items = db.relationship("Items", foreign_keys=items_id)
    order = db.relationship("Order", foreign_keys=order_id)
Esempio n. 7
0
class User(db.Model):
    __tablename__ = "user"
    id = db.Column('id', db.Integer, primary_key=True)
    email = db.Column('email', db.Unicode, unique=True)
    passwd = db.Column('passwd', db.Unicode)
    admin = db.Column('admin', db.Boolean)

    def __repr__(self):
        return self.email
Esempio n. 8
0
class Store(db.Model):
    __tablename__ = "store"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode)
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.id"))
    category_id = db.Column("category_id", db.Integer,
                            db.ForeignKey("category.id"))
    active = db.Column("active", db.Boolean)
    user = db.relationship("User", foreign_keys=user_id)
    category = db.relationship("Category", foreign_keys=category_id)
Esempio n. 9
0
class OrderItems(db.Model):
    __tablename__ = "order_items"
    order_id = db.Column("order_id", db.Integer,
                         db.ForeignKey("order.created_at"))
    items_id = db.Column("items_id", db.Integer, db.ForeignKey("items.name"))
    quant = db.Column("quant", db.Integer)
    id = db.Column("id", db.Integer, primary_key=True)

    order = db.relationship("Order", foreign_keys=order_id)
    items = db.relationship("Items", foreign_keys=items_id)
Esempio n. 10
0
class Store(db.Model):
    __tablename__ = "store"
    id = db.Column('id', db.Integer, primary_key=True)
    name = db.Column('name', db.Unicode)
    user_id = db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
    category_id = db.Column('category_id', db.Integer,
                            db.ForeignKey('category.id'))
    active = db.Column("active", db.Boolean)

    user = db.relationship('User', foreign_keys=user_id)
    category = db.relationship('Category', foreign_keys=category_id)
Esempio n. 11
0
class Store(db.Model):
    __tablename__ = "store"
    id = db.Column("id", db.Integer, primary_key=True)
    name_store = db.Column("name_store", db.String, unique=True)
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.email"))
    category_id = db.Column("category_id", db.Integer,
                            db.ForeignKey("category.name"))
    active = db.Column("active", db.Boolean, default=False)

    user = db.relationship("User", foreign_keys=user_id)
    category = db.relationship("Category", foreign_keys=category_id)

    def __repr__(self):
        return self.name_store
Esempio n. 12
0
class User(db.Model, UserMixin):
    __tablename__ = "user"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode)
    email = db.Column("email", db.Unicode, unique=True)
    password = db.Column("password", db.Unicode)
    admin = db.Column("admin", db.Boolean)

    def get_id(self):
        return str(self.id)

    def auth(self, email: str, password: str) -> bool:
        user = self.query.filter_by(email=email).first()
        if not user:
            return False
        if not check_password_hash(user.password, password):
            return False
        return user

    def __repr__(self):
        return self.email
Esempio n. 13
0
class Checkout(db.Model):
    __tablename__ = "checkout"
    id = db.Column("id", db.Integer, primary_key=True)
    payment = db.Column("payment", db.Unicode)
    total = db.Column("total", db.Numeric)
    created_at = db.Column("created_at", db.DateTime)
    completed = db.Column("completed", db.Boolean)
    order_id = db.Column("order_id", db.Integer, db.ForeignKey("order.id"))

    order = db.relationship("Order", foreign_keys=order_id)
Esempio n. 14
0
class Items(db.Model):
    __tablename__ = "items"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode)
    image = db.Column("image", db.LargeBinary)
    price = db.Column("price", db.Numeric)
    available = db.Column("available", db.Boolean)
    store_id = db.Column("store_id", db.Integer, db.ForeignKey("store.id"))

    store = db.relationship("Store", foreign_keys=store_id)
Esempio n. 15
0
class Checkout(db.Model):
    __tablename__ = "checkout"
    id = db.Column('id', db.Integer, primary_key=True)
    payment = db.Column('payment', db.Unicode)
    total = db.Column('total', db.Numeric)
    created_at = db.Column('created_at', db.DateTime)
    completed = db.Column('completed', db.Boolean)
    order_id = db.Column('order_id', db.Integer, db.ForeignKey('order.id'))

    order = db.relationship('Order', foreign_keys=order_id)
Esempio n. 16
0
class Items(db.Model):
    __tablename__ = "items"
    id = db.Column('id', db.Integer, primary_key=True)
    name = db.Column('name', db.Unicode)
    image = db.Column('image', db.Unicode)
    price = db.Column('price', db.Numeric)
    store_id = db.Column('store_id', db.Integer, db.ForeignKey('store.id'))
    available = db.Column('available', db.Boolean)

    store = db.relationship('Store', foreign_keys=store_id)
Esempio n. 17
0
class Address(db.Model):
    __tablename__ = "address"
    id = db.Column("id", db.Integer, primary_key=True)
    zip_code = db.Column("zip_code", db.Unicode)
    state = db.Column("country", db.Unicode)
    city = db.Column("city", db.Unicode)
    address = db.Column("address", db.Unicode)
    number_house = db.Column("number_house", db.Unicode)
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.email"))

    user = db.relationship("User", foreign_keys=user_id)

    def __repr__(self):
        return self.zip_code
Esempio n. 18
0
class Order(db.Model):
    __tablename__ = "order"
    id = db.Column("id", db.Integer, primary_key=True)
    created_at = db.Column("created_at", db.DateTime)
    completed = db.Column("completed", db.Boolean)
    address_id = db.Column("address_id", db.Integer, db.ForeignKey("address.id"))
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.id"))
    store_id = db.Column("store_id", db.Integer, db.ForeignKey("store.id"))

    address = db.relationship("Address", foreign_keys=address_id)
    user = db.relationship("User", foreign_keys=user_id)
    store = db.relationship("Store", foreign_keys=store_id)
Esempio n. 19
0
class Items(db.Model):
    __tablename__ = "items"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode)
    quantity = db.Column("quantity", db.Integer)
    price = db.Column("price", db.Float(asdecimal=True,
                                        decimal_return_scale=2))
    description = db.Column("description", db.Text(length=None))
    store_id = db.Column("store_id", db.Integer,
                         db.ForeignKey("store.name_store"))
    available = db.Column("available", db.Boolean)

    store = db.relationship("Store", foreign_keys=store_id)

    def __repr__(self):
        return self.name
Esempio n. 20
0
class Order(db.Model):
    __tablename__ = "order"
    id = db.Column('id', db.Integer, primary_key=True)
    created_at = db.Column('created_at', db.DateTime)
    completed = db.Column('completed', db.Boolean)
    user_id = db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
    store_id = db.Column('store_id', db.Integer, db.ForeignKey('store.id'))
    address_id = db.Column('address_id', db.Integer,
                           db.ForeignKey('address.id'))

    user = db.relationship('User', foreign_keys=user_id)
    store = db.relationship('Store', foreign_keys=store_id)
    address = db.relationship('Address', foreign_keys=address_id)
Esempio n. 21
0
class Order(db.Model):
    __tablename__ = "order"
    id = db.Column("id", db.Integer, primary_key=True)
    created_at = db.Column("created_at", db.DateTime)
    completed = db.Column("completed", db.Boolean)
    user_id = db.Column("user_id", db.Integer, db.ForeignKey("user.email"))
    store_id = db.Column("store_id", db.Integer,
                         db.ForeignKey("store.name_store"))
    address_id = db.Column("address_id", db.Integer,
                           db.ForeignKey("address.zip_code"))

    user = db.relationship("User", foreign_keys=user_id)
    store = db.relationship("Store", foreign_keys=store_id)
    address = db.relationship("Address", foreign_keys=address_id)

    def __repr__(self):
        return f'{self.user_id} {self.created_at}'
Esempio n. 22
0
class User(db.Model):
    __tablename__ = "user"
    id = db.Column("id", db.Integer, primary_key=True)
    email = db.Column("email", db.Unicode, unique=True)
    passwd = db.Column("passwd", db.Unicode)
    admin = db.Column("admin", db.Boolean)
Esempio n. 23
0
class Category(db.Model):
    __tablename__ = "category"
    id = db.Column("id", db.Integer, primary_key=True)
    name = db.Column("name", db.Unicode, unique=True)
    on_menu = db.Column("on_menu", db.Boolean)