2022-04-19 22:03:00 +02:00
|
|
|
"Script for everything OrderItemChoice related in the database"
|
2020-01-26 03:04:17 +01:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
from .database import db
|
|
|
|
from .orderitem import OrderItem
|
|
|
|
|
|
|
|
|
|
|
|
class OrderItemChoice(db.Model):
|
2022-04-19 22:03:00 +02:00
|
|
|
"Class used for configuring the OrderItemChoice model in the database"
|
2020-01-26 03:04:17 +01:00
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
choice_id = db.Column(db.String(64), nullable=True)
|
2020-07-17 11:40:15 +02:00
|
|
|
order_item_id = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("order_item.id"), nullable=False
|
|
|
|
)
|
2020-01-26 03:04:17 +01:00
|
|
|
kind = db.Column(db.String(1), nullable=False)
|
|
|
|
name = db.Column(db.String(120), nullable=True)
|
|
|
|
value = db.Column(db.String(120), nullable=True)
|
|
|
|
|
|
|
|
# pylint: disable=attribute-defined-outside-init
|
|
|
|
def configure(self, order: OrderItem) -> None:
|
2022-04-19 22:03:00 +02:00
|
|
|
"Set the orderitem"
|
2020-01-26 03:04:17 +01:00
|
|
|
self.order = order
|
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
2022-04-19 22:03:00 +02:00
|
|
|
return f"{self.name}: {self.value}"
|