diff --git a/app/models/__init__.py b/app/models/__init__.py index 210c8d3..a7d7aa6 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -11,8 +11,7 @@ # ... from .database import db -from .location import Location from .order import Order from .orderitem import OrderItem -from .product import Product +from .orderitemchoice import OrderItemChoice from .user import User diff --git a/app/models/location.py b/app/models/location.py deleted file mode 100644 index 15ad76c..0000000 --- a/app/models/location.py +++ /dev/null @@ -1,26 +0,0 @@ -"Script for everything Location related in the database" -import typing - -from models import db - - -class Location(db.Model): - "Class used for configuring the Location model in the database" - id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(120), nullable=False) - address = db.Column(db.String(254)) - website = db.Column(db.String(120)) - telephone = db.Column(db.String(20), nullable=True) - products = db.relationship("Product", backref="location", lazy="dynamic") - orders = db.relationship("Order", backref="location", lazy="dynamic") - - def configure(self, name: str, address: str, - telephone: typing.Optional[str], website: str) -> None: - "Configure the Location" - self.name = name - self.address = address - self.website = website - self.telephone = telephone - - def __repr__(self) -> str: - return "%s" % (self.name) diff --git a/app/models/product.py b/app/models/product.py deleted file mode 100644 index d02c469..0000000 --- a/app/models/product.py +++ /dev/null @@ -1,25 +0,0 @@ -"Script for everything Product related in the database" -from models import db - -from .location import Location - - -class Product(db.Model): - "Class used for configuring the Product model in the database" - id = db.Column(db.Integer, primary_key=True) - location_id = db.Column(db.Integer, db.ForeignKey("location.id")) - name = db.Column(db.String(120), nullable=False) - price = db.Column(db.Integer, nullable=False) - orderItems = db.relationship("OrderItem", - backref="product", lazy="dynamic") - - def configure(self, location: Location, name: str, price: int) -> None: - "Configure the Product" - # pylint: disable=W0201 - self.location = location - self.name = name - self.price = price - - def __repr__(self) -> str: - return "%s (€%d)from %s" % (self.name, self.price / 100, - self.location or "None",)