alchemy updated
This commit is contained in:
parent
052d1f7b9c
commit
4199cc16b4
|
|
@ -13,7 +13,6 @@ from api_validations.validations_request import (
|
||||||
|
|
||||||
from api_validations.core_response import AlchemyJsonResponse
|
from api_validations.core_response import AlchemyJsonResponse
|
||||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||||
from api_events.events.building.building_build import BuildPatchEventMethods
|
|
||||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -35,18 +34,16 @@ class BuildAreaListEventMethods(MethodToEvent):
|
||||||
Build.id == token_dict.selected_occupant.build_id,
|
Build.id == token_dict.selected_occupant.build_id,
|
||||||
*Build.valid_record_args(Build),
|
*Build.valid_record_args(Build),
|
||||||
).data
|
).data
|
||||||
build_id_list = [build.id for build in build_ids]
|
|
||||||
BuildArea.pre_query = BuildArea.filter_all(
|
BuildArea.pre_query = BuildArea.filter_all(
|
||||||
BuildArea.build_id.in_(build_id_list),
|
BuildArea.build_id.in_([build.id for build in build_ids]),
|
||||||
*BuildArea.valid_record_args(BuildArea),
|
*BuildArea.valid_record_args(BuildArea),
|
||||||
).query
|
).query
|
||||||
elif isinstance(token_dict, EmployeeTokenObject):
|
elif isinstance(token_dict, EmployeeTokenObject):
|
||||||
build_ids = Build.select_action(
|
build_ids = Build.select_action(
|
||||||
employee_id=token_dict.selected_company.employee_id
|
employee_id=token_dict.selected_company.employee_id
|
||||||
)
|
)
|
||||||
build_id_list = [build.id for build in build_ids]
|
|
||||||
BuildArea.pre_query = BuildArea.filter_all(
|
BuildArea.pre_query = BuildArea.filter_all(
|
||||||
BuildArea.build_id.in_(build_id_list),
|
BuildArea.build_id.in_([build.id for build in build_ids]),
|
||||||
*BuildArea.valid_record_args(BuildArea),
|
*BuildArea.valid_record_args(BuildArea),
|
||||||
).query
|
).query
|
||||||
BuildArea.filter_attr = list_options
|
BuildArea.filter_attr = list_options
|
||||||
|
|
@ -54,7 +51,7 @@ class BuildAreaListEventMethods(MethodToEvent):
|
||||||
*BuildArea.valid_record_args(BuildArea),
|
*BuildArea.valid_record_args(BuildArea),
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True, message="Update Build record", result=records
|
completed=True, message="List of Build Area", result=records
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -101,7 +98,7 @@ class BuildAreaCreateEventMethods(MethodToEvent):
|
||||||
created_build_part.save()
|
created_build_part.save()
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
message="Update Build record",
|
message="Created Build Area",
|
||||||
result=created_build_part,
|
result=created_build_part,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ from api_validations.validations_request import (
|
||||||
from api_validations.core_response import AlchemyJsonResponse
|
from api_validations.core_response import AlchemyJsonResponse
|
||||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||||
|
from databases.sql_models.identity.identity import Addresses
|
||||||
|
|
||||||
|
|
||||||
class BuildSitesListEventMethods(MethodToEvent):
|
class BuildSitesListEventMethods(MethodToEvent):
|
||||||
|
|
@ -30,22 +31,28 @@ class BuildSitesListEventMethods(MethodToEvent):
|
||||||
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
):
|
):
|
||||||
if isinstance(token_dict, OccupantTokenObject):
|
if isinstance(token_dict, OccupantTokenObject):
|
||||||
build_ids = Build.filter_all(
|
occupants_build = Build.filter_one(
|
||||||
Build.id == token_dict.selected_occupant.build_id,
|
Build.id == token_dict.selected_occupant.build_id,
|
||||||
*Build.valid_record_args(Build),
|
*Build.valid_record_args(Build),
|
||||||
).data
|
).data
|
||||||
build_id_list = [build.id for build in build_ids]
|
|
||||||
BuildSites.pre_query = BuildSites.filter_all(
|
BuildSites.pre_query = BuildSites.filter_all(
|
||||||
BuildSites.build_id.in_(build_id_list),
|
BuildSites.address_id == occupants_build.address_id,
|
||||||
*BuildSites.valid_record_args(BuildSites),
|
*BuildSites.valid_record_args(BuildSites),
|
||||||
).query
|
).query
|
||||||
elif isinstance(token_dict, EmployeeTokenObject):
|
elif isinstance(token_dict, EmployeeTokenObject):
|
||||||
build_ids = Build.select_action(
|
employees_build = Build.select_action(
|
||||||
employee_id=token_dict.selected_company.employee_id
|
employee_id=token_dict.selected_company.employee_id
|
||||||
)
|
)
|
||||||
build_id_list = [build.id for build in build_ids]
|
employees_build_list = [build.address_id for build in employees_build.all()]
|
||||||
|
if not employees_build_list:
|
||||||
|
BuildSites.raise_http_exception(
|
||||||
|
status_code="HTTP_404_NOT_FOUND",
|
||||||
|
error_case="NOT_FOUND",
|
||||||
|
message="Employee has no build sites registered",
|
||||||
|
data={},
|
||||||
|
)
|
||||||
BuildSites.pre_query = BuildSites.filter_all(
|
BuildSites.pre_query = BuildSites.filter_all(
|
||||||
BuildSites.build_id.in_(build_id_list),
|
BuildSites.address_id.in_(employees_build_list)
|
||||||
*BuildSites.valid_record_args(BuildSites),
|
*BuildSites.valid_record_args(BuildSites),
|
||||||
).query
|
).query
|
||||||
BuildSites.filter_attr = list_options
|
BuildSites.filter_attr = list_options
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ class CompanyListEventMethods(MethodToEvent):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif isinstance(token_dict, OccupantTokenObject):
|
elif isinstance(token_dict, OccupantTokenObject):
|
||||||
Companies.pre_query = Companies.filter_active(
|
Companies.pre_query = Companies.filter_all(
|
||||||
Companies.id == token_dict.selected_occupant.responsible_company_id
|
Companies.id == token_dict.selected_occupant.responsible_company_id
|
||||||
).query
|
).query
|
||||||
Companies.filter_attr = list_options
|
Companies.filter_attr = list_options
|
||||||
records = Companies.filter_active(
|
records = Companies.filter_all(
|
||||||
*Companies.valid_record_args(Companies)
|
*Companies.valid_record_args(Companies)
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,9 @@ class DepartmentListEventMethods(MethodToEvent):
|
||||||
token_dict: EmployeeTokenObject,
|
token_dict: EmployeeTokenObject,
|
||||||
):
|
):
|
||||||
Departments.filter_attr = list_options
|
Departments.filter_attr = list_options
|
||||||
records = Departments.filter_active(
|
records = Departments.filter_all(
|
||||||
Departments.company_id == token_dict.selected_company.company_id,
|
Departments.company_id == token_dict.selected_company.company_id,
|
||||||
|
*Departments.valid_record_args(Departments)
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,10 @@ class DutiesGetByUUIDEventMethods(MethodToEvent):
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
records = Duties.filter_active(
|
records = Duties.filter_all(
|
||||||
Duties.duties_id == duty.id,
|
Duties.duties_id == duty.id,
|
||||||
Duties.company_id == token_dict.selected_company.company_id,
|
Duties.company_id == token_dict.selected_company.company_id,
|
||||||
|
*Duties.valid_record_args(Duties)
|
||||||
)
|
)
|
||||||
if not records.data:
|
if not records.data:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,7 @@ class DutyListEventMethods(MethodToEvent):
|
||||||
token_dict: EmployeeTokenObject,
|
token_dict: EmployeeTokenObject,
|
||||||
):
|
):
|
||||||
Duty.filter_attr = list_options
|
Duty.filter_attr = list_options
|
||||||
records = Duty.filter_active(
|
records = Duty.filter_all(system=True)
|
||||||
*Duty.valid_record_args(Duty)
|
|
||||||
)
|
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
message="Duty list is brought successfully",
|
message="Duty list is brought successfully",
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,14 @@ class EmployeeListEventMethods(MethodToEvent):
|
||||||
list_options: ListOptions,
|
list_options: ListOptions,
|
||||||
token_dict: EmployeeTokenObject,
|
token_dict: EmployeeTokenObject,
|
||||||
):
|
):
|
||||||
|
employees_staff = Staff.filter_all(
|
||||||
|
Staff.duties_id.in_(token_dict.duty_id_list),
|
||||||
|
*Staff.valid_record_args(Staff),
|
||||||
|
).data
|
||||||
Employees.filter_attr = list_options
|
Employees.filter_attr = list_options
|
||||||
records = Employees.filter_active(
|
records = Employees.filter_all(
|
||||||
Employees.company_id == token_dict.selected_company.company_id,
|
Employees.staff_id.in_([staff.id for staff in employees_staff]),
|
||||||
|
*Employees.valid_record_args(Employees),
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
|
|
@ -210,7 +215,7 @@ class Employee2PeopleEmployEventMethods(MethodToEvent):
|
||||||
detail="People record not found",
|
detail="People record not found",
|
||||||
)
|
)
|
||||||
|
|
||||||
find_one_employee = Employees.filter_active(
|
find_one_employee = Employees.filter_all(
|
||||||
Employees.staff_id == selected_staff.id,
|
Employees.staff_id == selected_staff.id,
|
||||||
*Employees.valid_record_args(Employees),
|
*Employees.valid_record_args(Employees),
|
||||||
).data
|
).data
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class StaffListEventMethods(MethodToEvent):
|
||||||
@classmethod
|
@classmethod
|
||||||
def staff_list(cls, list_options: ListOptions, token_dict: EmployeeTokenObject):
|
def staff_list(cls, list_options: ListOptions, token_dict: EmployeeTokenObject):
|
||||||
Staff.filter_attr = list_options
|
Staff.filter_attr = list_options
|
||||||
records = Staff.filter_active(
|
records = Staff.filter_all(
|
||||||
*Staff.valid_record_args(Staff)
|
*Staff.valid_record_args(Staff)
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ from api_validations.validations_request import (
|
||||||
InsertBuildDecisionBookItems,
|
InsertBuildDecisionBookItems,
|
||||||
ListDecisionBook,
|
ListDecisionBook,
|
||||||
)
|
)
|
||||||
from service_app_test.test_application.evyos.datas.company_employee_data import list_options
|
|
||||||
|
|
||||||
|
|
||||||
class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||||
|
|
@ -59,7 +58,7 @@ class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||||
Build.uu_id == decision_book.build_decision_book_uu_id,
|
Build.uu_id == decision_book.build_decision_book_uu_id,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
reachable_building = Build.filter_active()
|
reachable_building = Build.filter_all()
|
||||||
if not reachable_building.data:
|
if not reachable_building.data:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
|
@ -73,7 +72,7 @@ class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||||
],
|
],
|
||||||
filter_expr=[Companies.id == decision_book.company_id],
|
filter_expr=[Companies.id == decision_book.company_id],
|
||||||
)
|
)
|
||||||
reachable_companies = Companies.filter_active()
|
reachable_companies = Companies.filter_all()
|
||||||
if not reachable_companies.data:
|
if not reachable_companies.data:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
|
@ -82,7 +81,7 @@ class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||||
BuildDecisionBookItems.filter_attr = BuildDecisionBookItems.FilterModel(
|
BuildDecisionBookItems.filter_attr = BuildDecisionBookItems.FilterModel(
|
||||||
**data.dump()
|
**data.dump()
|
||||||
)
|
)
|
||||||
records = BuildDecisionBookItems.filter_active(
|
records = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.build_decision_book_id == decision_book.id
|
BuildDecisionBookItems.build_decision_book_id == decision_book.id
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
|
|
@ -105,7 +104,7 @@ class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||||
# occupant_id=token_dict.occupant_list["occupant_id"]
|
# occupant_id=token_dict.occupant_list["occupant_id"]
|
||||||
# )
|
# )
|
||||||
# BuildDecisionBookItems.filter_attr = list_options
|
# BuildDecisionBookItems.filter_attr = list_options
|
||||||
# records = BuildDecisionBookItems.filter_active(
|
# records = BuildDecisionBookItems.filter_all(
|
||||||
# *BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
# *BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
# )
|
# )
|
||||||
# return return_json_response_from_alchemy(response=records, pagination=list_options)
|
# return return_json_response_from_alchemy(response=records, pagination=list_options)
|
||||||
|
|
@ -176,9 +175,10 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
debit_start_date: str = None,
|
debit_start_date: str = None,
|
||||||
debit_end_date: str = None,
|
debit_end_date: str = None,
|
||||||
):
|
):
|
||||||
build_parts_list = BuildParts.filter_active(
|
build_parts_list = BuildParts.filter_all(
|
||||||
BuildParts.human_livable == True,
|
BuildParts.human_livable == True,
|
||||||
BuildParts.build_id == build_id,
|
BuildParts.build_id == build_id,
|
||||||
|
*BuildParts.valid_record_args(BuildParts)
|
||||||
)
|
)
|
||||||
book_payment_dict = dict(
|
book_payment_dict = dict(
|
||||||
payment_plan_time_periods=str(data_info_type.key),
|
payment_plan_time_periods=str(data_info_type.key),
|
||||||
|
|
@ -335,8 +335,9 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
decision_book=decision_book,
|
decision_book=decision_book,
|
||||||
token_dict=token_dict,
|
token_dict=token_dict,
|
||||||
)
|
)
|
||||||
book_items = BuildDecisionBookItems.filter_active(
|
book_items = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
||||||
|
*BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
)
|
)
|
||||||
|
|
||||||
data_dict["item_order"] = int(book_items.count) + 1
|
data_dict["item_order"] = int(book_items.count) + 1
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@ class DecisionBookDecisionBookItemsDebitsListEventMethods(MethodToEvent):
|
||||||
decision_book_id: str,
|
decision_book_id: str,
|
||||||
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
):
|
):
|
||||||
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_active(
|
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.decision_book_id == decision_book_id
|
BuildDecisionBookItems.decision_book_id == decision_book_id,
|
||||||
|
*BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
).query
|
).query
|
||||||
BuildDecisionBookItems.filter_attr = None
|
BuildDecisionBookItems.filter_attr = None
|
||||||
records = BuildDecisionBookItems.filter_active(
|
records = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.decision_book_id == decision_book_id
|
BuildDecisionBookItems.decision_book_id == decision_book_id,
|
||||||
|
*BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
|
|
@ -89,12 +91,14 @@ class DecisionBookDecisionBookItemsDebitsCreateEventMethods(MethodToEvent):
|
||||||
decision_book_items_debits["confirmed_by"] = None
|
decision_book_items_debits["confirmed_by"] = None
|
||||||
decision_book_items_debits["deleted_at"] = None
|
decision_book_items_debits["deleted_at"] = None
|
||||||
decision_book_items_debits["deleted_by"] = None
|
decision_book_items_debits["deleted_by"] = None
|
||||||
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_active(
|
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.decision_book_id == decision_book_id
|
BuildDecisionBookItems.decision_book_id == decision_book_id,
|
||||||
|
*BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
).query
|
).query
|
||||||
BuildDecisionBookItems.filter_attr = None
|
BuildDecisionBookItems.filter_attr = None
|
||||||
records = BuildDecisionBookItems.filter_active(
|
records = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.decision_book_id == decision_book_id
|
BuildDecisionBookItems.decision_book_id == decision_book_id,
|
||||||
|
*BuildDecisionBookItems.valid_record_args(BuildDecisionBookItems)
|
||||||
)
|
)
|
||||||
return AlchemyJsonResponse(
|
return AlchemyJsonResponse(
|
||||||
completed=True,
|
completed=True,
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ DecisionBookPersonAssignOccupantEventMethod = (
|
||||||
# Build.id == decision_book.build_id,
|
# Build.id == decision_book.build_id,
|
||||||
# ],
|
# ],
|
||||||
# )
|
# )
|
||||||
# reachable_building = Build.filter_active()
|
# reachable_building = Build.filter_all()
|
||||||
# if not reachable_building.data:
|
# if not reachable_building.data:
|
||||||
# raise HTTPException(
|
# raise HTTPException(
|
||||||
# status_code=status.HTTP_404_NOT_FOUND,
|
# status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
|
@ -398,7 +398,7 @@ DecisionBookPersonAssignOccupantEventMethod = (
|
||||||
# ],
|
# ],
|
||||||
# filter_expr=[Companies.id == decision_book.resp_company_id],
|
# filter_expr=[Companies.id == decision_book.resp_company_id],
|
||||||
# )
|
# )
|
||||||
# reachable_companies = Companies.filter_active()
|
# reachable_companies = Companies.filter_all()
|
||||||
# if not reachable_companies.data:
|
# if not reachable_companies.data:
|
||||||
# raise HTTPException(
|
# raise HTTPException(
|
||||||
# status_code=status.HTTP_404_NOT_FOUND,
|
# status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
|
@ -410,7 +410,7 @@ DecisionBookPersonAssignOccupantEventMethod = (
|
||||||
# status_code=status.HTTP_404_NOT_FOUND,
|
# status_code=status.HTTP_404_NOT_FOUND,
|
||||||
# detail=f"No person is match with given UUID {data.person_uu_id}",
|
# detail=f"No person is match with given UUID {data.person_uu_id}",
|
||||||
# )
|
# )
|
||||||
# management_typecode = ApiEnumDropdown.filter_active(
|
# management_typecode = ApiEnumDropdown.filter_all(
|
||||||
# ApiEnumDropdown.uu_id == data.management_typecode_uu_id,
|
# ApiEnumDropdown.uu_id == data.management_typecode_uu_id,
|
||||||
# ApiEnumDropdown.enum_class.in_("BuildManagementType", "BuildDuesTypes"),
|
# ApiEnumDropdown.enum_class.in_("BuildManagementType", "BuildDuesTypes"),
|
||||||
# )
|
# )
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,10 @@ class SuperUserEventBlock(AddEventFunctionality):
|
||||||
{"function_code": "0bb51845-65a2-4340-8872-a3b5aad95468"},
|
{"function_code": "0bb51845-65a2-4340-8872-a3b5aad95468"},
|
||||||
{"function_code": "a10571fa-ac1d-4546-9272-cacb911d8004"},
|
{"function_code": "a10571fa-ac1d-4546-9272-cacb911d8004"},
|
||||||
{"function_code": "58178738-7489-4f8f-954e-5c8f083c1845"},
|
{"function_code": "58178738-7489-4f8f-954e-5c8f083c1845"},
|
||||||
|
{"function_code": "36961d8a-cefa-46cc-9f7c-9d841d6351b6"},
|
||||||
|
{"function_code": "46d90119-3b23-4784-8053-fe11da4a3584"},
|
||||||
|
{"function_code": "c786e15c-c03e-4e8f-936c-7e5e5ec9bbcc"},
|
||||||
|
{"function_code": ""},
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ class PydanticBaseModel(BaseModelRegular):
|
||||||
|
|
||||||
active: Optional[bool] = None
|
active: Optional[bool] = None
|
||||||
deleted: Optional[bool] = None
|
deleted: Optional[bool] = None
|
||||||
is_confirmed: Optional[bool] = None
|
|
||||||
expiry_starts: Optional[str] = None
|
expiry_starts: Optional[str] = None
|
||||||
expiry_ends: Optional[str] = None
|
expiry_ends: Optional[str] = None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class ConvertField:
|
||||||
# detail=f"Pydantic class {selected_model.model_type} not found in database. Please add model to api.",
|
# detail=f"Pydantic class {selected_model.model_type} not found in database. Please add model to api.",
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# model_entities_records = ModelEntities.filter_active(
|
# model_entities_records = ModelEntities.filter_all(
|
||||||
# ModelEntities.model_id == selected_model.id
|
# ModelEntities.model_id == selected_model.id
|
||||||
# ).data
|
# ).data
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class DecisionBookDecisionBookInvitationsUpdate(PydanticBaseModel):
|
||||||
occupant_type_uu_id: Optional[str] = None
|
occupant_type_uu_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class ListDecisionBook(ListOptions, PydanticBaseModel):
|
class ListDecisionBook(ListOptions):
|
||||||
build_decision_book_uu_id: Optional[str] = None
|
build_decision_book_uu_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ class SelectAction:
|
||||||
.select_from(cls)
|
.select_from(cls)
|
||||||
.join(cls.__many__table__, cls.__many__table__.member_id == cls.id)
|
.join(cls.__many__table__, cls.__many__table__.member_id == cls.id)
|
||||||
.filter(
|
.filter(
|
||||||
cls.__many__table__.duties_id.in_(duty_id_list)
|
cls.__many__table__.duties_id.in_(duty_id_list),
|
||||||
* SelectorsBase.add_confirmed_filter(
|
*SelectorsBase.add_confirmed_filter(
|
||||||
first_table=cls, second_table=cls.__many__table__
|
first_table=cls, second_table=cls.__many__table__
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class CrypterEngine(CrudCollection):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_valid_keys(cls, row=None):
|
def get_valid_keys(cls, row=None):
|
||||||
cls.encrypt_list, cls.decrypt_list = [], []
|
cls.encrypt_list, cls.decrypt_list = [], []
|
||||||
if not cls.filter_active(
|
if not cls.filter_all(
|
||||||
cls.created_at > datetime.now() - timedelta(days=29)
|
cls.created_at > datetime.now() - timedelta(days=29)
|
||||||
).get(1):
|
).get(1):
|
||||||
cls.create_encrypt_keys(count=100)
|
cls.create_encrypt_keys(count=100)
|
||||||
|
|
@ -35,7 +35,7 @@ class CrypterEngine(CrudCollection):
|
||||||
decrypt_row.key_second.decode(),
|
decrypt_row.key_second.decode(),
|
||||||
decrypt_row.uu_id,
|
decrypt_row.uu_id,
|
||||||
)
|
)
|
||||||
if encrypt_rows := cls.filter_active(
|
if encrypt_rows := cls.filter_all(
|
||||||
cls.created_at > datetime.now() - timedelta(days=29)
|
cls.created_at > datetime.now() - timedelta(days=29)
|
||||||
).data:
|
).data:
|
||||||
encrypt_row = random.choice(encrypt_rows)
|
encrypt_row = random.choice(encrypt_rows)
|
||||||
|
|
|
||||||
|
|
@ -28,85 +28,6 @@ from api_validations.validations_request import (
|
||||||
)
|
)
|
||||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||||
|
|
||||||
#
|
|
||||||
# class AbstractBuild:
|
|
||||||
# """
|
|
||||||
# Abstract and explanation of Build class for end-user guide
|
|
||||||
# """
|
|
||||||
#
|
|
||||||
# gov_address_code = Explanation(
|
|
||||||
# explanation="Devletin resmi adres kodudur.",
|
|
||||||
# usage="Devletin resmi adres kodu istendiğinde kullanılır.",
|
|
||||||
# alias="Devlet Adres Kodu",
|
|
||||||
# example=["1234567890"],
|
|
||||||
# )
|
|
||||||
# build_name = Explanation(
|
|
||||||
# explanation="Bina adıdır.",
|
|
||||||
# usage="Bina adı istendiğinde kullanılır.",
|
|
||||||
# alias="Bina Adı",
|
|
||||||
# example=["X Binası", "Y Binası"],
|
|
||||||
# )
|
|
||||||
# build_no = Explanation(
|
|
||||||
# explanation="Bina numarasıdır.",
|
|
||||||
# usage="Bina numarası istendiğinde kullanılır.",
|
|
||||||
# alias="Bina No",
|
|
||||||
# example=["1234567890"],
|
|
||||||
# )
|
|
||||||
# build_types = Explanation(
|
|
||||||
# explanation="Bina türüdür.",
|
|
||||||
# usage="Bina türü istendiğinde kullanılır.",
|
|
||||||
# alias="Bina Türü",
|
|
||||||
# example=["Ofis", "Konut", "Depo"],
|
|
||||||
# )
|
|
||||||
# max_floor = Explanation(
|
|
||||||
# explanation="Bina kat sayısıdır.",
|
|
||||||
# usage="Bina kat sayısı istendiğinde kullanılır.",
|
|
||||||
# alias="Kat Sayısı",
|
|
||||||
# example=["1", "2", "3"],
|
|
||||||
# )
|
|
||||||
# underground_floor = Explanation(
|
|
||||||
# explanation="Bina bodrum kat sayısıdır.",
|
|
||||||
# usage="Bina bodrum kat sayısı istendiğinde kullanılır.",
|
|
||||||
# alias="Bodrum Kat Sayısı",
|
|
||||||
# example=["1", "2", "3"],
|
|
||||||
# )
|
|
||||||
# build_date = Explanation(
|
|
||||||
# explanation="Bina yapım tarihidir.",
|
|
||||||
# usage="Bina yapım tarihi istendiğinde kullanılır.",
|
|
||||||
# alias="Yapım Tarihi",
|
|
||||||
# example=["2021-01-01"],
|
|
||||||
# )
|
|
||||||
# tax_no = Explanation(
|
|
||||||
# explanation="Bina vergi numarasıdır.",
|
|
||||||
# usage="Bina vergi numarası istendiğinde kullanılır.",
|
|
||||||
# alias="Vergi No",
|
|
||||||
# example=["1234567890"],
|
|
||||||
# )
|
|
||||||
# lift_count = Explanation(
|
|
||||||
# explanation="Bina asansör sayısıdır.",
|
|
||||||
# usage="Bina asansör sayısı istendiğinde kullanılır.",
|
|
||||||
# alias="Asansör Sayısı",
|
|
||||||
# example=["1", "2", "3"],
|
|
||||||
# )
|
|
||||||
# heating_system = Explanation(
|
|
||||||
# explanation="Bina ısıtma sistemi var mı?",
|
|
||||||
# usage="Bina ısıtma sistemi var mı istendiğinde kullanılır.",
|
|
||||||
# alias="Isıtma Sistemi",
|
|
||||||
# example=[True, False],
|
|
||||||
# )
|
|
||||||
# cooling_system = Explanation(
|
|
||||||
# explanation="Bina soğutma sistemi var mı?",
|
|
||||||
# usage="Bina soğutma sistemi var mı istendiğinde kullanılır.",
|
|
||||||
# alias="Soğutma Sistemi",
|
|
||||||
# example=[True, False],
|
|
||||||
# )
|
|
||||||
# hot_water_system = Explanation(
|
|
||||||
# explanation="Bina sıcak su sistemi var mı?",
|
|
||||||
# usage="Bina sıcak su sistemi var mı istendiğinde kullanılır.",
|
|
||||||
# alias="Sıcak Su Sistemi",
|
|
||||||
# example=[True, False],
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
class BuildTypes(CrudCollection):
|
class BuildTypes(CrudCollection):
|
||||||
"""
|
"""
|
||||||
|
|
@ -257,7 +178,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||||
site_uu_id: Mapped[str] = mapped_column(String, comment="Site UUID")
|
site_uu_id: Mapped[str] = mapped_column(String, comment="Site UUID")
|
||||||
address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
||||||
address_uu_id: Mapped[str] = mapped_column(String, comment="Address UUID")
|
address_uu_id: Mapped[str] = mapped_column(String, comment="Address UUID")
|
||||||
build_types_id = mapped_column(
|
build_types_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_types.id"), nullable=False, comment="Building Type"
|
ForeignKey("build_types.id"), nullable=False, comment="Building Type"
|
||||||
)
|
)
|
||||||
build_types_uu_id: Mapped[str] = mapped_column(String, comment="Building Type UUID")
|
build_types_uu_id: Mapped[str] = mapped_column(String, comment="Building Type UUID")
|
||||||
|
|
@ -376,8 +297,9 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def livable_part_count(self):
|
def livable_part_count(self):
|
||||||
livable_parts = BuildParts.filter_active(
|
livable_parts = BuildParts.filter_all(
|
||||||
BuildParts.build_id == self.id, BuildParts.human_livable == True
|
BuildParts.build_id == self.id, BuildParts.human_livable == True,
|
||||||
|
*BuildParts.valid_record_args(BuildParts)
|
||||||
)
|
)
|
||||||
if not livable_parts.data:
|
if not livable_parts.data:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|
@ -420,34 +342,34 @@ class BuildParts(CrudCollection):
|
||||||
__enum_list__ = [("part_direction", "Directions", "NN")]
|
__enum_list__ = [("part_direction", "Directions", "NN")]
|
||||||
|
|
||||||
# https://adres.nvi.gov.tr/VatandasIslemleri/AdresSorgu
|
# https://adres.nvi.gov.tr/VatandasIslemleri/AdresSorgu
|
||||||
address_gov_code = mapped_column(
|
address_gov_code: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Goverment Door Code"
|
String, nullable=False, comment="Goverment Door Code"
|
||||||
)
|
)
|
||||||
# part_name: Mapped[str] = mapped_column(String(24), server_default="", nullable=False, comment="Part Name")
|
# part_name: Mapped[str] = mapped_column(String(24), server_default="", nullable=False, comment="Part Name")
|
||||||
part_no = mapped_column(
|
part_no: Mapped[int] = mapped_column(
|
||||||
SmallInteger, server_default="0", nullable=False, comment="Part Number"
|
SmallInteger, server_default="0", nullable=False, comment="Part Number"
|
||||||
)
|
)
|
||||||
part_level = mapped_column(
|
part_level: Mapped[int] = mapped_column(
|
||||||
SmallInteger, server_default="0", comment="Building Part Level"
|
SmallInteger, server_default="0", comment="Building Part Level"
|
||||||
)
|
)
|
||||||
part_code = mapped_column(
|
part_code: Mapped[str] = mapped_column(
|
||||||
String, server_default="", nullable=False, comment="Part Code"
|
String, server_default="", nullable=False, comment="Part Code"
|
||||||
)
|
)
|
||||||
part_gross_size = mapped_column(
|
part_gross_size: Mapped[int] = mapped_column(
|
||||||
Integer, server_default="0", comment="Part Gross Size"
|
Integer, server_default="0", comment="Part Gross Size"
|
||||||
)
|
)
|
||||||
part_net_size = mapped_column(Integer, server_default="0", comment="Part Net Size")
|
part_net_size: Mapped[int] = mapped_column(Integer, server_default="0", comment="Part Net Size")
|
||||||
default_accessory = mapped_column(
|
default_accessory: Mapped[str] = mapped_column(
|
||||||
Text, server_default="0", comment="Default Accessory"
|
Text, server_default="0", comment="Default Accessory"
|
||||||
)
|
)
|
||||||
human_livable: Mapped[bool] = mapped_column(
|
human_livable: Mapped[bool] = mapped_column(
|
||||||
Boolean, server_default="1", comment="Human Livable"
|
Boolean, server_default="1", comment="Human Livable"
|
||||||
)
|
)
|
||||||
due_part_key = mapped_column(
|
due_part_key: Mapped[str] = mapped_column(
|
||||||
String, server_default="", nullable=False, comment="Constant Payment Group"
|
String, server_default="", nullable=False, comment="Constant Payment Group"
|
||||||
)
|
)
|
||||||
|
|
||||||
build_id = mapped_column(
|
build_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
||||||
)
|
)
|
||||||
build_uu_id: Mapped[str] = mapped_column(
|
build_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -456,13 +378,13 @@ class BuildParts(CrudCollection):
|
||||||
part_direction_id: Mapped[int] = mapped_column(
|
part_direction_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
part_direction_uu_id = mapped_column(
|
part_direction_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Part Direction UUID"
|
String, nullable=True, comment="Part Direction UUID"
|
||||||
)
|
)
|
||||||
part_type_id = mapped_column(
|
part_type_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_types.id"), nullable=False, comment="Building Part Type"
|
ForeignKey("build_types.id"), nullable=False, comment="Building Part Type"
|
||||||
)
|
)
|
||||||
part_type_uu_id = mapped_column(
|
part_type_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Building Part Type UUID"
|
String, nullable=False, comment="Building Part Type UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -558,12 +480,12 @@ class BuildLivingSpace(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
__include__fields__ = []
|
__include__fields__ = []
|
||||||
|
|
||||||
fix_value = mapped_column(
|
fix_value: Mapped[float] = mapped_column(
|
||||||
Numeric(20, 6),
|
Numeric(20, 6),
|
||||||
server_default="0",
|
server_default="0",
|
||||||
comment="Fixed value is deducted from debit.",
|
comment="Fixed value is deducted from debit.",
|
||||||
)
|
)
|
||||||
fix_percent = mapped_column(
|
fix_percent: Mapped[float] = mapped_column(
|
||||||
Numeric(6, 2),
|
Numeric(6, 2),
|
||||||
server_default="0",
|
server_default="0",
|
||||||
comment="Fixed percent is deducted from debit.",
|
comment="Fixed percent is deducted from debit.",
|
||||||
|
|
@ -573,19 +495,19 @@ class BuildLivingSpace(CrudCollection):
|
||||||
String, server_default="", comment="Agreement No"
|
String, server_default="", comment="Agreement No"
|
||||||
)
|
)
|
||||||
marketing_process: Mapped[bool] = mapped_column(Boolean, server_default="False")
|
marketing_process: Mapped[bool] = mapped_column(Boolean, server_default="False")
|
||||||
marketing_layer = mapped_column(SmallInteger, server_default="0")
|
marketing_layer: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||||
|
|
||||||
discounted_percentage: Mapped[float] = mapped_column(
|
discounted_percentage: Mapped[float] = mapped_column(
|
||||||
Numeric(6, 2), server_default="0.00"
|
Numeric(6, 2), server_default="0.00"
|
||||||
) # %22
|
) # %22
|
||||||
discounted_price = mapped_column(
|
discounted_price: Mapped[float] = mapped_column(
|
||||||
Numeric(20, 2), server_default="0.00"
|
Numeric(20, 2), server_default="0.00"
|
||||||
) # Normal: 78.00 TL
|
) # Normal: 78.00 TL
|
||||||
calculated_price = mapped_column(
|
calculated_price: Mapped[float] = mapped_column(
|
||||||
Numeric(20, 2), server_default="0.00"
|
Numeric(20, 2), server_default="0.00"
|
||||||
) # sana düz 75.00 TL yapar
|
) # sana düz 75.00 TL yapar
|
||||||
|
|
||||||
build_parts_id = mapped_column(
|
build_parts_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_parts.id"),
|
ForeignKey("build_parts.id"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True,
|
index=True,
|
||||||
|
|
@ -594,21 +516,21 @@ class BuildLivingSpace(CrudCollection):
|
||||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Build Part UUID"
|
String, nullable=False, comment="Build Part UUID"
|
||||||
)
|
)
|
||||||
person_id = mapped_column(
|
person_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("people.id"),
|
ForeignKey("people.id"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True,
|
index=True,
|
||||||
comment="Responsible People ID",
|
comment="Responsible People ID",
|
||||||
)
|
)
|
||||||
person_uu_id = mapped_column(
|
person_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Responsible People UUID"
|
String, nullable=False, comment="Responsible People UUID"
|
||||||
)
|
)
|
||||||
occupant_type = mapped_column(
|
occupant_type: Mapped[int] = mapped_column(
|
||||||
ForeignKey("occupant_types.id"),
|
ForeignKey("occupant_types.id"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
comment="Occupant Type",
|
comment="Occupant Type",
|
||||||
)
|
)
|
||||||
occupant_type_uu_id = mapped_column(
|
occupant_type_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Occupant Type UUID"
|
String, nullable=False, comment="Occupant Type UUID"
|
||||||
)
|
)
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|
@ -649,11 +571,13 @@ class BuildLivingSpace(CrudCollection):
|
||||||
def find_living_from_customer_id(
|
def find_living_from_customer_id(
|
||||||
cls, customer_id, process_date, add_days: int = 32
|
cls, customer_id, process_date, add_days: int = 32
|
||||||
):
|
):
|
||||||
formatted_date = datetime.strptime(str(process_date), "%Y-%m-%d %H:%M:%S")
|
from api_library.date_time_actions.date_functions import system_arrow
|
||||||
living_spaces = cls.filter_active(
|
formatted_date = system_arrow.get(str(process_date))
|
||||||
|
living_spaces = cls.filter_all(
|
||||||
or_(
|
or_(
|
||||||
cls.owner_person_id == customer_id,
|
cls.owner_person_id == customer_id,
|
||||||
cls.life_person_id == customer_id,
|
cls.life_person_id == customer_id,
|
||||||
|
*cls.valid_record_args(cls)
|
||||||
),
|
),
|
||||||
cls.start_date < formatted_date - timedelta(days=add_days),
|
cls.start_date < formatted_date - timedelta(days=add_days),
|
||||||
cls.stop_date > formatted_date + timedelta(days=add_days),
|
cls.stop_date > formatted_date + timedelta(days=add_days),
|
||||||
|
|
@ -678,11 +602,11 @@ class BuildArea(CrudCollection):
|
||||||
size = mapped_column(Integer, server_default="0")
|
size = mapped_column(Integer, server_default="0")
|
||||||
|
|
||||||
build_id: Mapped[int] = mapped_column(ForeignKey("build.id"))
|
build_id: Mapped[int] = mapped_column(ForeignKey("build.id"))
|
||||||
build_uu_id = mapped_column(String, comment="Building UUID")
|
build_uu_id: Mapped[str] = mapped_column(String, comment="Building UUID")
|
||||||
part_type_id = mapped_column(
|
part_type_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_types.id"), nullable=True, comment="Building Part Type"
|
ForeignKey("build_types.id"), nullable=True, comment="Building Part Type"
|
||||||
)
|
)
|
||||||
part_type_uu_id = mapped_column(
|
part_type_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Building Part Type UUID"
|
String, nullable=True, comment="Building Part Type UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -704,11 +628,11 @@ class BuildSites(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
__include__fields__ = []
|
__include__fields__ = []
|
||||||
|
|
||||||
site_name = mapped_column(String(24), nullable=False)
|
site_name : Mapped[str]= mapped_column(String(24), nullable=False)
|
||||||
site_no = mapped_column(String(8), nullable=False)
|
site_no: Mapped[str] = mapped_column(String(8), nullable=False)
|
||||||
|
|
||||||
address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
||||||
address_uu_id = mapped_column(String, comment="Address UUID")
|
address_uu_id: Mapped[str] = mapped_column(String, comment="Address UUID")
|
||||||
|
|
||||||
# addresses: Mapped["Address"] = relationship(
|
# addresses: Mapped["Address"] = relationship(
|
||||||
# "Address", back_populates="site", foreign_keys=[address_id]
|
# "Address", back_populates="site", foreign_keys=[address_id]
|
||||||
|
|
@ -733,14 +657,14 @@ class BuildCompaniesProviding(CrudCollection):
|
||||||
build_id = mapped_column(
|
build_id = mapped_column(
|
||||||
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
||||||
)
|
)
|
||||||
build_uu_id = mapped_column(String, nullable=True, comment="Providing UUID")
|
build_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Providing UUID")
|
||||||
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
company_uu_id = mapped_column(String, nullable=True, comment="Providing UUID")
|
company_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Providing UUID")
|
||||||
provide_id: Mapped[int] = mapped_column(
|
provide_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
provide_uu_id = mapped_column(String, nullable=True, comment="Providing UUID")
|
provide_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Providing UUID")
|
||||||
contract_id = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
contract_id: Mapped[int] = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
Index(
|
Index(
|
||||||
|
|
@ -764,14 +688,14 @@ class BuildPersonProviding(CrudCollection):
|
||||||
build_id = mapped_column(
|
build_id = mapped_column(
|
||||||
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
ForeignKey("build.id"), nullable=False, comment="Building ID"
|
||||||
)
|
)
|
||||||
build_uu_id = mapped_column(String, nullable=True, comment="Providing UUID")
|
build_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Providing UUID")
|
||||||
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
people_uu_id = mapped_column(String, nullable=True, comment="People UUID")
|
people_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="People UUID")
|
||||||
provide_id: Mapped[int] = mapped_column(
|
provide_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
provide_uu_id = mapped_column(String, nullable=True, comment="Providing UUID")
|
provide_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Providing UUID")
|
||||||
contract_id = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
contract_id: Mapped[int] = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
Index(
|
Index(
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ class BuildDecisionBookInvitations(CrudCollection):
|
||||||
first_book_invitation.living_part_percentage
|
first_book_invitation.living_part_percentage
|
||||||
)
|
)
|
||||||
valid_invite_count = (
|
valid_invite_count = (
|
||||||
BuildDecisionBookPerson.filter_active(
|
BuildDecisionBookPerson.filter_all(
|
||||||
BuildDecisionBookPerson.invite_id == first_book_invitation.id,
|
BuildDecisionBookPerson.invite_id == first_book_invitation.id,
|
||||||
BuildDecisionBookPerson.build_decision_book_id
|
BuildDecisionBookPerson.build_decision_book_id
|
||||||
== selected_decision_book.id,
|
== selected_decision_book.id,
|
||||||
|
|
@ -400,12 +400,12 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||||
)
|
)
|
||||||
|
|
||||||
def retrieve_all_occupant_types(self):
|
def retrieve_all_occupant_types(self):
|
||||||
all_decision_book_people = self.filter_active(
|
all_decision_book_people = self.filter_all(
|
||||||
BuildDecisionBookPersonOccupants.invite_id == self.invite_id,
|
BuildDecisionBookPersonOccupants.invite_id == self.invite_id,
|
||||||
filter_records=False,
|
system=True,
|
||||||
)
|
)
|
||||||
BuildDecisionBookPersonOccupants.pre_query = all_decision_book_people.query
|
BuildDecisionBookPersonOccupants.pre_query = all_decision_book_people.query
|
||||||
return BuildDecisionBookPersonOccupants.filter_active(filter_records=False)
|
return BuildDecisionBookPersonOccupants.filter_all(system=True)
|
||||||
|
|
||||||
def add_occupant_type(self, occupant_type, build_living_space_id: int = None):
|
def add_occupant_type(self, occupant_type, build_living_space_id: int = None):
|
||||||
from databases import (
|
from databases import (
|
||||||
|
|
@ -665,18 +665,19 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
occupant_type_required_list = ("MT-PRS", "MT-WRT", "BU-MNG", "BU-SPV")
|
occupant_type_required_list = ("MT-PRS", "MT-WRT", "BU-MNG", "BU-SPV")
|
||||||
occupant_type_list = OccupantTypes.filter_active(
|
occupant_type_list = OccupantTypes.filter_all(
|
||||||
OccupantTypes.occupant_code.in_(occupant_type_required_list)
|
OccupantTypes.occupant_code.in_(occupant_type_required_list),
|
||||||
|
system=True,
|
||||||
)
|
)
|
||||||
# active_invite = invitations[1] if invitations[1] else invitations[0]
|
# active_invite = invitations[1] if invitations[1] else invitations[0]
|
||||||
invitation = BuildDecisionBookInvitations.find_one(id=active_invite.id)
|
invitation = BuildDecisionBookInvitations.find_one(id=active_invite.id)
|
||||||
people_book_attend_count = None
|
people_book_attend_count = None
|
||||||
if invitation.invitation_attempt == 1:
|
if invitation.invitation_attempt == 1:
|
||||||
people_book_attend_is_attending = BuildDecisionBookPerson.filter_active(
|
people_book_attend_is_attending = BuildDecisionBookPerson.filter_all(
|
||||||
BuildDecisionBookPerson.invite_id == invitation.id,
|
BuildDecisionBookPerson.invite_id == invitation.id,
|
||||||
BuildDecisionBookPerson.is_attending == True,
|
BuildDecisionBookPerson.is_attending == True,
|
||||||
)
|
)
|
||||||
people_book_attend = BuildDecisionBookPersonOccupants.filter_active(
|
people_book_attend = BuildDecisionBookPersonOccupants.filter_all(
|
||||||
BuildDecisionBookPersonOccupants.build_decision_book_person_id.in_(
|
BuildDecisionBookPersonOccupants.build_decision_book_person_id.in_(
|
||||||
[person.id for person in people_book_attend_is_attending.data]
|
[person.id for person in people_book_attend_is_attending.data]
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||||
found_employees = Employees.filter_by_active(
|
found_employees = Employees.filter_by_active(
|
||||||
people_id=found_person.id, is_confirmed=True
|
people_id=found_person.id, is_confirmed=True
|
||||||
)
|
)
|
||||||
found_duties = Duties.filter_active(
|
found_duties = Duties.filter_all(
|
||||||
Duties.is_confirmed == True,
|
Duties.is_confirmed == True,
|
||||||
Duties.id.in_(
|
Duties.id.in_(
|
||||||
list(found_employee.duty_id for found_employee in found_employees.data)
|
list(found_employee.duty_id for found_employee in found_employees.data)
|
||||||
|
|
@ -866,7 +866,7 @@ class OccupantTypes(CrudCollection):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_manager_occupant_type(cls):
|
def get_manager_occupant_type(cls):
|
||||||
if occupant_types := cls.filter_active(
|
if occupant_types := cls.filter_all(
|
||||||
cls.occupant_is_unique == True, cls.occupant_category_type == "MT"
|
cls.occupant_is_unique == True, cls.occupant_category_type == "MT"
|
||||||
).data:
|
).data:
|
||||||
return [occupant.uu_id.__str__() for occupant in occupant_types]
|
return [occupant.uu_id.__str__() for occupant in occupant_types]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ duties_route.include_router(duties_route, include_in_schema=True)
|
||||||
@duties_route.post(path="/list", summary="List Active/Delete/Confirm Duties")
|
@duties_route.post(path="/list", summary="List Active/Delete/Confirm Duties")
|
||||||
def company_duties_list(request: Request, list_options: ListOptions):
|
def company_duties_list(request: Request, list_options: ListOptions):
|
||||||
token_dict = parse_token_object_to_dict(request=request)
|
token_dict = parse_token_object_to_dict(request=request)
|
||||||
return token_dict.available_event(data=list_options, token_dict=token_dict)
|
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
|
||||||
|
|
||||||
|
|
||||||
@duties_route.post(path="/get_by_duty_uuid", summary="Get Single Duty by Duty UUID")
|
@duties_route.post(path="/get_by_duty_uuid", summary="Get Single Duty by Duty UUID")
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ employee_route.include_router(employee_route, include_in_schema=True)
|
||||||
@employee_route.post(path="/list", summary="List Active/Delete/Confirm Staff")
|
@employee_route.post(path="/list", summary="List Active/Delete/Confirm Staff")
|
||||||
def company_employee_list(request: Request, list_options: ListOptions):
|
def company_employee_list(request: Request, list_options: ListOptions):
|
||||||
token_dict = parse_token_object_to_dict(request=request)
|
token_dict = parse_token_object_to_dict(request=request)
|
||||||
return token_dict.available_event(data=list_options, token_dict=token_dict)
|
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
|
||||||
|
|
||||||
|
|
||||||
@employee_route.post(path="/create", summary="Create Employee with given auth levels")
|
@employee_route.post(path="/create", summary="Create Employee with given auth levels")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue