fix datatypes, erd
This commit is contained in:
parent
60e1e72bff
commit
8092510098
2 changed files with 79 additions and 61 deletions
|
@ -3,7 +3,7 @@ from dataclasses import dataclass, asdict
|
|||
|
||||
@dataclass
|
||||
class Customer:
|
||||
customer_id: int
|
||||
id: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
street: str
|
||||
|
@ -20,8 +20,8 @@ class Customer:
|
|||
|
||||
@dataclass
|
||||
class Order:
|
||||
order_id: int
|
||||
customer: Customer
|
||||
id: str
|
||||
customer: Customer.id
|
||||
invoice_amount: int
|
||||
order_date: str # Assuming timestamp as a string for simplicity
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Order:
|
|||
|
||||
@dataclass
|
||||
class Ingredient:
|
||||
ingredient_id: int
|
||||
id: str
|
||||
designation: str
|
||||
stock: int
|
||||
net_price: int
|
||||
|
@ -46,7 +46,7 @@ class Ingredient:
|
|||
|
||||
@dataclass
|
||||
class Supplier:
|
||||
supplier_id: int
|
||||
id: str
|
||||
city: str
|
||||
street: str
|
||||
email: str
|
||||
|
@ -60,7 +60,7 @@ class Supplier:
|
|||
|
||||
@dataclass
|
||||
class Recipe:
|
||||
recipe_id: int
|
||||
id: str
|
||||
preperation_time: int
|
||||
name: str
|
||||
description: str
|
||||
|
@ -70,15 +70,15 @@ class Recipe:
|
|||
return {k: str(v) for k, v in asdict(self).items()}
|
||||
|
||||
@dataclass
|
||||
class SupplierContainsIngredients:
|
||||
recipe: Recipe
|
||||
ingredient: Ingredient
|
||||
class RecipeContainsIngredients:
|
||||
recipe: Recipe.id
|
||||
ingredient: Ingredient.id
|
||||
amount: int
|
||||
|
||||
@dataclass
|
||||
class SupplierContainsIngredients:
|
||||
supplier: Supplier
|
||||
ingredient: Ingredient
|
||||
supplier: Supplier.id
|
||||
ingredient: Ingredient.id
|
||||
delivery_cost: int
|
||||
delivery_time: int
|
||||
|
||||
|
@ -88,8 +88,8 @@ class SupplierContainsIngredients:
|
|||
|
||||
@dataclass
|
||||
class OrderContainsIngredients:
|
||||
order: Order
|
||||
ingredient: Ingredient
|
||||
order: Order.id
|
||||
ingredient: Ingredient.id
|
||||
quantity: int
|
||||
|
||||
def dict(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue