._.
This commit is contained in:
parent
f3e1ccb7c4
commit
18d37db6da
@ -1,13 +1,14 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class AccessoryEntity(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
width: float
|
||||
height: float
|
||||
length: float
|
||||
weight: float
|
||||
volume: Optional[float] = None
|
||||
weight: Optional[float] = None
|
||||
period: Optional[int] = None
|
||||
city_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
11
app/core/entities/city.py
Normal file
11
app/core/entities/city.py
Normal file
@ -0,0 +1,11 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class CityEntity(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
federal_district_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
15
app/core/entities/delivery_order.py
Normal file
15
app/core/entities/delivery_order.py
Normal file
@ -0,0 +1,15 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class DeliveryOrderEntity(BaseModel):
|
||||
id: int
|
||||
order_datetime: datetime
|
||||
count_robots: int
|
||||
deadline: datetime
|
||||
truck_id: Optional[int] = None
|
||||
total_order_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
13
app/core/entities/dilevery_accessiory.py
Normal file
13
app/core/entities/dilevery_accessiory.py
Normal file
@ -0,0 +1,13 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class DeliveryAccessoryEntity(BaseModel):
|
||||
id: int
|
||||
queue: int
|
||||
count: int
|
||||
accessory_id: Optional[int] = None
|
||||
delivery_order_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
11
app/core/entities/federal_district.py
Normal file
11
app/core/entities/federal_district.py
Normal file
@ -0,0 +1,11 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class FederalDistrictEntity(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
cities: Optional[List[int]] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
@ -1,13 +0,0 @@
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class OrderEntity(BaseModel):
|
||||
id: Optional[int] = None
|
||||
order_datetime: datetime
|
||||
user_id: int
|
||||
status_id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
@ -1,10 +1,11 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class RoleEntity(BaseModel):
|
||||
id: Optional[int] = None
|
||||
id: int
|
||||
name: str
|
||||
users: Optional[List[int]] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class StatusEntity(BaseModel):
|
||||
id: Optional[int] = None
|
||||
id: int
|
||||
name: str
|
||||
orders: Optional[List[int]] = None
|
||||
steps: Optional[List[int]] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
16
app/core/entities/total_order.py
Normal file
16
app/core/entities/total_order.py
Normal file
@ -0,0 +1,16 @@
|
||||
from pydantic import BaseModel
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class TotalOrderEntity(BaseModel):
|
||||
id: int
|
||||
order_datetime: datetime
|
||||
count_robots: int
|
||||
deadline: Optional[datetime] = None
|
||||
user_id: int
|
||||
status_id: int
|
||||
delivery_orders: Optional[List[int]] = None #
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
13
app/core/entities/truck.py
Normal file
13
app/core/entities/truck.py
Normal file
@ -0,0 +1,13 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List
|
||||
|
||||
|
||||
class TruckEntity(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
capacity: float
|
||||
volume: float
|
||||
delivery_orders: List[int] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
@ -1,15 +1,15 @@
|
||||
from typing import Optional, List
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class UserEntity(BaseModel):
|
||||
id: Optional[int] = None
|
||||
id: int
|
||||
first_name: str
|
||||
last_name: str
|
||||
login: str
|
||||
password: str
|
||||
role_id: Optional[int] = None
|
||||
orders: List[int] = []
|
||||
total_orders: List[int] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Column, Integer, VARCHAR, Float, DateTime, ForeignKey
|
||||
from sqlalchemy import Column, Integer, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.infrastructure.database.models import Base
|
||||
|
||||
@ -17,4 +17,4 @@ class User(Base):
|
||||
|
||||
role = relationship('Role', back_populates='users')
|
||||
|
||||
orders = relationship('Order', back_populates='user')
|
||||
total_orders = relationship('TotalOrder', back_populates='user')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user