2024-02-06 17:39:32 +01:00
|
|
|
from dataclasses import dataclass, asdict
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-05 10:26:18 +01:00
|
|
|
@dataclass
|
2024-02-06 17:39:32 +01:00
|
|
|
class Customer:
|
2024-02-08 10:50:19 +01:00
|
|
|
id: str
|
2024-02-06 17:39:32 +01:00
|
|
|
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
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:39:32 +01:00
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-05 10:26:18 +01:00
|
|
|
@dataclass
|
2024-02-06 17:39:32 +01:00
|
|
|
class Order:
|
2024-02-08 10:50:19 +01:00
|
|
|
id: str
|
2024-02-08 11:03:25 +01:00
|
|
|
customer_id: Customer.id
|
2024-02-06 17:39:32 +01:00
|
|
|
invoice_amount: int
|
|
|
|
order_date: str # Assuming timestamp as a string for simplicity
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:44:57 +01:00
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-05 10:26:18 +01:00
|
|
|
@dataclass
|
2024-02-06 17:39:32 +01:00
|
|
|
class Ingredient:
|
2024-02-08 10:50:19 +01:00
|
|
|
id: str
|
2024-02-06 17:39:32 +01:00
|
|
|
designation: str
|
|
|
|
stock: int
|
|
|
|
net_price: int
|
|
|
|
unit: str
|
|
|
|
carbohydrates: int
|
|
|
|
calories: int
|
|
|
|
protein: int
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:44:57 +01:00
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-05 10:26:18 +01:00
|
|
|
@dataclass
|
2024-02-06 17:39:32 +01:00
|
|
|
class Supplier:
|
2024-02-08 10:50:19 +01:00
|
|
|
id: str
|
2024-02-06 17:39:32 +01:00
|
|
|
city: str
|
|
|
|
street: str
|
|
|
|
email: str
|
|
|
|
phone: str
|
|
|
|
supplier_name: str
|
|
|
|
house_number: str
|
|
|
|
postal_code: int
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:44:57 +01:00
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
2024-02-08 10:25:22 +01:00
|
|
|
@dataclass
|
|
|
|
class Recipe:
|
2024-02-08 10:50:19 +01:00
|
|
|
id: str
|
2024-02-08 10:25:22 +01:00
|
|
|
preperation_time: int
|
|
|
|
name: str
|
|
|
|
description: str
|
|
|
|
instructions: str
|
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
|
|
|
@dataclass
|
2024-02-08 10:50:19 +01:00
|
|
|
class RecipeContainsIngredients:
|
|
|
|
recipe: Recipe.id
|
|
|
|
ingredient: Ingredient.id
|
2024-02-08 10:25:22 +01:00
|
|
|
amount: int
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-05 10:26:18 +01:00
|
|
|
@dataclass
|
2024-02-06 17:39:32 +01:00
|
|
|
class SupplierContainsIngredients:
|
2024-02-08 10:50:19 +01:00
|
|
|
supplier: Supplier.id
|
|
|
|
ingredient: Ingredient.id
|
2024-02-06 17:39:32 +01:00
|
|
|
delivery_cost: int
|
|
|
|
delivery_time: int
|
2024-02-05 10:26:18 +01:00
|
|
|
|
2024-02-06 17:44:57 +01:00
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|
2024-02-06 17:43:34 +01:00
|
|
|
|
2024-02-06 17:39:32 +01:00
|
|
|
@dataclass
|
|
|
|
class OrderContainsIngredients:
|
2024-02-08 10:50:19 +01:00
|
|
|
order: Order.id
|
|
|
|
ingredient: Ingredient.id
|
2024-02-06 17:39:32 +01:00
|
|
|
quantity: int
|
2024-02-06 17:44:57 +01:00
|
|
|
|
|
|
|
def dict(self):
|
|
|
|
return {k: str(v) for k, v in asdict(self).items()}
|
|
|
|
|