Update models
This commit is contained in:
parent
d564808417
commit
ecb0550fdd
3 changed files with 28 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
This is just a description of the database schema. It's not generated automatically, nor is it used
|
||||
to automatically generate anything.
|
||||
to automatically generate anything. For the latest version, check the files in app/models/
|
||||
|
||||
|
||||
user
|
||||
|
@ -9,28 +9,30 @@ user
|
|||
|
||||
order
|
||||
id
|
||||
location_id HLDS identifier
|
||||
location_name this allows historical orders to keep the same location name
|
||||
create_at
|
||||
close_at
|
||||
creator_id
|
||||
courier_id
|
||||
location_id HLDS identifier
|
||||
location_name this allows historical orders to keep the same location name
|
||||
starttime
|
||||
stoptime
|
||||
public
|
||||
|
||||
order_item
|
||||
id
|
||||
order_id
|
||||
item_id HLDS identifier
|
||||
user_id
|
||||
user_name for users who are not logged in
|
||||
price this allows historical orders to keep their correct price
|
||||
product_name
|
||||
commit_hash Git commit hash to identify HLDS data version
|
||||
user_name for users who are not logged in
|
||||
dish_id HLDS identifier
|
||||
dish_name ) this allows historical orders to keep their correct name and price
|
||||
price )
|
||||
paid
|
||||
comment
|
||||
hlds_data_version Git commit hash to identify HLDS data version
|
||||
|
||||
order_item_choice
|
||||
id
|
||||
choice_id HLDS identifier
|
||||
kind single_choice/multi_choice
|
||||
choice_id HLDS identifier
|
||||
kind single_choice/multi_choice
|
||||
order_item
|
||||
name
|
||||
description
|
||||
value just a textual description of the chosen values
|
||||
value just a textual description of the chosen values
|
||||
|
|
|
@ -11,10 +11,12 @@ class Order(db.Model):
|
|||
"Class used for configuring the Order model in the database"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
courier_id = db.Column(db.Integer, nullable=True)
|
||||
location_id = db.Column(db.Integer, db.ForeignKey("location.id"))
|
||||
location_id = db.Column(db.String(64))
|
||||
location_name = db.Column(db.String(128))
|
||||
starttime = db.Column(db.DateTime)
|
||||
stoptime = db.Column(db.DateTime)
|
||||
public = db.Column(db.Boolean, default=True)
|
||||
|
||||
items = db.relationship("OrderItem", backref="order", lazy="dynamic")
|
||||
|
||||
def configure(self, courier: User, location: Location,
|
||||
|
|
|
@ -10,16 +10,17 @@ from .user import User
|
|||
class OrderItem(db.Model):
|
||||
"Class used for configuring the OrderItem model in the database"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey("user.id"))
|
||||
order_id = db.Column(db.Integer, db.ForeignKey("order.id"), nullable=False)
|
||||
product_id = db.Column(
|
||||
db.Integer, db.ForeignKey("product.id"), nullable=True
|
||||
) # TODO make false after init migration
|
||||
user_id = db.Column(db.Integer, db.ForeignKey("user.id"))
|
||||
user_name = db.Column(db.String(120))
|
||||
dish_id = db.Column(db.String(120), nullable=True)
|
||||
dish_name = db.Column(db.String(120), nullable=True)
|
||||
price = db.Column(db.Integer, nullable=False)
|
||||
paid = db.Column(
|
||||
db.Boolean, default=False, nullable=True
|
||||
) # TODO make false after init migration
|
||||
extra = db.Column(db.String(254), nullable=True)
|
||||
name = db.Column(db.String(120))
|
||||
db.Boolean, default=False, nullable=False
|
||||
)
|
||||
comment = db.Column(db.String(254), nullable=True)
|
||||
hlds_data_version = db.Column(db.String(40), nullable=True)
|
||||
|
||||
def configure(self, user: User, order: Order, product: Product) -> None:
|
||||
"Configure the OrderItem"
|
||||
|
|
Loading…
Reference in a new issue