move datatypes
This commit is contained in:
parent
166c3ff202
commit
90577ea86e
3 changed files with 37 additions and 1 deletions
81
lib/datatypes.py
Normal file
81
lib/datatypes.py
Normal file
|
@ -0,0 +1,81 @@
|
|||
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 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()}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue