._.
This commit is contained in:
parent
38de7e2058
commit
6af9af3221
11
app/core/entities/accessory.py
Normal file
11
app/core/entities/accessory.py
Normal file
@ -0,0 +1,11 @@
|
||||
class AccessoryEntity:
|
||||
def __init__(self, accessory_id: int, name: str, width: float, height: float, length: float, weight: float):
|
||||
self.id = accessory_id
|
||||
self.name = name
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.length = length
|
||||
self.weight = weight
|
||||
|
||||
def __repr__(self):
|
||||
return f"<AccessoryEntity(id={self.id}, name={self.name}, width={self.width}, height={self.height}, length={self.length}, weight={self.weight})>"
|
||||
12
app/core/entities/delivery.py
Normal file
12
app/core/entities/delivery.py
Normal file
@ -0,0 +1,12 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class DeliveryEntity:
|
||||
def __init__(self, delivery_id: Optional[int], count: int, storage_accessories_id: int, step_id: int):
|
||||
self.id = delivery_id
|
||||
self.count = count
|
||||
self.storage_accessories_id = storage_accessories_id
|
||||
self.step_id = step_id
|
||||
|
||||
def __repr__(self):
|
||||
return f"<DeliveryEntity(id={self.id}, count={self.count}, storage_accessories_id={self.storage_accessories_id}, step_id={self.step_id})>"
|
||||
14
app/core/entities/order.py
Normal file
14
app/core/entities/order.py
Normal file
@ -0,0 +1,14 @@
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class OrderEntity:
|
||||
def __init__(self, order_id: Optional[int], order_datetime: datetime, user_id: int, status_id: int):
|
||||
self.id = order_id
|
||||
self.order_datetime = order_datetime
|
||||
self.user_id = user_id
|
||||
self.status_id = status_id
|
||||
|
||||
def __repr__(self):
|
||||
return (f"<OrderEntity(id={self.id}, order_datetime={self.order_datetime}, "
|
||||
f"user_id={self.user_id}, status_id={self.status_id})>")
|
||||
10
app/core/entities/role.py
Normal file
10
app/core/entities/role.py
Normal file
@ -0,0 +1,10 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class RoleEntity:
|
||||
def __init__(self, role_id: Optional[int], name: str):
|
||||
self.id = role_id
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
return f"<RoleEntity(id={self.id}, name={self.name})>"
|
||||
10
app/core/entities/status.py
Normal file
10
app/core/entities/status.py
Normal file
@ -0,0 +1,10 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class StatusEntity:
|
||||
def __init__(self, status_id: Optional[int], name: str):
|
||||
self.id = status_id
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
return f"<StatusEntity(id={self.id}, name={self.name})>"
|
||||
17
app/core/entities/step.py
Normal file
17
app/core/entities/step.py
Normal file
@ -0,0 +1,17 @@
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class StepEntity:
|
||||
def __init__(self, step_id: Optional[int], start_deadline: datetime, finish_deadline: datetime, order_id: Optional[int],
|
||||
status_id: Optional[int]):
|
||||
self.id = step_id
|
||||
self.start_deadline = start_deadline
|
||||
self.finish_deadline = finish_deadline
|
||||
self.order_id = order_id
|
||||
self.status_id = status_id
|
||||
|
||||
def __repr__(self):
|
||||
return (f"<StepEntity(id={self.id}, start_deadline={self.start_deadline}, "
|
||||
f"finish_deadline={self.finish_deadline}, order_id={self.order_id}, "
|
||||
f"status_id={self.status_id})>")
|
||||
21
app/core/entities/storage.py
Normal file
21
app/core/entities/storage.py
Normal file
@ -0,0 +1,21 @@
|
||||
from typing import Optional
|
||||
from typing import List
|
||||
|
||||
|
||||
class StorageEntity:
|
||||
def __init__(self,
|
||||
storage_id: Optional[int],
|
||||
name: str,
|
||||
x_coordinate: float,
|
||||
y_coordinate: float,
|
||||
storage_accessories: Optional[List[int]] = None):
|
||||
self.id = storage_id
|
||||
self.name = name
|
||||
self.x_coordinate = x_coordinate
|
||||
self.y_coordinate = y_coordinate
|
||||
self.storage_accessories = storage_accessories if storage_accessories is not None else []
|
||||
|
||||
def __repr__(self):
|
||||
return (f"<StorageEntity(id={self.id}, name={self.name}, "
|
||||
f"x_coordinate={self.x_coordinate}, y_coordinate={self.y_coordinate}, "
|
||||
f"storage_accessories={self.storage_accessories})>")
|
||||
21
app/core/entities/storage_accessories.py
Normal file
21
app/core/entities/storage_accessories.py
Normal file
@ -0,0 +1,21 @@
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class StorageAccessoriesEntity:
|
||||
def __init__(self,
|
||||
storage_accessories_id: Optional[int],
|
||||
current_count: int,
|
||||
change_datetime: Optional[datetime],
|
||||
storage_id: Optional[int],
|
||||
accessory_id: Optional[int]):
|
||||
self.id = storage_accessories_id
|
||||
self.current_count = current_count
|
||||
self.change_datetime = change_datetime
|
||||
self.storage_id = storage_id
|
||||
self.accessory_id = accessory_id
|
||||
|
||||
def __repr__(self):
|
||||
return (f"<StorageAccessoriesEntity(id={self.id}, current_count={self.current_count}, "
|
||||
f"change_datetime={self.change_datetime}, storage_id={self.storage_id}, "
|
||||
f"accessory_id={self.accessory_id})>")
|
||||
24
app/core/entities/user.py
Normal file
24
app/core/entities/user.py
Normal file
@ -0,0 +1,24 @@
|
||||
from typing import Optional, List
|
||||
|
||||
|
||||
class UserEntity:
|
||||
def __init__(self,
|
||||
user_id: Optional[int],
|
||||
first_name: str,
|
||||
last_name: str,
|
||||
login: str,
|
||||
password: str,
|
||||
role_id: Optional[int] = None,
|
||||
orders: Optional[List[int]] = None):
|
||||
self.id = user_id
|
||||
self.first_name = first_name
|
||||
self.last_name = last_name
|
||||
self.login = login
|
||||
self.password = password
|
||||
self.role_id = role_id
|
||||
self.orders = orders if orders is not None else []
|
||||
|
||||
def __repr__(self):
|
||||
return (f"<UserEntity(id={self.id}, first_name={self.first_name}, "
|
||||
f"last_name={self.last_name}, login={self.login}, "
|
||||
f"role_id={self.role_id}, orders={self.orders})>")
|
||||
@ -11,4 +11,4 @@ class Status(Base):
|
||||
name = Column(VARCHAR(100), nullable=False)
|
||||
|
||||
orders = relationship('Order', back_populates='status')
|
||||
steps = relationship('Step', back_populates='status')
|
||||
steps = relationship('Step', back_populates='status')
|
||||
|
||||
@ -12,4 +12,4 @@ class Storage(Base):
|
||||
x_coordinate = Column(Float, nullable=False)
|
||||
y_coordinate = Column(Float, nullable=False)
|
||||
|
||||
storage_accessories = relationship('StorageAccessories', back_populates='storage')
|
||||
storage_accessories = relationship('StorageAccessories', back_populates='storage')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user