validations updated
This commit is contained in:
@@ -58,7 +58,7 @@ class OccupantToken(BaseModel):
|
||||
responsible_employee_id: Optional[int] = None
|
||||
responsible_employee_uuid: Optional[str] = None
|
||||
|
||||
reachable_event_list_id: Optional[list] = None # ID list of reachable modules
|
||||
reachable_event_codes: Optional[list[str]] = None # ID list of reachable modules
|
||||
# reachable_event_list_uu_id: Optional[list] = None # UUID list of reachable modules
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class CompanyToken(BaseModel): # Required Company Object for an employee
|
||||
|
||||
bulk_duties_id: int
|
||||
|
||||
reachable_event_list_id: Optional[list] = None # ID list of reachable modules
|
||||
reachable_event_codes: Optional[list[str]] = None # ID list of reachable modules
|
||||
# reachable_event_list_uu_id: Optional[list] = None # UUID list of reachable modules
|
||||
|
||||
|
||||
|
||||
68
ApiValidations/Custom/validation_response.py
Normal file
68
ApiValidations/Custom/validation_response.py
Normal file
@@ -0,0 +1,68 @@
|
||||
import json
|
||||
from typing import Any, ClassVar, TypeVar, Dict, Tuple, List
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ErrorHandlers import HTTPExceptionApi
|
||||
from ApiLibrary.common.line_number import get_line_number_for_error
|
||||
from ApiValidations.Request.base_validations import CrudRecords, PydanticBaseModel
|
||||
|
||||
|
||||
class ValidationParser:
|
||||
|
||||
def __init__(self, active_validation: BaseModel):
|
||||
self.core_validation = active_validation
|
||||
self.annotations = active_validation.model_json_schema()
|
||||
self.annotations = json.loads(json.dumps(self.annotations))
|
||||
self.schema = {}
|
||||
self.parse()
|
||||
|
||||
def parse(self):
|
||||
from ApiValidations.Request.base_validations import CrudRecords, PydanticBaseModel
|
||||
|
||||
properties = dict(self.annotations.get("properties")).items()
|
||||
total_class_annotations = {
|
||||
**self.core_validation.__annotations__,
|
||||
**PydanticBaseModel.__annotations__,
|
||||
**CrudRecords.__annotations__,
|
||||
}
|
||||
for key, value in properties:
|
||||
default, required, possible_types = dict(value).get("default", None), True, []
|
||||
if dict(value).get("anyOf", None):
|
||||
for _ in dict(value).get("anyOf") or []:
|
||||
type_opt = json.loads(json.dumps(_))
|
||||
if not type_opt.get("type") == "null":
|
||||
possible_types.append(type_opt.get("type"))
|
||||
field_type = possible_types[0]
|
||||
required = False
|
||||
else:
|
||||
field_type = dict(value).get("type", "string")
|
||||
attribute_of_class = total_class_annotations.get(key, None)
|
||||
aoc = str(attribute_of_class) if attribute_of_class else None
|
||||
if attribute_of_class:
|
||||
if aoc in ("<class 'str'>", "typing.Optional[str]"):
|
||||
field_type, required = "string", aoc == "<class 'str'>"
|
||||
elif aoc in ("<class 'int'>", "typing.Optional[int]"):
|
||||
field_type, required = "integer", aoc == "<class 'int'>"
|
||||
elif aoc in ("<class 'bool'>", "typing.Optional[bool]"):
|
||||
field_type, required = "boolean", aoc == "<class 'bool'>"
|
||||
elif aoc in ("<class 'float'>", "typing.Optional[float]"):
|
||||
field_type, required = "float", aoc == "<class 'float'>"
|
||||
elif aoc in ("<class 'datetime.datetime'>", "typing.Optional[datetime.datetime]"):
|
||||
field_type, required = "datetime", aoc == "<class 'datetime.datetime'>"
|
||||
self.schema[key] = {
|
||||
"type": field_type, "required": required, "default": default
|
||||
}
|
||||
|
||||
|
||||
class ValidationModel:
|
||||
|
||||
def __init__(self, response_model: BaseModel, language_model, language_models):
|
||||
self.response_model = response_model
|
||||
self.validation = None
|
||||
self.headers = language_model
|
||||
self.language_models = language_models
|
||||
self.get_validation()
|
||||
|
||||
def get_validation(self) -> Tuple:
|
||||
self.headers = self.language_models
|
||||
self.validation = ValidationParser(self.response_model).schema
|
||||
@@ -61,12 +61,21 @@ class OccupantSelection(BaseModel, OccupantSelectionValidation):
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"build_living_space_uu_id": "987fcdeb-51a2-43e7-9876-543210987654"
|
||||
}
|
||||
"example": [
|
||||
{"company_uu_id": "abcdef12-3456-7890-abcd-ef1234567890"},
|
||||
{"build_living_space_uu_id": "987fcdeb-51a2-43e7-9876-543210987654"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def is_employee(self):
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_occupant(self):
|
||||
return True
|
||||
|
||||
|
||||
class EmployeeSelectionValidation:
|
||||
tr = {"company_uu_id": "Şirket UU ID"}
|
||||
@@ -78,10 +87,21 @@ class EmployeeSelection(BaseModel, EmployeeSelectionValidation):
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {"company_uu_id": "abcdef12-3456-7890-abcd-ef1234567890"}
|
||||
"example": [
|
||||
{"company_uu_id": "abcdef12-3456-7890-abcd-ef1234567890"},
|
||||
{"build_living_space_uu_id": "987fcdeb-51a2-43e7-9876-543210987654"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def is_employee(self):
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_occupant(self):
|
||||
return False
|
||||
|
||||
|
||||
class LoginValidation:
|
||||
tr = {
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
from .account_responses import AccountRecordResponse
|
||||
from .address_responses import ListAddressResponse
|
||||
from .auth_responses import (
|
||||
AuthenticationLoginResponse,
|
||||
AuthenticationRefreshResponse,
|
||||
AuthenticationUserInfoResponse
|
||||
)
|
||||
|
||||
__all__ = ["AccountRecordResponse"]
|
||||
|
||||
__all__ = [
|
||||
"AccountRecordResponse",
|
||||
"ListAddressResponse",
|
||||
"AuthenticationLoginResponse",
|
||||
"AuthenticationRefreshResponse",
|
||||
"AuthenticationUserInfoResponse",
|
||||
]
|
||||
|
||||
20
ApiValidations/Response/address_responses.py
Normal file
20
ApiValidations/Response/address_responses.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ListAddressResponse(BaseModel):
|
||||
build_number: Optional[str] = None
|
||||
door_number: Optional[str] = None
|
||||
floor_number: Optional[str] = None
|
||||
comment_address: Optional[str] = None
|
||||
letter_address: Optional[str] = None
|
||||
short_letter_address: Optional[str] = None
|
||||
latitude: Optional[float] = None
|
||||
longitude: Optional[float] = None
|
||||
street_uu_id: Optional[str] = None
|
||||
|
||||
|
||||
class AddressPostCodeResponse:
|
||||
street_id: Optional[int] = None
|
||||
street_uu_id: Optional[str] = None
|
||||
postcode: Optional[str] = None
|
||||
36
ApiValidations/Response/auth_responses.py
Normal file
36
ApiValidations/Response/auth_responses.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List, Dict, Any
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class AuthenticationLoginResponse(BaseModel):
|
||||
"""Response model for authentication login endpoint"""
|
||||
|
||||
token: str
|
||||
refresh_token: str
|
||||
token_type: str
|
||||
expires_in: int
|
||||
user_info: Dict[str, Any]
|
||||
|
||||
|
||||
class AuthenticationRefreshResponse(BaseModel):
|
||||
"""Response model for authentication refresh endpoint"""
|
||||
|
||||
token: str
|
||||
refresh_token: str
|
||||
token_type: str
|
||||
expires_in: int
|
||||
|
||||
|
||||
class AuthenticationUserInfoResponse(BaseModel):
|
||||
"""Response model for authentication user info endpoint"""
|
||||
|
||||
user_id: int
|
||||
username: str
|
||||
email: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
105
ApiValidations/Response/base_responses.py
Normal file
105
ApiValidations/Response/base_responses.py
Normal file
@@ -0,0 +1,105 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, TypeVar, Generic, List
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class BaseResponse(BaseModel):
|
||||
"""Base response model that all response models inherit from.
|
||||
|
||||
This model provides common fields that are present in all database records,
|
||||
including tracking information (created/updated timestamps), user actions
|
||||
(created by, updated by, confirmed by), and record status (active, deleted).
|
||||
|
||||
Attributes:
|
||||
uu_id (str): Unique identifier for the record, typically a UUID
|
||||
created_at (datetime): Timestamp when the record was created
|
||||
updated_at (Optional[datetime]): Timestamp when the record was last updated
|
||||
created_by (Optional[str]): Username or identifier of the user who created the record
|
||||
updated_by (Optional[str]): Username or identifier of the user who last updated the record
|
||||
confirmed_by (Optional[str]): Username or identifier of the user who confirmed the record
|
||||
is_confirmed (Optional[bool]): Whether the record has been confirmed/approved
|
||||
active (Optional[bool]): Whether the record is currently active
|
||||
deleted (Optional[bool]): Whether the record has been marked as deleted
|
||||
expiry_starts (Optional[datetime]): When the record becomes valid/active
|
||||
expiry_ends (Optional[datetime]): When the record expires/becomes inactive
|
||||
is_notification_send (Optional[bool]): Whether notifications have been sent for this record
|
||||
is_email_send (Optional[bool]): Whether emails have been sent for this record
|
||||
"""
|
||||
|
||||
uu_id: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
created_by: Optional[str]
|
||||
updated_by: Optional[str]
|
||||
confirmed_by: Optional[str]
|
||||
is_confirmed: Optional[bool] = None
|
||||
active: Optional[bool] = True
|
||||
deleted: Optional[bool] = False
|
||||
expiry_starts: Optional[datetime]
|
||||
expiry_ends: Optional[datetime]
|
||||
is_notification_send: Optional[bool] = False
|
||||
is_email_send: Optional[bool] = False
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration for the base response model.
|
||||
|
||||
Attributes:
|
||||
from_attributes (bool): Enables ORM mode for SQLAlchemy integration
|
||||
"""
|
||||
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class CrudCollection(BaseModel, Generic[T]):
|
||||
"""Base collection model for paginated responses.
|
||||
|
||||
This model is used to return collections of items with pagination information.
|
||||
It is generic over the type of items in the collection, allowing it to be
|
||||
used with any response model.
|
||||
|
||||
Type Parameters:
|
||||
T: The type of items in the collection
|
||||
|
||||
Attributes:
|
||||
page (int): Current page number, 1-based indexing
|
||||
size (int): Number of items per page
|
||||
total (int): Total number of items across all pages
|
||||
order_field (str): Field used for sorting the collection
|
||||
order_type (str): Sort direction ('asc' or 'desc')
|
||||
items (List[T]): List of items in the current page
|
||||
|
||||
Example:
|
||||
```python
|
||||
class UserResponse(BaseResponse):
|
||||
name: str
|
||||
email: str
|
||||
|
||||
users = CrudCollection[UserResponse](
|
||||
page=1,
|
||||
size=10,
|
||||
total=100,
|
||||
order_field="name",
|
||||
order_type="asc",
|
||||
items=[...]
|
||||
)
|
||||
```
|
||||
"""
|
||||
|
||||
page: int = 1
|
||||
size: int = 10
|
||||
total: int = 0
|
||||
order_field: str = "id"
|
||||
order_type: str = "asc"
|
||||
items: List[T] = []
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration for the collection model.
|
||||
|
||||
Attributes:
|
||||
from_attributes (bool): Enables ORM mode for SQLAlchemy integration
|
||||
"""
|
||||
|
||||
from_attributes = True
|
||||
90
ApiValidations/Response/budget_responses.py
Normal file
90
ApiValidations/Response/budget_responses.py
Normal file
@@ -0,0 +1,90 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
from decimal import Decimal
|
||||
from .base_responses import BaseResponse, CrudCollection
|
||||
|
||||
|
||||
class DecisionBookBudgetBooksResponse(BaseResponse):
|
||||
"""Response model for decision book budget books"""
|
||||
|
||||
country: str
|
||||
branch_type: int = 0
|
||||
company_id: int
|
||||
company_uu_id: str
|
||||
branch_id: Optional[int]
|
||||
branch_uu_id: Optional[str]
|
||||
build_decision_book_id: int
|
||||
build_decision_book_uu_id: Optional[str]
|
||||
|
||||
|
||||
class DecisionBookBudgetBooksCollection(
|
||||
CrudCollection[DecisionBookBudgetBooksResponse]
|
||||
):
|
||||
"""Collection of decision book budget books"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class DecisionBookBudgetCodesResponse(BaseResponse):
|
||||
"""Response model for decision book budget codes"""
|
||||
|
||||
budget_code: str
|
||||
comment_line: str
|
||||
budget_type: str
|
||||
budget_code_seperator: str = "."
|
||||
system_id: int = 0
|
||||
locked: bool = False
|
||||
company_id: Optional[int]
|
||||
company_uu_id: str
|
||||
customer_id: Optional[int]
|
||||
customer_uu_id: str
|
||||
|
||||
|
||||
class DecisionBookBudgetCodesCollection(
|
||||
CrudCollection[DecisionBookBudgetCodesResponse]
|
||||
):
|
||||
"""Collection of decision book budget codes"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class DecisionBookBudgetMasterResponse(BaseResponse):
|
||||
"""Response model for decision book budget master"""
|
||||
|
||||
budget_type: str
|
||||
currency: str = "TRY"
|
||||
total_budget: Decimal
|
||||
tracking_period_id: Optional[int]
|
||||
tracking_period_uu_id: Optional[str]
|
||||
budget_books_id: int
|
||||
budget_books_uu_id: Optional[str]
|
||||
department_id: int
|
||||
department_uu_id: Optional[str]
|
||||
|
||||
|
||||
class DecisionBookBudgetMasterCollection(
|
||||
CrudCollection[DecisionBookBudgetMasterResponse]
|
||||
):
|
||||
"""Collection of decision book budget masters"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class DecisionBookBudgetsResponse(BaseResponse):
|
||||
"""Response model for decision book budgets"""
|
||||
|
||||
process_date: datetime
|
||||
budget_codes_id: int
|
||||
total_budget: Decimal
|
||||
used_budget: Decimal = Decimal("0")
|
||||
remaining_budget: Decimal = Decimal("0")
|
||||
decision_book_budget_master_id: int
|
||||
decision_book_budget_master_uu_id: Optional[str]
|
||||
|
||||
|
||||
class DecisionBookBudgetsCollection(CrudCollection[DecisionBookBudgetsResponse]):
|
||||
"""Collection of decision book budgets"""
|
||||
|
||||
pass
|
||||
309
ApiValidations/Response/building_responses.py
Normal file
309
ApiValidations/Response/building_responses.py
Normal file
@@ -0,0 +1,309 @@
|
||||
from typing import Optional, List, Generic
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
from decimal import Decimal
|
||||
|
||||
from api_validations.validations_response.base_responses import (
|
||||
BaseResponse,
|
||||
CrudCollection,
|
||||
)
|
||||
from api_validations.validations_request import PydanticBaseModel
|
||||
|
||||
|
||||
class ListBuildingResponse(PydanticBaseModel):
|
||||
|
||||
gov_address_code: str
|
||||
build_name: str
|
||||
build_types_uu_id: Optional[str] = None
|
||||
build_no: Optional[str] = None
|
||||
max_floor: Optional[int] = None
|
||||
underground_floor: Optional[int] = None
|
||||
address_uu_id: Optional[str] = None
|
||||
build_date: Optional[str] = None
|
||||
decision_period_date: Optional[str] = None
|
||||
tax_no: Optional[str] = None
|
||||
lift_count: Optional[int] = None
|
||||
heating_system: Optional[bool] = None
|
||||
cooling_system: Optional[bool] = None
|
||||
hot_water_system: Optional[bool] = None
|
||||
block_service_man_count: Optional[int] = None
|
||||
security_service_man_count: Optional[int] = None
|
||||
garage_count: Optional[int] = None
|
||||
site_uu_id: Optional[str] = None
|
||||
|
||||
|
||||
class BuildAreaListResponse(BaseResponse):
|
||||
"""Response model for building area list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
build_id: int
|
||||
build_uu_id: str
|
||||
area_name: str
|
||||
area_value: float
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class BuildAreaListCollection(CrudCollection[BuildAreaListResponse]):
|
||||
"""Collection of building area list"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildSitesListResponse(BaseResponse):
|
||||
"""Response model for building sites list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
address_id: int
|
||||
site_name: str
|
||||
site_value: float
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class BuildSitesListCollection(CrudCollection[BuildSitesListResponse]):
|
||||
"""Collection of building sites list"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildTypesListResponse(BaseResponse):
|
||||
"""Response model for building types list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
type_name: str
|
||||
type_value: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class BuildTypesListCollection(CrudCollection[BuildTypesListResponse]):
|
||||
"""Collection of building types list"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildTypesResponse(BaseResponse):
|
||||
"""Response model for building types"""
|
||||
|
||||
function_code: str
|
||||
type_code: str
|
||||
lang: str = "TR"
|
||||
|
||||
|
||||
class BuildTypesCollection(CrudCollection[BuildTypesResponse]):
|
||||
"""Collection of building types"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Part2EmployeeResponse(BaseResponse):
|
||||
"""Response model for part to employee mapping"""
|
||||
|
||||
build_id: int
|
||||
part_id: int
|
||||
employee_id: int
|
||||
|
||||
|
||||
class Part2EmployeeCollection(CrudCollection[Part2EmployeeResponse]):
|
||||
"""Collection of part to employee mappings"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class RelationshipEmployee2BuildResponse(BaseResponse):
|
||||
"""Response model for employee to build relationship"""
|
||||
|
||||
company_id: int
|
||||
employee_id: int
|
||||
member_id: int
|
||||
relationship_type: Optional[str] = "Employee"
|
||||
show_only: bool = False
|
||||
|
||||
|
||||
class RelationshipEmployee2BuildCollection(
|
||||
CrudCollection[RelationshipEmployee2BuildResponse]
|
||||
):
|
||||
"""Collection of employee to build relationships"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildResponse(BaseResponse):
|
||||
"""Response model for buildings"""
|
||||
|
||||
gov_address_code: str = ""
|
||||
build_name: str
|
||||
build_no: str
|
||||
max_floor: int = 1
|
||||
underground_floor: int = 0
|
||||
build_date: datetime
|
||||
decision_period_date: datetime
|
||||
tax_no: str = ""
|
||||
lift_count: int = 0
|
||||
heating_system: bool = True
|
||||
cooling_system: bool = False
|
||||
hot_water_system: bool = False
|
||||
block_service_man_count: int = 0
|
||||
security_service_man_count: int = 0
|
||||
garage_count: int = 0
|
||||
management_room_id: Optional[int]
|
||||
site_id: Optional[int]
|
||||
site_uu_id: Optional[str]
|
||||
address_id: int
|
||||
address_uu_id: str
|
||||
build_types_id: int
|
||||
build_types_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildCollection(CrudCollection[BuildResponse]):
|
||||
"""Collection of buildings"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildPartsResponse(BaseResponse):
|
||||
"""Response model for building parts"""
|
||||
|
||||
address_gov_code: str
|
||||
part_no: int = 0
|
||||
part_level: int = 0
|
||||
part_code: str
|
||||
part_gross_size: int = 0
|
||||
part_net_size: int = 0
|
||||
default_accessory: str = "0"
|
||||
human_livable: bool = True
|
||||
due_part_key: str
|
||||
build_id: int
|
||||
build_uu_id: str
|
||||
part_direction_id: Optional[int]
|
||||
part_direction_uu_id: Optional[str]
|
||||
part_type_id: int
|
||||
part_type_uu_id: str
|
||||
|
||||
|
||||
class BuildPartsCollection(CrudCollection[BuildPartsResponse]):
|
||||
"""Collection of building parts"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildLivingSpaceResponse(BaseResponse):
|
||||
"""Response model for building living space"""
|
||||
|
||||
fix_value: Decimal = Decimal("0")
|
||||
fix_percent: Decimal = Decimal("0")
|
||||
agreement_no: str = ""
|
||||
marketing_process: bool = False
|
||||
marketing_layer: int = 0
|
||||
build_parts_id: int
|
||||
build_parts_uu_id: str
|
||||
person_id: int
|
||||
person_uu_id: str
|
||||
occupant_type: int
|
||||
occupant_type_uu_id: str
|
||||
|
||||
|
||||
class BuildLivingSpaceCollection(CrudCollection[BuildLivingSpaceResponse]):
|
||||
"""Collection of building living spaces"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildManagementResponse(BaseResponse):
|
||||
"""Response model for building management"""
|
||||
|
||||
discounted_percentage: Decimal = Decimal("0.00")
|
||||
discounted_price: Decimal = Decimal("0.00")
|
||||
calculated_price: Decimal = Decimal("0.00")
|
||||
occupant_type: int
|
||||
occupant_type_uu_id: str
|
||||
build_id: int
|
||||
build_uu_id: str
|
||||
build_parts_id: int
|
||||
build_parts_uu_id: str
|
||||
|
||||
|
||||
class BuildManagementCollection(CrudCollection[BuildManagementResponse]):
|
||||
"""Collection of building management records"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildAreaResponse(BaseResponse):
|
||||
"""Response model for building area"""
|
||||
|
||||
area_name: str = ""
|
||||
area_code: str = ""
|
||||
area_type: str = "GREEN"
|
||||
area_direction: str = "NN"
|
||||
area_gross_size: Decimal = Decimal("0")
|
||||
area_net_size: Decimal = Decimal("0")
|
||||
width: int = 0
|
||||
size: int = 0
|
||||
build_id: int
|
||||
build_uu_id: str
|
||||
part_type_id: Optional[int]
|
||||
part_type_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildAreaCollection(CrudCollection[BuildAreaResponse]):
|
||||
"""Collection of building areas"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildSitesResponse(BaseResponse):
|
||||
"""Response model for building sites"""
|
||||
|
||||
site_name: str
|
||||
site_no: str
|
||||
address_id: int
|
||||
address_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildSitesCollection(CrudCollection[BuildSitesResponse]):
|
||||
"""Collection of building sites"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildCompaniesProvidingResponse(BaseResponse):
|
||||
"""Response model for building companies providing services"""
|
||||
|
||||
build_id: int
|
||||
build_uu_id: Optional[str]
|
||||
company_id: int
|
||||
company_uu_id: Optional[str]
|
||||
provide_id: Optional[int]
|
||||
provide_uu_id: Optional[str]
|
||||
contract_id: Optional[int]
|
||||
|
||||
|
||||
class BuildCompaniesProvidingCollection(
|
||||
CrudCollection[BuildCompaniesProvidingResponse]
|
||||
):
|
||||
"""Collection of building companies providing services"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildPersonProvidingResponse(BaseResponse):
|
||||
"""Response model for building person providing services"""
|
||||
|
||||
build_id: int
|
||||
build_uu_id: Optional[str]
|
||||
people_id: int
|
||||
people_uu_id: Optional[str]
|
||||
provide_id: Optional[int]
|
||||
provide_uu_id: Optional[str]
|
||||
contract_id: Optional[int]
|
||||
|
||||
|
||||
class BuildPersonProvidingCollection(CrudCollection[BuildPersonProvidingResponse]):
|
||||
"""Collection of building person providing services"""
|
||||
|
||||
pass
|
||||
59
ApiValidations/Response/company_responses.py
Normal file
59
ApiValidations/Response/company_responses.py
Normal file
@@ -0,0 +1,59 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class CompanyListResponse(BaseModel):
|
||||
"""Response model for company list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
company_name: str
|
||||
company_code: str
|
||||
company_email: str
|
||||
company_phone: str
|
||||
company_address: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class CompanyDepartmentListResponse(BaseModel):
|
||||
"""Response model for company department list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
department_name: str
|
||||
department_code: str
|
||||
company_id: int
|
||||
company_uu_id: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class CompanyDutyListResponse(BaseModel):
|
||||
"""Response model for company duty list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
duty_name: str
|
||||
duty_code: str
|
||||
department_id: int
|
||||
department_uu_id: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
|
||||
|
||||
class CompanyEmployeeListResponse(BaseModel):
|
||||
"""Response model for company employee list endpoint"""
|
||||
|
||||
uu_id: UUID
|
||||
employee_id: int
|
||||
employee_uu_id: str
|
||||
company_id: int
|
||||
company_uu_id: str
|
||||
duty_id: int
|
||||
duty_uu_id: str
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
deleted: bool = False
|
||||
204
ApiValidations/Response/decision_book_responses.py
Normal file
204
ApiValidations/Response/decision_book_responses.py
Normal file
@@ -0,0 +1,204 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
from decimal import Decimal
|
||||
from .base_responses import BaseResponse, CrudCollection
|
||||
|
||||
|
||||
class BuildDecisionBookResponse(BaseResponse):
|
||||
"""Response model for building decision book"""
|
||||
|
||||
decision_book_pdf_path: Optional[str] = ""
|
||||
resp_company_fix_wage: float = 0
|
||||
contact_agreement_path: Optional[str] = ""
|
||||
contact_agreement_date: Optional[datetime]
|
||||
meeting_date: Optional[str]
|
||||
decision_type: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookCollection(CrudCollection[BuildDecisionBookResponse]):
|
||||
"""Collection of building decision books"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookInvitationsResponse(BaseResponse):
|
||||
"""Response model for building decision book invitations"""
|
||||
|
||||
build_id: int
|
||||
build_uu_id: Optional[str]
|
||||
decision_book_id: int
|
||||
decision_book_uu_id: Optional[str]
|
||||
invitation_type: str
|
||||
invitation_attempt: int = 1
|
||||
living_part_count: int = 1
|
||||
living_part_percentage: Decimal = Decimal("0.51")
|
||||
message: Optional[str]
|
||||
planned_date: datetime
|
||||
planned_date_expires: datetime
|
||||
|
||||
|
||||
class BuildDecisionBookInvitationsCollection(
|
||||
CrudCollection[BuildDecisionBookInvitationsResponse]
|
||||
):
|
||||
"""Collection of building decision book invitations"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookPersonResponse(BaseResponse):
|
||||
"""Response model for building decision book person"""
|
||||
|
||||
dues_percent_discount: int = 0
|
||||
dues_fix_discount: Decimal = Decimal("0")
|
||||
dues_discount_approval_date: datetime
|
||||
send_date: datetime
|
||||
is_attending: bool = False
|
||||
confirmed_date: Optional[datetime]
|
||||
token: str = ""
|
||||
vicarious_person_id: Optional[int]
|
||||
vicarious_person_uu_id: Optional[str]
|
||||
invite_id: int
|
||||
invite_uu_id: str
|
||||
build_decision_book_id: int
|
||||
build_decision_book_uu_id: str
|
||||
build_living_space_id: int
|
||||
build_living_space_uu_id: Optional[str]
|
||||
person_id: int
|
||||
|
||||
|
||||
class BuildDecisionBookPersonCollection(
|
||||
CrudCollection[BuildDecisionBookPersonResponse]
|
||||
):
|
||||
"""Collection of building decision book persons"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookPersonOccupantsResponse(BaseResponse):
|
||||
"""Response model for building decision book person occupants"""
|
||||
|
||||
build_decision_book_person_id: int
|
||||
build_decision_book_person_uu_id: Optional[str]
|
||||
invite_id: Optional[int]
|
||||
invite_uu_id: Optional[str]
|
||||
occupant_type_id: int
|
||||
occupant_type_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookPersonOccupantsCollection(
|
||||
CrudCollection[BuildDecisionBookPersonOccupantsResponse]
|
||||
):
|
||||
"""Collection of building decision book person occupants"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookItemsResponse(BaseResponse):
|
||||
"""Response model for building decision book items"""
|
||||
|
||||
item_order: int
|
||||
item_comment: str
|
||||
item_objection: Optional[str]
|
||||
info_is_completed: bool = False
|
||||
is_payment_created: bool = False
|
||||
info_type_id: Optional[int]
|
||||
info_type_uu_id: Optional[str]
|
||||
build_decision_book_id: int
|
||||
build_decision_book_uu_id: Optional[str]
|
||||
item_short_comment: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookItemsCollection(CrudCollection[BuildDecisionBookItemsResponse]):
|
||||
"""Collection of building decision book items"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookItemsUnapprovedResponse(BaseResponse):
|
||||
"""Response model for building decision book items unapproved"""
|
||||
|
||||
item_objection: str
|
||||
item_order: int
|
||||
decision_book_item_id: int
|
||||
decision_book_item_uu_id: Optional[str]
|
||||
person_id: int
|
||||
person_uu_id: Optional[str]
|
||||
build_decision_book_item: int
|
||||
build_decision_book_item_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookItemsUnapprovedCollection(
|
||||
CrudCollection[BuildDecisionBookItemsUnapprovedResponse]
|
||||
):
|
||||
"""Collection of building decision book items unapproved"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookPaymentsResponse(BaseResponse):
|
||||
"""Response model for building decision book payments"""
|
||||
|
||||
payment_plan_time_periods: str
|
||||
process_date: datetime
|
||||
payment_amount: Decimal
|
||||
currency: str = "TRY"
|
||||
payment_types_id: Optional[int]
|
||||
payment_types_uu_id: Optional[str]
|
||||
period_time: str
|
||||
process_date_y: int
|
||||
process_date_m: int
|
||||
build_decision_book_item_id: int
|
||||
build_decision_book_item_uu_id: str
|
||||
build_parts_id: int
|
||||
build_parts_uu_id: str
|
||||
decision_book_project_id: Optional[int]
|
||||
decision_book_project_uu_id: Optional[str]
|
||||
account_records_id: Optional[int]
|
||||
account_records_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookPaymentsCollection(
|
||||
CrudCollection[BuildDecisionBookPaymentsResponse]
|
||||
):
|
||||
"""Collection of building decision book payments"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BuildDecisionBookLegalResponse(BaseResponse):
|
||||
"""Response model for building decision book legal"""
|
||||
|
||||
period_start_date: datetime
|
||||
lawsuits_decision_number: str
|
||||
lawsuits_decision_date: datetime
|
||||
period_stop_date: datetime
|
||||
decision_book_pdf_path: Optional[str] = ""
|
||||
resp_company_total_wage: Optional[Decimal] = Decimal("0")
|
||||
contact_agreement_path: Optional[str] = ""
|
||||
contact_agreement_date: Optional[datetime]
|
||||
meeting_date: str
|
||||
lawsuits_type: str = "C"
|
||||
lawsuits_name: str
|
||||
lawsuits_note: str
|
||||
lawyer_cost: Decimal
|
||||
mediator_lawyer_cost: Decimal
|
||||
other_cost: Decimal
|
||||
legal_cost: Decimal
|
||||
approved_cost: Decimal
|
||||
total_price: Decimal
|
||||
build_db_item_id: int
|
||||
build_db_item_uu_id: Optional[str]
|
||||
resp_attorney_id: int
|
||||
resp_attorney_uu_id: Optional[str]
|
||||
resp_attorney_company_id: int
|
||||
resp_attorney_company_uu_id: Optional[str]
|
||||
mediator_lawyer_person_id: int
|
||||
mediator_lawyer_person_uu_id: Optional[str]
|
||||
|
||||
|
||||
class BuildDecisionBookLegalCollection(CrudCollection[BuildDecisionBookLegalResponse]):
|
||||
"""Collection of building decision book legal records"""
|
||||
|
||||
pass
|
||||
52
ApiValidations/Response/living_space_responses.py
Normal file
52
ApiValidations/Response/living_space_responses.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from typing import Optional
|
||||
from api_validations.core_validations import BaseModelRegular
|
||||
from api_validations.validations_request import (
|
||||
CrudRecordValidation,
|
||||
CrudRecords,
|
||||
)
|
||||
|
||||
|
||||
class LivingSpaceListValidation:
|
||||
tr = {
|
||||
**CrudRecordValidation.tr,
|
||||
"fix_value": "Sabit Değer",
|
||||
"fix_percent": "Sabit Yüzde",
|
||||
"agreement_no": "Anlaşma No",
|
||||
"marketing_process": "Pazarlama Süreci",
|
||||
"marketing_layer": "Pazarlama Katmanı",
|
||||
"build_parts_id": "Bölüm ID",
|
||||
"build_parts_uu_id": "Bölüm UUID",
|
||||
"person_id": "Sorumlu Kişi ID",
|
||||
"person_uu_id": "Sorumlu Kişi UUID",
|
||||
"occupant_type": "Kiracı Tipi",
|
||||
"occupant_type_uu_id": "Kiracı Tipi UUID",
|
||||
}
|
||||
en = {
|
||||
**CrudRecordValidation.en,
|
||||
"fix_value": "Fixed Value",
|
||||
"fix_percent": "Fixed Percent",
|
||||
"agreement_no": "Agreement No",
|
||||
"marketing_process": "Marketing Process",
|
||||
"marketing_layer": "Marketing Layer",
|
||||
"build_parts_id": "Part ID",
|
||||
"build_parts_uu_id": "Part UUID",
|
||||
"person_id": "Responsible Person ID",
|
||||
"person_uu_id": "Responsible Person UUID",
|
||||
"occupant_type": "Occupant Type",
|
||||
"occupant_type_uu_id": "Occupant Type UUID",
|
||||
}
|
||||
|
||||
|
||||
class LivingSpaceListResponse(BaseModelRegular, CrudRecords, LivingSpaceListValidation):
|
||||
|
||||
fix_value: Optional[float] = None
|
||||
fix_percent: Optional[float] = None
|
||||
agreement_no: Optional[str] = None
|
||||
marketing_process: Optional[str] = None
|
||||
marketing_layer: Optional[str] = None
|
||||
build_parts_id: Optional[int] = None
|
||||
build_parts_uu_id: Optional[str] = None
|
||||
person_id: Optional[int] = None
|
||||
person_uu_id: Optional[str] = None
|
||||
occupant_type: Optional[str] = None
|
||||
occupant_type_uu_id: Optional[str] = None
|
||||
54
ApiValidations/Response/parts_responses.py
Normal file
54
ApiValidations/Response/parts_responses.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from typing import Optional
|
||||
from api_validations.core_validations import BaseModelRegular
|
||||
from api_validations.validations_request import (
|
||||
CrudRecordValidation,
|
||||
CrudRecords,
|
||||
)
|
||||
|
||||
|
||||
class BuildPartsListValidation:
|
||||
tr = {
|
||||
**CrudRecordValidation.tr,
|
||||
"address_gov_code": "Adres Kapı Kodu",
|
||||
"part_no": "Bölüm No",
|
||||
"part_level": "Bölüm Seviyesi",
|
||||
"part_code": "Bölüm Kodu",
|
||||
"part_gross": "Bölüm Brüt",
|
||||
"part_net": "Bölüm Net",
|
||||
"default_accessory": "Varsayılan Aksesuar",
|
||||
"human_livable": "İnsan Yaşamı",
|
||||
"due_part_key": "Sabit Ödeme Grubu",
|
||||
"build_uu_id": "Bina UUID",
|
||||
"part_direction_uu_id": "Bölüm Yönü UUID",
|
||||
"part_type_uu_id": "Bölüm Tipi UUID",
|
||||
}
|
||||
en = {
|
||||
**CrudRecordValidation.en,
|
||||
"address_gov_code": "Address Government Code",
|
||||
"part_no": "Part Number",
|
||||
"part_level": "Part Level",
|
||||
"part_code": "Part Code",
|
||||
"part_gross": "Part Gross",
|
||||
"part_net": "Part Net",
|
||||
"default_accessory": "Default Accessory",
|
||||
"human_livable": "Human Livable",
|
||||
"due_part_key": "Constant Payment Group",
|
||||
"build_uu_id": "Building UUID",
|
||||
"part_direction_uu_id": "Part Direction UUID",
|
||||
"part_type_uu_id": "Part Type UUID",
|
||||
}
|
||||
|
||||
|
||||
class BuildPartsListResponse(BaseModelRegular, CrudRecords, BuildPartsListValidation):
|
||||
address_gov_code: Optional[str] = None
|
||||
part_no: Optional[int] = None
|
||||
part_level: Optional[int] = None
|
||||
part_code: Optional[str] = None
|
||||
part_gross: Optional[int] = None
|
||||
part_net: Optional[int] = None
|
||||
default_accessory: Optional[str] = None
|
||||
human_livable: Optional[bool] = None
|
||||
due_part_key: Optional[str] = None
|
||||
build_uu_id: Optional[str] = None
|
||||
part_direction_uu_id: Optional[str] = None
|
||||
part_type_uu_id: Optional[str] = None
|
||||
57
ApiValidations/Response/people_responses.py
Normal file
57
ApiValidations/Response/people_responses.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from typing import Optional
|
||||
from api_validations.core_validations import BaseModelRegular
|
||||
from api_validations.validations_request import (
|
||||
CrudRecordValidation,
|
||||
CrudRecords,
|
||||
)
|
||||
|
||||
|
||||
class PeopleListValidation:
|
||||
tr = {
|
||||
**CrudRecordValidation.tr,
|
||||
"firstname": "Ad",
|
||||
"surname": "Soyad",
|
||||
"middle_name": "Orta İsim",
|
||||
"sex_code": "Cinsiyet Kodu",
|
||||
"person_ref": "Kişi Referansı",
|
||||
"person_tag": "Kişi Etiketi",
|
||||
"father_name": "Baba Adı",
|
||||
"mother_name": "Anne Adı",
|
||||
"country_code": "Ülke Kodu",
|
||||
"national_identity_id": "Kimlik Numarası",
|
||||
"birth_place": "Doğum Yeri",
|
||||
"birth_date": "Doğum Tarihi",
|
||||
"tax_no": "Vergi Numarası",
|
||||
}
|
||||
en = {
|
||||
**CrudRecordValidation.en,
|
||||
"firstname": "First Name",
|
||||
"surname": "Surname",
|
||||
"middle_name": "Middle Name",
|
||||
"sex_code": "Sex Code",
|
||||
"person_ref": "Person Reference",
|
||||
"person_tag": "Person Tag",
|
||||
"father_name": "Father's Name",
|
||||
"mother_name": "Mother's Name",
|
||||
"country_code": "Country Code",
|
||||
"national_identity_id": "National Identity ID",
|
||||
"birth_place": "Birth Place",
|
||||
"birth_date": "Birth Date",
|
||||
"tax_no": "Tax Number",
|
||||
}
|
||||
|
||||
|
||||
class PeopleListResponse(BaseModelRegular, CrudRecords, PeopleListValidation):
|
||||
firstname: Optional[str] = None
|
||||
surname: Optional[str] = None
|
||||
middle_name: Optional[str] = None
|
||||
sex_code: Optional[str] = None
|
||||
person_ref: Optional[str] = None
|
||||
person_tag: Optional[str] = None
|
||||
father_name: Optional[str] = None
|
||||
mother_name: Optional[str] = None
|
||||
country_code: Optional[str] = None
|
||||
national_identity_id: Optional[str] = None
|
||||
birth_place: Optional[str] = None
|
||||
birth_date: Optional[str] = None
|
||||
tax_no: Optional[str] = None
|
||||
Reference in New Issue
Block a user