lf5/lib/datatypes.py
2024-02-08 10:25:22 +01:00

97 lines
1.8 KiB
Python

from dataclasses import dataclass, asdict
@dataclass
class Customer:
customer_id: int
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:
order_id: int
customer: Customer
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:
ingredient_id: int
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:
supplier_id: int
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:
recipe_id: int
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 SupplierContainsIngredients:
recipe: Recipe
ingredient: Ingredient
amount: int
@dataclass
class SupplierContainsIngredients:
supplier: Supplier
ingredient: Ingredient
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
ingredient: Ingredient
quantity: int
def dict(self):
return {k: str(v) for k, v in asdict(self).items()}