97 lines
1.8 KiB
Python
97 lines
1.8 KiB
Python
from dataclasses import dataclass, asdict
|
|
|
|
|
|
@dataclass
|
|
class Customer:
|
|
id: str
|
|
first_name: str
|
|
last_name: str
|
|
street: str
|
|
birth_date: str # Assuming timestamp as a string for simplicity
|
|
house_number: str
|
|
postal_code: int
|
|
email: str
|
|
phone: int
|
|
city: str
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
|
@dataclass
|
|
class Order:
|
|
id: str
|
|
customer_id: Customer.id
|
|
invoice_amount: int
|
|
order_date: str # Assuming timestamp as a string for simplicity
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
|
@dataclass
|
|
class Ingredient:
|
|
id: str
|
|
designation: str
|
|
stock: int
|
|
net_price: int
|
|
unit: str
|
|
carbohydrates: int
|
|
calories: int
|
|
protein: int
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
|
@dataclass
|
|
class Supplier:
|
|
id: str
|
|
city: str
|
|
street: str
|
|
email: str
|
|
phone: str
|
|
supplier_name: str
|
|
house_number: str
|
|
postal_code: int
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
@dataclass
|
|
class Recipe:
|
|
id: str
|
|
preperation_time: int
|
|
name: str
|
|
description: str
|
|
instructions: str
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
@dataclass
|
|
class RecipeContainsIngredients:
|
|
recipe: Recipe.id
|
|
ingredient: Ingredient.id
|
|
amount: int
|
|
|
|
@dataclass
|
|
class SupplierContainsIngredients:
|
|
supplier: Supplier.id
|
|
ingredient: Ingredient.id
|
|
delivery_cost: int
|
|
delivery_time: int
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
|
@dataclass
|
|
class OrderContainsIngredients:
|
|
order: Order.id
|
|
ingredient: Ingredient.id
|
|
quantity: int
|
|
|
|
def dict(self):
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|