orm get dict and id columns mappers updated
This commit is contained in:
parent
df5927e5ac
commit
e7a9b8c313
|
|
@ -23,8 +23,10 @@ from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObj
|
||||||
class AddressListEventMethods(MethodToEvent):
|
class AddressListEventMethods(MethodToEvent):
|
||||||
|
|
||||||
event_type = "SELECT"
|
event_type = "SELECT"
|
||||||
|
event_description = "List Address records"
|
||||||
|
event_category = "Address"
|
||||||
__event_keys__ = {
|
__event_keys__ = {
|
||||||
"9c251d7d-da70-4d63-a72c-e69c26270442": "address_list_super_user", # 1
|
"9c251d7d-da70-4d63-a72c-e69c26270442": "address_list_super_user",
|
||||||
"52afe375-dd95-4f4b-aaa2-4ec61bc6de52": "address_list_employee",
|
"52afe375-dd95-4f4b-aaa2-4ec61bc6de52": "address_list_employee",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,7 +34,7 @@ class AddressListEventMethods(MethodToEvent):
|
||||||
def address_list_super_user(cls, list_options: ListOptions, token_dict):
|
def address_list_super_user(cls, list_options: ListOptions, token_dict):
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
|
||||||
post_code_list = RelationshipEmployee2PostCode.filter_active(
|
post_code_list = RelationshipEmployee2PostCode.filter_all(
|
||||||
RelationshipEmployee2PostCode.company_id
|
RelationshipEmployee2PostCode.company_id
|
||||||
== token_dict.selected_company.company_id,
|
== token_dict.selected_company.company_id,
|
||||||
).data
|
).data
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,6 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
part_key = str(build_part_single.due_part_key).upper()
|
part_key = str(build_part_single.due_part_key).upper()
|
||||||
if part_key not in payment_return_dict:
|
if part_key not in payment_return_dict:
|
||||||
payment_return_dict[part_key] = payment_amount
|
payment_return_dict[part_key] = payment_amount
|
||||||
|
|
||||||
return payment_return_dict
|
return payment_return_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,103 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
|
from databases import (
|
||||||
|
Build,
|
||||||
|
BuildParts,
|
||||||
|
BuildDecisionBook,
|
||||||
|
BuildDecisionBookItems,
|
||||||
|
|
||||||
|
BuildDecisionBookPerson,
|
||||||
|
BuildDecisionBookPayments,
|
||||||
|
BuildDecisionBookProjects,
|
||||||
|
BuildDecisionBookProjectPerson,
|
||||||
|
ApiEnumDropdown,
|
||||||
|
OccupantTypes,
|
||||||
|
Companies,
|
||||||
|
BuildLivingSpace,
|
||||||
|
)
|
||||||
|
|
||||||
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 api_validations.core_response import AlchemyJsonResponse
|
||||||
|
from api_library.date_time_actions.date_functions import system_arrow, client_arrow
|
||||||
|
|
||||||
|
class DecisionBookDecisionBookItemsDebitsListEventMethods(MethodToEvent):
|
||||||
|
|
||||||
|
event_type = "SELECT"
|
||||||
|
__event_keys__ = {
|
||||||
|
"a1d2b1f6-9b8d-4f6b-8f4d-6b1f6a9d8b1a": "decision_book_decision_book_items_debits_list",
|
||||||
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def decision_book_decision_book_items_debits_list(
|
||||||
|
cls,
|
||||||
|
decision_book_id: str,
|
||||||
|
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
|
):
|
||||||
|
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_active(
|
||||||
|
BuildDecisionBookItems.decision_book_id == decision_book_id
|
||||||
|
).query
|
||||||
|
BuildDecisionBookItems.filter_attr = None
|
||||||
|
records = BuildDecisionBookItems.filter_active(
|
||||||
|
BuildDecisionBookItems.decision_book_id == decision_book_id
|
||||||
|
)
|
||||||
|
return AlchemyJsonResponse(
|
||||||
|
completed=True,
|
||||||
|
message="Decision Book Items Debits are listed",
|
||||||
|
result=records,
|
||||||
|
)
|
||||||
|
|
||||||
|
class DecisionBookDecisionBookItemsDebitsCreateEventMethods(MethodToEvent):
|
||||||
|
|
||||||
|
event_type = "CREATE"
|
||||||
|
__event_keys__ = {
|
||||||
|
"a1d2b1f6-9b8d-4f6b-8f4d-6b1f6a9d8b1a": "decision_book_decision_book_items_debits_create",
|
||||||
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def decision_book_decision_book_items_debits_create(
|
||||||
|
cls,
|
||||||
|
decision_book_id: str,
|
||||||
|
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
|
decision_book_items_debits: dict,
|
||||||
|
):
|
||||||
|
if isinstance(token_dict, EmployeeTokenObject):
|
||||||
|
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_406_NOT_ACCEPTABLE,
|
||||||
|
detail="No employee can reach this event. An notification is send to admin about event registration",
|
||||||
|
)
|
||||||
|
|
||||||
|
decision_book_items_debits["decision_book_id"] = decision_book_id
|
||||||
|
decision_book_items_debits["created_at"] = system_arrow().datetime
|
||||||
|
decision_book_items_debits["created_by"] = token_dict.employee_id
|
||||||
|
decision_book_items_debits["updated_at"] = system_arrow().datetime
|
||||||
|
decision_book_items_debits["updated_by"] = token_dict.employee_id
|
||||||
|
decision_book_items_debits["is_active"] = True
|
||||||
|
decision_book_items_debits["is_confirmed"] = False
|
||||||
|
decision_book_items_debits["is_deleted"] = False
|
||||||
|
decision_book_items_debits["confirmed_at"] = None
|
||||||
|
decision_book_items_debits["confirmed_by"] = None
|
||||||
|
decision_book_items_debits["deleted_at"] = None
|
||||||
|
decision_book_items_debits["deleted_by"] = None
|
||||||
|
decision_book_items_debits["confirmed_at"] = None
|
||||||
|
decision_book_items_debits["confirmed_by"] = None
|
||||||
|
decision_book_items_debits["deleted_at"] = None
|
||||||
|
decision_book_items_debits["deleted_by"] = None
|
||||||
|
decision_book_items_debits["confirmed_at"] = None
|
||||||
|
decision_book_items_debits["confirmed_by"] = None
|
||||||
|
decision_book_items_debits["deleted_at"] = None
|
||||||
|
decision_book_items_debits["deleted_by"] = None
|
||||||
|
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.filter_active(
|
||||||
|
BuildDecisionBookItems.decision_book_id == decision_book_id
|
||||||
|
).query
|
||||||
|
BuildDecisionBookItems.filter_attr = None
|
||||||
|
records = BuildDecisionBookItems.filter_active(
|
||||||
|
BuildDecisionBookItems.decision_book_id == decision_book_id
|
||||||
|
)
|
||||||
|
return AlchemyJsonResponse(
|
||||||
|
completed=True,
|
||||||
|
message="Decision Book Items Debits are listed",
|
||||||
|
result=records,
|
||||||
|
)
|
||||||
|
|
||||||
class DecisionBookDecisionBookItemsDebitsEvents(MethodToEvent): ...
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ class AlchemyJsonResponse:
|
||||||
message: str,
|
message: str,
|
||||||
status_code: str = 'HTTP_200_OK',
|
status_code: str = 'HTTP_200_OK',
|
||||||
result: Union[Any, list] = None,
|
result: Union[Any, list] = None,
|
||||||
completed: bool = True
|
completed: bool = True,
|
||||||
|
response_model: Any = None
|
||||||
):
|
):
|
||||||
cls.status_code = getattr(status, status_code, 'HTTP_200_OK')
|
cls.status_code = getattr(status, status_code, 'HTTP_200_OK')
|
||||||
cls.message = message
|
cls.message = message
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ class AccountBooks(CrudCollection):
|
||||||
country: Mapped[str] = mapped_column(String, nullable=False)
|
country: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
branch_type: Mapped[str] = mapped_column(SmallInteger, server_default="0")
|
branch_type: Mapped[str] = mapped_column(SmallInteger, server_default="0")
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(
|
company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
)
|
)
|
||||||
company_uu_id: Mapped[UUID] = mapped_column(String, nullable=False)
|
company_uu_id: Mapped[UUID] = mapped_column(String, nullable=False)
|
||||||
branch_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
branch_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
branch_uu_id: Mapped[UUID] = mapped_column(String, comment="Branch UU ID")
|
branch_uu_id: Mapped[UUID] = mapped_column(String, comment="Branch UU ID")
|
||||||
|
|
||||||
# company: Mapped["Companies"] = relationship(
|
# company: Mapped["Companies"] = relationship(
|
||||||
|
|
@ -68,7 +68,7 @@ class AccountCodes(CrudCollection):
|
||||||
)
|
)
|
||||||
|
|
||||||
is_receive_or_debit: Mapped[bool] = mapped_column(Boolean)
|
is_receive_or_debit: Mapped[bool] = mapped_column(Boolean)
|
||||||
product_id: Mapped[Identity] = mapped_column(Integer, server_default="0")
|
product_id: Mapped[int] = mapped_column(Integer, server_default="0")
|
||||||
nvi_id: Mapped[str] = mapped_column(String(48), server_default="")
|
nvi_id: Mapped[str] = mapped_column(String(48), server_default="")
|
||||||
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||||
account_code_seperator: Mapped[str] = mapped_column(String(1), server_default=".")
|
account_code_seperator: Mapped[str] = mapped_column(String(1), server_default=".")
|
||||||
|
|
@ -76,15 +76,15 @@ class AccountCodes(CrudCollection):
|
||||||
system_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
system_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||||
locked: Mapped[bool] = mapped_column(SmallInteger, server_default="0")
|
locked: Mapped[bool] = mapped_column(SmallInteger, server_default="0")
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
company_uu_id: Mapped[UUID] = mapped_column(
|
company_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Company UU ID"
|
String, nullable=False, comment="Company UU ID"
|
||||||
)
|
)
|
||||||
customer_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
customer_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
customer_uu_id: Mapped[UUID] = mapped_column(
|
customer_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Customer UU ID"
|
String, nullable=False, comment="Customer UU ID"
|
||||||
)
|
)
|
||||||
person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
person_uu_id: Mapped[UUID] = mapped_column(
|
person_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Person UU ID"
|
String, nullable=False, comment="Person UU ID"
|
||||||
)
|
)
|
||||||
|
|
@ -123,7 +123,7 @@ class AccountCodeParser(CrudCollection):
|
||||||
account_code_5: Mapped[str] = mapped_column(String, server_default="")
|
account_code_5: Mapped[str] = mapped_column(String, server_default="")
|
||||||
account_code_6: Mapped[str] = mapped_column(String, server_default="")
|
account_code_6: Mapped[str] = mapped_column(String, server_default="")
|
||||||
|
|
||||||
account_code_id: Mapped[Identity] = mapped_column(
|
account_code_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_codes.id"), nullable=False
|
ForeignKey("account_codes.id"), nullable=False
|
||||||
)
|
)
|
||||||
account_code_uu_id: Mapped[UUID] = mapped_column(
|
account_code_uu_id: Mapped[UUID] = mapped_column(
|
||||||
|
|
@ -201,19 +201,19 @@ class AccountMaster(CrudCollection):
|
||||||
data_center_id: Mapped[str] = mapped_column(String, server_default="")
|
data_center_id: Mapped[str] = mapped_column(String, server_default="")
|
||||||
data_center_rec_num: Mapped[int] = mapped_column(Integer, server_default="0")
|
data_center_rec_num: Mapped[int] = mapped_column(Integer, server_default="0")
|
||||||
|
|
||||||
account_header_id: Mapped[Identity] = mapped_column(
|
account_header_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_books.id"), nullable=False
|
ForeignKey("account_books.id"), nullable=False
|
||||||
)
|
)
|
||||||
account_header_uu_id: Mapped[UUID] = mapped_column(
|
account_header_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Account Header UU ID"
|
String, nullable=False, comment="Account Header UU ID"
|
||||||
)
|
)
|
||||||
project_item_id: Mapped[Identity] = mapped_column(
|
project_item_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_decision_book_projects.id")
|
ForeignKey("build_decision_book_projects.id")
|
||||||
)
|
)
|
||||||
project_item_uu_id: Mapped[UUID] = mapped_column(
|
project_item_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, comment="Project Item UU ID"
|
String, comment="Project Item UU ID"
|
||||||
)
|
)
|
||||||
department_id: Mapped[Identity] = mapped_column(ForeignKey("departments.id"))
|
department_id: Mapped[int] = mapped_column(ForeignKey("departments.id"))
|
||||||
department_uu_id: Mapped[UUID] = mapped_column(String, comment="Department UU ID")
|
department_uu_id: Mapped[UUID] = mapped_column(String, comment="Department UU ID")
|
||||||
|
|
||||||
# account_header: Mapped["AccountBooks"] = relationship(
|
# account_header: Mapped["AccountBooks"] = relationship(
|
||||||
|
|
@ -292,29 +292,29 @@ class AccountDetail(CrudCollection):
|
||||||
data_center_rec_num: Mapped[str] = mapped_column(Integer, server_default="0")
|
data_center_rec_num: Mapped[str] = mapped_column(Integer, server_default="0")
|
||||||
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||||
|
|
||||||
plug_type_id: Mapped[Identity] = mapped_column(
|
plug_type_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
plug_type_uu_id = mapped_column(String, nullable=False, comment="Plug Type UU ID")
|
plug_type_uu_id = mapped_column(String, nullable=False, comment="Plug Type UU ID")
|
||||||
account_header_id: Mapped[Identity] = mapped_column(
|
account_header_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_books.id"), nullable=False
|
ForeignKey("account_books.id"), nullable=False
|
||||||
)
|
)
|
||||||
account_header_uu_id: Mapped[UUID] = mapped_column(
|
account_header_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Account Header UU ID"
|
String, nullable=False, comment="Account Header UU ID"
|
||||||
)
|
)
|
||||||
account_code_id: Mapped[Identity] = mapped_column(
|
account_code_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_codes.id"), nullable=False
|
ForeignKey("account_codes.id"), nullable=False
|
||||||
)
|
)
|
||||||
account_code_uu_id: Mapped[UUID] = mapped_column(
|
account_code_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Account Code UU ID"
|
String, nullable=False, comment="Account Code UU ID"
|
||||||
)
|
)
|
||||||
account_master_id: Mapped[Identity] = mapped_column(
|
account_master_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_master.id"), nullable=False
|
ForeignKey("account_master.id"), nullable=False
|
||||||
)
|
)
|
||||||
account_master_uu_id: Mapped[UUID] = mapped_column(
|
account_master_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=False, comment="Account Master UU ID"
|
String, nullable=False, comment="Account Master UU ID"
|
||||||
)
|
)
|
||||||
project_id: Mapped[Identity] = mapped_column(
|
project_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_decision_book_projects.id")
|
ForeignKey("build_decision_book_projects.id")
|
||||||
)
|
)
|
||||||
project_uu_id: Mapped[UUID] = mapped_column(String, comment="Project UU ID")
|
project_uu_id: Mapped[UUID] = mapped_column(String, comment="Project UU ID")
|
||||||
|
|
@ -444,43 +444,43 @@ class AccountRecords(CrudCollection):
|
||||||
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||||
import_file_name = mapped_column(String, nullable=True, comment="XLS Key")
|
import_file_name = mapped_column(String, nullable=True, comment="XLS Key")
|
||||||
|
|
||||||
receive_debit: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"))
|
receive_debit: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"))
|
||||||
receive_debit_uu_id = mapped_column(String, nullable=True, comment="Debit UU ID")
|
receive_debit_uu_id = mapped_column(String, nullable=True, comment="Debit UU ID")
|
||||||
budget_type: Mapped[Identity] = mapped_column(
|
budget_type: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
budget_type_uu_id = mapped_column(
|
budget_type_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Budget Type UU ID"
|
String, nullable=True, comment="Budget Type UU ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
company_uu_id = mapped_column(String, nullable=True, comment="Company UU ID")
|
company_uu_id = mapped_column(String, nullable=True, comment="Company UU ID")
|
||||||
send_company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
send_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
send_company_uu_id = mapped_column(
|
send_company_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Send Company UU ID"
|
String, nullable=True, comment="Send Company UU ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
customer_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
customer_uu_id = mapped_column(String, nullable=True, comment="Customer UU ID")
|
customer_uu_id = mapped_column(String, nullable=True, comment="Customer UU ID")
|
||||||
send_person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
send_person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
send_person_uu_id = mapped_column(
|
send_person_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Send Person UU ID"
|
String, nullable=True, comment="Send Person UU ID"
|
||||||
)
|
)
|
||||||
approving_accounting_person: Mapped[Identity] = mapped_column(
|
approving_accounting_person: Mapped[int] = mapped_column(
|
||||||
ForeignKey("people.id")
|
ForeignKey("people.id")
|
||||||
)
|
)
|
||||||
approving_accounting_person_uu_id = mapped_column(
|
approving_accounting_person_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Approving Accounting Person UU ID"
|
String, nullable=True, comment="Approving Accounting Person UU ID"
|
||||||
)
|
)
|
||||||
# build_id: Mapped[Identity] = mapped_column(ForeignKey("build.id"), nullable=True)
|
# build_id: Mapped[int] = mapped_column(ForeignKey("build.id"), nullable=True)
|
||||||
build_parts_id: Mapped[Identity] = mapped_column(ForeignKey("build_parts.id"))
|
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"))
|
||||||
build_parts_uu_id = mapped_column(
|
build_parts_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=True, comment="Build Parts UU ID"
|
String, nullable=True, comment="Build Parts UU ID"
|
||||||
)
|
)
|
||||||
build_decision_book_id: Mapped[Identity] = mapped_column(
|
build_decision_book_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_decision_book.id")
|
ForeignKey("build_decision_book.id")
|
||||||
)
|
)
|
||||||
build_decision_book_uu_id = mapped_column(
|
build_decision_book_uu_id: Mapped[UUID] = mapped_column(
|
||||||
String, nullable=True, comment="Build Decision Book UU ID"
|
String, nullable=True, comment="Build Decision Book UU ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -537,7 +537,7 @@ class AccountRecords(CrudCollection):
|
||||||
"comment": "Bank Records that are related to building and financial transactions"
|
"comment": "Bank Records that are related to building and financial transactions"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
#
|
|
||||||
# def payment_budget_record_close(self):
|
# def payment_budget_record_close(self):
|
||||||
# from database_sql_models import (
|
# from database_sql_models import (
|
||||||
# DecisionBookProjectPaymentsMaster,
|
# DecisionBookProjectPaymentsMaster,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class BuildIbans(CrudCollection):
|
||||||
bank_code: Mapped[str] = mapped_column(String(24), server_default="TR0000000000000")
|
bank_code: Mapped[str] = mapped_column(String(24), server_default="TR0000000000000")
|
||||||
xcomment: Mapped[str] = mapped_column(String(64), server_default="????")
|
xcomment: Mapped[str] = mapped_column(String(64), server_default="????")
|
||||||
|
|
||||||
build_id: Mapped[Identity] = 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(
|
||||||
|
|
@ -67,21 +67,21 @@ class BuildIbanDescription(CrudCollection):
|
||||||
String, nullable=False, comment="Search Word", index=True
|
String, nullable=False, comment="Search Word", index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
decision_book_project_id: Mapped[Identity] = mapped_column(
|
decision_book_project_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_decision_book_projects.id")
|
ForeignKey("build_decision_book_projects.id")
|
||||||
)
|
)
|
||||||
decision_book_project_uu_id: Mapped[str] = mapped_column(
|
decision_book_project_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Decision Book Project UUID"
|
String, nullable=False, comment="Decision Book Project UUID"
|
||||||
)
|
)
|
||||||
customer_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
customer_uu_id: Mapped[str] = mapped_column(
|
customer_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Customer UUID"
|
String, nullable=False, comment="Customer UUID"
|
||||||
)
|
)
|
||||||
company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
company_uu_id: Mapped[str] = mapped_column(
|
company_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Company UUID"
|
String, nullable=False, comment="Company UUID"
|
||||||
)
|
)
|
||||||
build_parts_id: Mapped[Identity] = mapped_column(ForeignKey("build_parts.id"))
|
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"))
|
||||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Build Parts UUID"
|
String, nullable=False, comment="Build Parts UUID"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -150,10 +150,10 @@ class Part2Employee(CrudCollection):
|
||||||
__include__fields__ = []
|
__include__fields__ = []
|
||||||
|
|
||||||
build_id: Mapped[int] = mapped_column(Integer, comment="Building ID")
|
build_id: Mapped[int] = mapped_column(Integer, comment="Building ID")
|
||||||
part_id: Mapped[Identity] = mapped_column(
|
part_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_parts.id"), nullable=False, comment="Part ID"
|
ForeignKey("build_parts.id"), nullable=False, comment="Part ID"
|
||||||
)
|
)
|
||||||
employee_id: Mapped[Identity] = mapped_column(
|
employee_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("employees.id"), nullable=False, comment="Employee ID"
|
ForeignKey("employees.id"), nullable=False, comment="Employee ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -173,13 +173,13 @@ class RelationshipEmployee2Build(CrudCollection):
|
||||||
__tablename__ = "relationship_employee2build"
|
__tablename__ = "relationship_employee2build"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(
|
company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
) # 1, 2, 3
|
) # 1, 2, 3
|
||||||
employee_id: Mapped[Identity] = mapped_column(
|
employee_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("employees.id"), nullable=False
|
ForeignKey("employees.id"), nullable=False
|
||||||
) # employee -> (n)person Evyos LTD
|
) # employee -> (n)person Evyos LTD
|
||||||
member_id: Mapped[Identity] = mapped_column(
|
member_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build.id"), nullable=False
|
ForeignKey("build.id"), nullable=False
|
||||||
) # 2, 3, 4
|
) # 2, 3, 4
|
||||||
|
|
||||||
|
|
@ -255,9 +255,9 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||||
Integer, nullable=True, comment="Management Room ID"
|
Integer, nullable=True, comment="Management Room ID"
|
||||||
)
|
)
|
||||||
|
|
||||||
site_id: Mapped[Identity] = mapped_column(ForeignKey("build_sites.id"))
|
site_id: Mapped[int] = mapped_column(ForeignKey("build_sites.id"))
|
||||||
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[Identity] = 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_column(
|
||||||
ForeignKey("build_types.id"), nullable=False, comment="Building Type"
|
ForeignKey("build_types.id"), nullable=False, comment="Building Type"
|
||||||
|
|
@ -452,7 +452,7 @@ class BuildParts(CrudCollection):
|
||||||
build_uu_id: Mapped[str] = mapped_column(
|
build_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Building UUID"
|
String, nullable=False, comment="Building UUID"
|
||||||
)
|
)
|
||||||
part_direction_id: Mapped[Identity] = 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_column(
|
||||||
|
|
@ -672,7 +672,7 @@ class BuildArea(CrudCollection):
|
||||||
width = mapped_column(Integer, server_default="0")
|
width = mapped_column(Integer, server_default="0")
|
||||||
size = mapped_column(Integer, server_default="0")
|
size = mapped_column(Integer, server_default="0")
|
||||||
|
|
||||||
build_id: Mapped[Identity] = 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_column(String, comment="Building UUID")
|
||||||
part_type_id = mapped_column(
|
part_type_id = mapped_column(
|
||||||
ForeignKey("build_types.id"), nullable=True, comment="Building Part Type"
|
ForeignKey("build_types.id"), nullable=True, comment="Building Part Type"
|
||||||
|
|
@ -702,7 +702,7 @@ class BuildSites(CrudCollection):
|
||||||
site_name = mapped_column(String(24), nullable=False)
|
site_name = mapped_column(String(24), nullable=False)
|
||||||
site_no = mapped_column(String(8), nullable=False)
|
site_no = mapped_column(String(8), nullable=False)
|
||||||
|
|
||||||
address_id: Mapped[Identity] = 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_column(String, comment="Address UUID")
|
||||||
|
|
||||||
# addresses: Mapped["Address"] = relationship(
|
# addresses: Mapped["Address"] = relationship(
|
||||||
|
|
@ -729,9 +729,9 @@ class BuildCompaniesProviding(CrudCollection):
|
||||||
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_column(String, nullable=True, comment="Providing UUID")
|
||||||
company_id: Mapped[Identity] = 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_column(String, nullable=True, comment="Providing UUID")
|
||||||
provide_id: Mapped[Identity] = 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_column(String, nullable=True, comment="Providing UUID")
|
||||||
|
|
@ -760,9 +760,9 @@ class BuildPersonProviding(CrudCollection):
|
||||||
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_column(String, nullable=True, comment="Providing UUID")
|
||||||
people_id: Mapped[Identity] = 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_column(String, nullable=True, comment="People UUID")
|
||||||
provide_id: Mapped[Identity] = 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_column(String, nullable=True, comment="Providing UUID")
|
||||||
|
|
@ -836,9 +836,9 @@ class BuildPersonProviding(CrudCollection):
|
||||||
# life_people: Mapped["People"] = relationship(
|
# life_people: Mapped["People"] = relationship(
|
||||||
# "People", back_populates="life_living_spaces", foreign_keys=[life_person_id]
|
# "People", back_populates="life_living_spaces", foreign_keys=[life_person_id]
|
||||||
# )
|
# )
|
||||||
# company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
# company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
# response_company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
# response_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
# person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
# person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
|
|
||||||
# companies: Mapped["Companies"] = relationship(
|
# companies: Mapped["Companies"] = relationship(
|
||||||
# "Companies", back_populates="buildings", foreign_keys=[company_id]
|
# "Companies", back_populates="buildings", foreign_keys=[company_id]
|
||||||
|
|
|
||||||
|
|
@ -69,15 +69,15 @@ class BuildDecisionBook(CrudCollection):
|
||||||
TIMESTAMP, nullable=True, comment="Meeting Completed Date"
|
TIMESTAMP, nullable=True, comment="Meeting Completed Date"
|
||||||
)
|
)
|
||||||
|
|
||||||
build_id: Mapped[Identity] = mapped_column(ForeignKey("build.id"), nullable=False)
|
build_id: Mapped[int] = mapped_column(ForeignKey("build.id"), nullable=False)
|
||||||
build_uu_id: Mapped[str] = mapped_column(
|
build_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Build UUID"
|
String, nullable=True, comment="Build UUID"
|
||||||
)
|
)
|
||||||
resp_company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
resp_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||||
resp_company_uu_id: Mapped[str] = mapped_column(
|
resp_company_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Company UUID"
|
String, nullable=True, comment="Company UUID"
|
||||||
)
|
)
|
||||||
contact_id: Mapped[Identity] = mapped_column(
|
contact_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("contracts.id"), nullable=True, comment="Contract id"
|
ForeignKey("contracts.id"), nullable=True, comment="Contract id"
|
||||||
)
|
)
|
||||||
contact_uu_id: Mapped[str] = mapped_column(
|
contact_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -231,7 +231,7 @@ class BuildDecisionBookInvitations(CrudCollection):
|
||||||
build_uu_id: Mapped[str] = mapped_column(
|
build_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Build UUID"
|
String, nullable=True, comment="Build UUID"
|
||||||
)
|
)
|
||||||
decision_book_id: Mapped[Identity] = mapped_column(
|
decision_book_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_decision_book.id"), nullable=False
|
ForeignKey("build_decision_book.id"), nullable=False
|
||||||
)
|
)
|
||||||
decision_book_uu_id: Mapped[str] = mapped_column(
|
decision_book_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -367,7 +367,7 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||||
build_living_space_uu_id = mapped_column(
|
build_living_space_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Living Space UUID"
|
String, nullable=True, comment="Living Space UUID"
|
||||||
)
|
)
|
||||||
person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=False)
|
person_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||||
# person_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Person UUID")
|
# person_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Person UUID")
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|
@ -508,7 +508,7 @@ class BuildDecisionBookPersonOccupants(CrudCollection):
|
||||||
String, nullable=True, comment="Invite UUID"
|
String, nullable=True, comment="Invite UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
occupant_type_id: Mapped[Identity] = mapped_column(
|
occupant_type_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("occupant_types.id"), nullable=False
|
ForeignKey("occupant_types.id"), nullable=False
|
||||||
)
|
)
|
||||||
occupant_type_uu_id: Mapped[str] = mapped_column(
|
occupant_type_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -549,7 +549,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
Boolean, server_default="0", comment="Are payment Records Created"
|
Boolean, server_default="0", comment="Are payment Records Created"
|
||||||
)
|
)
|
||||||
|
|
||||||
info_type_id: Mapped[Identity] = mapped_column(
|
info_type_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
info_type_uu_id: Mapped[str] = mapped_column(
|
info_type_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -766,7 +766,7 @@ class BuildDecisionBookItemsUnapproved(CrudCollection):
|
||||||
decision_book_item_uu_id = mapped_column(
|
decision_book_item_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Decision Book Item"
|
String, nullable=True, comment="Decision Book Item"
|
||||||
)
|
)
|
||||||
person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=False)
|
person_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||||
person_uu_id: Mapped[str] = mapped_column(
|
person_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Person UUID"
|
String, nullable=True, comment="Person UUID"
|
||||||
)
|
)
|
||||||
|
|
@ -804,7 +804,7 @@ class BuildDecisionBookPayments(CrudCollection):
|
||||||
)
|
)
|
||||||
currency: Mapped[str] = mapped_column(String(8), server_default="TRY")
|
currency: Mapped[str] = mapped_column(String(8), server_default="TRY")
|
||||||
|
|
||||||
payment_types_id: Mapped[Identity] = mapped_column(
|
payment_types_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||||
)
|
)
|
||||||
payment_types_uu_id: Mapped[str] = mapped_column(
|
payment_types_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -832,24 +832,24 @@ class BuildDecisionBookPayments(CrudCollection):
|
||||||
String, nullable=True, comment="Decision Book Project UUID"
|
String, nullable=True, comment="Decision Book Project UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
build_parts_id: Mapped[Identity] = mapped_column(
|
build_parts_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_parts.id"), nullable=False
|
ForeignKey("build_parts.id"), nullable=False
|
||||||
)
|
)
|
||||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Build Part UUID"
|
String, nullable=True, comment="Build Part UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
budget_records_id: Mapped[Identity] = mapped_column(
|
budget_records_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("account_records.id")
|
ForeignKey("account_records.id")
|
||||||
)
|
)
|
||||||
budget_records_uu_id: Mapped[str] = mapped_column(
|
budget_records_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Budget UUID"
|
String, nullable=True, comment="Budget UUID"
|
||||||
)
|
)
|
||||||
accounting_id: Mapped[Identity] = mapped_column(ForeignKey("account_detail.id"))
|
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"))
|
||||||
accounting_uu_id: Mapped[str] = mapped_column(
|
accounting_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Accounting UUID"
|
String, nullable=True, comment="Accounting UUID"
|
||||||
)
|
)
|
||||||
# receive_debit_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
# receive_debit_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||||
# receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UUID")
|
# receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UUID")
|
||||||
|
|
||||||
# accounting: Mapped["AccountDetail"] = relationship(
|
# accounting: Mapped["AccountDetail"] = relationship(
|
||||||
|
|
@ -932,17 +932,17 @@ class BuildDecisionBookLegal(CrudCollection):
|
||||||
build_db_item_uu_id = mapped_column(
|
build_db_item_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Decision Book Item UUID"
|
String, nullable=True, comment="Decision Book Item UUID"
|
||||||
)
|
)
|
||||||
resp_attorney_id: Mapped[Identity] = mapped_column(
|
resp_attorney_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("people.id"), nullable=False
|
ForeignKey("people.id"), nullable=False
|
||||||
)
|
)
|
||||||
resp_attorney_uu_id = mapped_column(String, nullable=True, comment="Attorney UUID")
|
resp_attorney_uu_id = mapped_column(String, nullable=True, comment="Attorney UUID")
|
||||||
resp_attorney_company_id: Mapped[Identity] = mapped_column(
|
resp_attorney_company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id")
|
ForeignKey("companies.id")
|
||||||
)
|
)
|
||||||
resp_attorney_company_uu_id = mapped_column(
|
resp_attorney_company_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Company UUID"
|
String, nullable=True, comment="Company UUID"
|
||||||
)
|
)
|
||||||
mediator_lawyer_person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
mediator_lawyer_person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||||
mediator_lawyer_person_uu_id = mapped_column(
|
mediator_lawyer_person_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Mediator Lawyer UUID"
|
String, nullable=True, comment="Mediator Lawyer UUID"
|
||||||
)
|
)
|
||||||
|
|
@ -1014,7 +1014,7 @@ class BuildDecisionBookProjects(CrudCollection):
|
||||||
project_response_living_space_uu_id = mapped_column(
|
project_response_living_space_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Project Response Person UUID"
|
String, nullable=True, comment="Project Response Person UUID"
|
||||||
)
|
)
|
||||||
resp_company_id: Mapped[Identity] = mapped_column(
|
resp_company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=True
|
ForeignKey("companies.id"), nullable=True
|
||||||
)
|
)
|
||||||
resp_company_uu_id = mapped_column(String, nullable=True, comment="Company UUID")
|
resp_company_uu_id = mapped_column(String, nullable=True, comment="Company UUID")
|
||||||
|
|
@ -1119,7 +1119,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||||
build_decision_book_project_uu_id = mapped_column(
|
build_decision_book_project_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Decision Book Project UUID"
|
String, nullable=True, comment="Decision Book Project UUID"
|
||||||
)
|
)
|
||||||
living_space_id: Mapped[Identity] = mapped_column(
|
living_space_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("build_living_space.id"), nullable=False
|
ForeignKey("build_living_space.id"), nullable=False
|
||||||
)
|
)
|
||||||
living_space_uu_id = mapped_column(
|
living_space_uu_id = mapped_column(
|
||||||
|
|
@ -1155,7 +1155,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||||
# Numeric(20, 2), nullable=False, comment="Default Payment Amount"
|
# Numeric(20, 2), nullable=False, comment="Default Payment Amount"
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# dues_types_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
# dues_types_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||||
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
||||||
# build_decision_book_item_debits_id = mapped_column(
|
# build_decision_book_item_debits_id = mapped_column(
|
||||||
# ForeignKey("build_decision_book_item_debits.id"), nullable=False
|
# ForeignKey("build_decision_book_item_debits.id"), nullable=False
|
||||||
|
|
@ -1163,7 +1163,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||||
# build_decision_book_item_debits_uu_id = mapped_column(
|
# build_decision_book_item_debits_uu_id = mapped_column(
|
||||||
# String, nullable=True, comment="Decision Book Item Debit UUID"
|
# String, nullable=True, comment="Decision Book Item Debit UUID"
|
||||||
# )
|
# )
|
||||||
# build_parts_id: Mapped[Identity] = mapped_column(ForeignKey("build_parts.id"), nullable=False)
|
# build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"), nullable=False)
|
||||||
# build_parts_uu_id = mapped_column(String, nullable=True, comment="Build Part UUID")
|
# build_parts_uu_id = mapped_column(String, nullable=True, comment="Build Part UUID")
|
||||||
#
|
#
|
||||||
# # decision_books_item_debits: Mapped["BuildDecisionBookItemDebits"] = relationship(
|
# # decision_books_item_debits: Mapped["BuildDecisionBookItemDebits"] = relationship(
|
||||||
|
|
@ -1292,7 +1292,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||||
# __exclude__fields__ = []
|
# __exclude__fields__ = []
|
||||||
# __enum_list__ = [("dues_types", "BuildDuesTypes", "D")]
|
# __enum_list__ = [("dues_types", "BuildDuesTypes", "D")]
|
||||||
#
|
#
|
||||||
# dues_types_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
# dues_types_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||||
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
||||||
# # dues_values = mapped_column(
|
# # dues_values = mapped_column(
|
||||||
# # MutableDict.as_mutable(JSONB()),
|
# # MutableDict.as_mutable(JSONB()),
|
||||||
|
|
@ -1431,7 +1431,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||||
# process_date_w: Mapped[int] = mapped_column(SmallInteger)
|
# process_date_w: Mapped[int] = mapped_column(SmallInteger)
|
||||||
# period_time = mapped_column(String(12), server_default="")
|
# period_time = mapped_column(String(12), server_default="")
|
||||||
#
|
#
|
||||||
# build_decision_book_id: Mapped[Identity] = mapped_column(ForeignKey("build_decision_book.id"))
|
# build_decision_book_id: Mapped[int] = mapped_column(ForeignKey("build_decision_book.id"))
|
||||||
# accounting_id = mapped_column(ForeignKey("account_detail.id"))
|
# accounting_id = mapped_column(ForeignKey("account_detail.id"))
|
||||||
#
|
#
|
||||||
# __table_args__ = (
|
# __table_args__ = (
|
||||||
|
|
|
||||||
|
|
@ -36,17 +36,17 @@ class RelationshipDutyCompany(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
__access_by__ = RelationAccess.SuperAccessList
|
__access_by__ = RelationAccess.SuperAccessList
|
||||||
|
|
||||||
owner_id: Mapped[Identity] = mapped_column(
|
owner_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
) # 1
|
) # 1
|
||||||
duties_id: Mapped[Identity] = mapped_column(
|
duties_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("duties.id"), nullable=False
|
ForeignKey("duties.id"), nullable=False
|
||||||
) # duty -> (n)employee Evyos LTD
|
) # duty -> (n)employee Evyos LTD
|
||||||
|
|
||||||
member_id: Mapped[Identity] = mapped_column(
|
member_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
) # 2, 3, 4
|
) # 2, 3, 4
|
||||||
parent_id: Mapped[Identity] = mapped_column(
|
parent_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=True
|
ForeignKey("companies.id"), nullable=True
|
||||||
) # None
|
) # None
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ class Companies(CrudCollection, SelectAction):
|
||||||
parent_id = mapped_column(Integer, nullable=True)
|
parent_id = mapped_column(Integer, nullable=True)
|
||||||
workplace_no: Mapped[str] = mapped_column(String, nullable=True)
|
workplace_no: Mapped[str] = mapped_column(String, nullable=True)
|
||||||
|
|
||||||
official_address_id: Mapped[Identity] = mapped_column(ForeignKey("addresses.id"))
|
official_address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
||||||
official_address_uu_id = mapped_column(
|
official_address_uu_id = mapped_column(
|
||||||
String, nullable=True, comment="Official Address UUID"
|
String, nullable=True, comment="Official Address UUID"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Departments(CrudCollection):
|
||||||
)
|
)
|
||||||
department_description: Mapped[str] = mapped_column(String, server_default="")
|
department_description: Mapped[str] = mapped_column(String, server_default="")
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(
|
company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
)
|
)
|
||||||
company_uu_id: Mapped[str] = mapped_column(
|
company_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -70,7 +70,7 @@ class Duties(CrudCollection):
|
||||||
company_uu_id: Mapped[str] = mapped_column(
|
company_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Company UUID"
|
String, nullable=False, comment="Company UUID"
|
||||||
)
|
)
|
||||||
duties_id: Mapped[Identity] = mapped_column(ForeignKey("duty.id"), nullable=False)
|
duties_id: Mapped[int] = mapped_column(ForeignKey("duty.id"), nullable=False)
|
||||||
duties_uu_id: Mapped[str] = mapped_column(
|
duties_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Duty UUID"
|
String, nullable=False, comment="Duty UUID"
|
||||||
)
|
)
|
||||||
|
|
@ -80,7 +80,7 @@ class Duties(CrudCollection):
|
||||||
department_uu_id: Mapped[str] = mapped_column(
|
department_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Department UUID"
|
String, nullable=False, comment="Department UUID"
|
||||||
)
|
)
|
||||||
# priority_id: Mapped[Identity] = mapped_column(ForeignKey("priority.id"), nullable=True)
|
# priority_id: Mapped[int] = mapped_column(ForeignKey("priority.id"), nullable=True)
|
||||||
management_duty = mapped_column(
|
management_duty = mapped_column(
|
||||||
Boolean, server_default="0"
|
Boolean, server_default="0"
|
||||||
) # is this a prime Company Duty ???
|
) # is this a prime Company Duty ???
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class Staff(CrudCollection):
|
||||||
String, nullable=False, comment="Staff Code"
|
String, nullable=False, comment="Staff Code"
|
||||||
)
|
)
|
||||||
|
|
||||||
duties_id: Mapped[Identity] = mapped_column(ForeignKey("duties.id"), nullable=False)
|
duties_id: Mapped[int] = mapped_column(ForeignKey("duties.id"), nullable=False)
|
||||||
duties_uu_id: Mapped[str] = mapped_column(
|
duties_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Duty UUID"
|
String, nullable=False, comment="Duty UUID"
|
||||||
)
|
)
|
||||||
|
|
@ -63,11 +63,11 @@ class Employees(CrudCollection):
|
||||||
__tablename__ = "employees"
|
__tablename__ = "employees"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
staff_id: Mapped[Identity] = mapped_column(ForeignKey("staff.id"))
|
staff_id: Mapped[int] = mapped_column(ForeignKey("staff.id"))
|
||||||
staff_uu_id: Mapped[str] = mapped_column(
|
staff_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Staff UUID"
|
String, nullable=False, comment="Staff UUID"
|
||||||
)
|
)
|
||||||
people_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=True)
|
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
|
||||||
people_uu_id: Mapped[str] = mapped_column(
|
people_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="People UUID"
|
String, nullable=True, comment="People UUID"
|
||||||
)
|
)
|
||||||
|
|
@ -83,13 +83,13 @@ class EmployeeHistory(CrudCollection):
|
||||||
__tablename__ = "employee_history"
|
__tablename__ = "employee_history"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
staff_id: Mapped[Identity] = mapped_column(
|
staff_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("staff.id"), nullable=False, comment="Staff ID"
|
ForeignKey("staff.id"), nullable=False, comment="Staff ID"
|
||||||
)
|
)
|
||||||
staff_uu_id: Mapped[str] = mapped_column(
|
staff_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="Staff UUID"
|
String, nullable=False, comment="Staff UUID"
|
||||||
)
|
)
|
||||||
people_id: Mapped[Identity] = mapped_column(
|
people_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("people.id"), nullable=False, comment="People ID"
|
ForeignKey("people.id"), nullable=False, comment="People ID"
|
||||||
)
|
)
|
||||||
people_uu_id: Mapped[str] = mapped_column(
|
people_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -114,7 +114,7 @@ class EmployeesSalaries(CrudCollection):
|
||||||
Numeric(20, 6), nullable=False, comment="Net Salary"
|
Numeric(20, 6), nullable=False, comment="Net Salary"
|
||||||
)
|
)
|
||||||
|
|
||||||
people_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=False)
|
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||||
people_uu_id: Mapped[str] = mapped_column(
|
people_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=False, comment="People UUID"
|
String, nullable=False, comment="People UUID"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ from sqlalchemy_mixins.serialize import SerializeMixin
|
||||||
from sqlalchemy_mixins.repr import ReprMixin
|
from sqlalchemy_mixins.repr import ReprMixin
|
||||||
from sqlalchemy_mixins.smartquery import SmartQueryMixin
|
from sqlalchemy_mixins.smartquery import SmartQueryMixin
|
||||||
|
|
||||||
from api_library.date_time_actions.date_functions import DateTimeLocal
|
from api_library.date_time_actions.date_functions import DateTimeLocal, client_arrow
|
||||||
from api_objects.auth.token_objects import Credentials
|
from api_objects.auth.token_objects import Credentials
|
||||||
|
|
||||||
from databases.sql_models.sql_operations import FilterAttributes
|
from databases.sql_models.sql_operations import FilterAttributes
|
||||||
|
|
@ -133,19 +133,23 @@ class CrudMixin(Base, SmartQueryMixin, SessionMixin, FilterAttributes):
|
||||||
@classmethod
|
@classmethod
|
||||||
def iterate_over_variables(cls, val, key):
|
def iterate_over_variables(cls, val, key):
|
||||||
key_ = cls.__annotations__.get(key, None)
|
key_ = cls.__annotations__.get(key, None)
|
||||||
if val is None or key_ is None:
|
is_primary, is_foreign_key = key in cls.primary_keys and bool(getattr(cls, key).foreign_keys)
|
||||||
|
if is_primary or is_foreign_key and key_ == Mapped[int]:
|
||||||
return None
|
return None
|
||||||
elif key_ == Mapped[Identity]:
|
elif key_ == Mapped[UUID]:
|
||||||
return None
|
return str(val) if val else None
|
||||||
elif key_ == Mapped[bool]:
|
|
||||||
return bool(val)
|
|
||||||
elif key_ == Mapped[float] or key_ == Mapped[NUMERIC]:
|
|
||||||
return float(val)
|
|
||||||
elif key_ == Mapped[int]:
|
elif key_ == Mapped[int]:
|
||||||
return int(val)
|
return int(val) if val else None
|
||||||
|
elif key_ == Mapped[bool]:
|
||||||
|
return bool(val) if val else None
|
||||||
|
elif key_ == Mapped[float] or key_ == Mapped[NUMERIC]:
|
||||||
|
return float(val) if val else None
|
||||||
|
elif key_ == Mapped[int]:
|
||||||
|
return int(val) if val else None
|
||||||
elif key_ == Mapped[TIMESTAMP]:
|
elif key_ == Mapped[TIMESTAMP]:
|
||||||
return str(cls.client_arrow.get(val).format("DD-MM-YYYY HH:mm:ss"))
|
return str(client_arrow.get(val).format("DD-MM-YYYY HH:mm:ss")) if val else None
|
||||||
return str(val)
|
return str(val) if val else None
|
||||||
|
|
||||||
|
|
||||||
def update(self, **kwargs):
|
def update(self, **kwargs):
|
||||||
"""Updates the record with the given attributes."""
|
"""Updates the record with the given attributes."""
|
||||||
|
|
@ -227,7 +231,7 @@ class BaseCollection(CrudMixin, BaseMixin):
|
||||||
__abstract__ = True
|
__abstract__ = True
|
||||||
__repr__ = ReprMixin.__repr__
|
__repr__ = ReprMixin.__repr__
|
||||||
|
|
||||||
id: Mapped[Identity] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
class CrudCollection(CrudMixin, BaseMixin, SmartQueryMixin):
|
class CrudCollection(CrudMixin, BaseMixin, SmartQueryMixin):
|
||||||
|
|
@ -235,7 +239,7 @@ class CrudCollection(CrudMixin, BaseMixin, SmartQueryMixin):
|
||||||
__abstract__ = True
|
__abstract__ = True
|
||||||
__repr__ = ReprMixin.__repr__
|
__repr__ = ReprMixin.__repr__
|
||||||
|
|
||||||
id: Mapped[Identity] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
uu_id: Mapped[UUID] = mapped_column(
|
uu_id: Mapped[UUID] = mapped_column(
|
||||||
UUID, server_default=func.text("gen_random_uuid()"), index=True, unique=True
|
UUID, server_default=func.text("gen_random_uuid()"), index=True, unique=True
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class Events(CrudCollection):
|
||||||
cost: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
|
cost: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
|
||||||
unit_price: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
|
unit_price: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
|
||||||
|
|
||||||
endpoint_id: Mapped[Identity] = mapped_column(
|
endpoint_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("endpoint_restriction.id"), nullable=True
|
ForeignKey("endpoint_restriction.id"), nullable=True
|
||||||
)
|
)
|
||||||
endpoint_uu_id: Mapped[str] = mapped_column(
|
endpoint_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -92,7 +92,7 @@ class Services(CrudCollection):
|
||||||
__tablename__ = "services"
|
__tablename__ = "services"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
module_id: Mapped[Identity] = mapped_column(
|
module_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("modules.id"), nullable=False
|
ForeignKey("modules.id"), nullable=False
|
||||||
)
|
)
|
||||||
module_uu_id: Mapped[str] = mapped_column(
|
module_uu_id: Mapped[str] = mapped_column(
|
||||||
|
|
@ -118,11 +118,11 @@ class Service2Events(CrudCollection):
|
||||||
__tablename__ = "services2events"
|
__tablename__ = "services2events"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
service_id: Mapped[Identity] = mapped_column(
|
service_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("services.id"), nullable=False
|
ForeignKey("services.id"), nullable=False
|
||||||
)
|
)
|
||||||
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
|
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
|
||||||
event_id: Mapped[Identity] = mapped_column(ForeignKey("events.id"), nullable=False)
|
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), nullable=False)
|
||||||
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
||||||
|
|
||||||
__table_args__ = ({"comment": "Service2Events Information"},)
|
__table_args__ = ({"comment": "Service2Events Information"},)
|
||||||
|
|
@ -169,7 +169,7 @@ class Event2Occupant(CrudCollection):
|
||||||
build_living_space_uu_id = mapped_column(
|
build_living_space_uu_id = mapped_column(
|
||||||
String, nullable=False, comment="Build Living Space UUID"
|
String, nullable=False, comment="Build Living Space UUID"
|
||||||
)
|
)
|
||||||
event_id: Mapped[Identity] = mapped_column(ForeignKey("events.id"), nullable=False)
|
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), nullable=False)
|
||||||
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|
@ -205,15 +205,15 @@ class ModulePrice(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
campaign_code = mapped_column(String, nullable=False, comment="Campaign Code")
|
campaign_code = mapped_column(String, nullable=False, comment="Campaign Code")
|
||||||
module_id: Mapped[Identity] = mapped_column(
|
module_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("modules.id"), nullable=False
|
ForeignKey("modules.id"), nullable=False
|
||||||
)
|
)
|
||||||
module_uu_id = mapped_column(String, nullable=False, comment="Module UUID")
|
module_uu_id = mapped_column(String, nullable=False, comment="Module UUID")
|
||||||
service_id: Mapped[Identity] = mapped_column(
|
service_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("services.id"), nullable=False
|
ForeignKey("services.id"), nullable=False
|
||||||
)
|
)
|
||||||
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
|
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
|
||||||
event_id: Mapped[Identity] = mapped_column(ForeignKey("events.id"), nullable=False)
|
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), nullable=False)
|
||||||
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
event_uu_id = mapped_column(String, nullable=False, comment="Event UUID")
|
||||||
is_counted_percentage: Mapped[float] = mapped_column(
|
is_counted_percentage: Mapped[float] = mapped_column(
|
||||||
Numeric(6, 2), server_default="0.00"
|
Numeric(6, 2), server_default="0.00"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class UsersTokens(CrudCollection):
|
||||||
__tablename__ = "users_tokens"
|
__tablename__ = "users_tokens"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
user_id: Mapped[Identity] = mapped_column(ForeignKey("users.id"), nullable=False)
|
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False)
|
||||||
|
|
||||||
token_type: Mapped[str] = mapped_column(String(16), server_default="RememberMe")
|
token_type: Mapped[str] = mapped_column(String(16), server_default="RememberMe")
|
||||||
token: Mapped[str] = mapped_column(String, server_default="")
|
token: Mapped[str] = mapped_column(String, server_default="")
|
||||||
|
|
@ -267,13 +267,13 @@ class RelationshipDutyPeople(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
__access_by__ = RelationAccess.SuperAccessList
|
__access_by__ = RelationAccess.SuperAccessList
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(
|
company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=False
|
ForeignKey("companies.id"), nullable=False
|
||||||
) # 1, 2, 3
|
) # 1, 2, 3
|
||||||
duties_id = mapped_column(
|
duties_id = mapped_column(
|
||||||
ForeignKey("duties.id"), nullable=False
|
ForeignKey("duties.id"), nullable=False
|
||||||
) # duty -> (n)person Evyos LTD
|
) # duty -> (n)person Evyos LTD
|
||||||
member_id: Mapped[Identity] = mapped_column(
|
member_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("people.id"), nullable=False
|
ForeignKey("people.id"), nullable=False
|
||||||
) # 2, 3, 4
|
) # 2, 3, 4
|
||||||
|
|
||||||
|
|
@ -422,13 +422,13 @@ class RelationshipEmployee2PostCode(CrudCollection):
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
__include__fields__ = []
|
__include__fields__ = []
|
||||||
|
|
||||||
company_id: Mapped[Identity] = mapped_column(
|
company_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("companies.id"), nullable=True
|
ForeignKey("companies.id"), nullable=True
|
||||||
) # 1, 2, 3
|
) # 1, 2, 3
|
||||||
employee_id: Mapped[Identity] = mapped_column(
|
employee_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("employees.id"), nullable=False
|
ForeignKey("employees.id"), nullable=False
|
||||||
)
|
)
|
||||||
member_id: Mapped[Identity] = mapped_column(
|
member_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("address_postcode.id"), nullable=False
|
ForeignKey("address_postcode.id"), nullable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ class AddressPostcode(CrudCollection, SelectActionWithEmployee):
|
||||||
__access_by__ = []
|
__access_by__ = []
|
||||||
__many__table__ = RelationshipEmployee2PostCode
|
__many__table__ = RelationshipEmployee2PostCode
|
||||||
|
|
||||||
street_id: Mapped[Identity] = mapped_column(ForeignKey("address_street.id"))
|
street_id: Mapped[int] = mapped_column(ForeignKey("address_street.id"))
|
||||||
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
||||||
postcode = mapped_column(String(32), nullable=False, comment="Postcode")
|
postcode = mapped_column(String(32), nullable=False, comment="Postcode")
|
||||||
|
|
||||||
|
|
@ -465,18 +465,18 @@ class Addresses(CrudCollection):
|
||||||
__tablename__ = "addresses"
|
__tablename__ = "addresses"
|
||||||
__exclude__fields__ = []
|
__exclude__fields__ = []
|
||||||
|
|
||||||
build_number = mapped_column(String(24), nullable=False, comment="Build Number")
|
build_number: Mapped[str] = mapped_column(String(24), nullable=False, comment="Build Number")
|
||||||
door_number = mapped_column(String(24), nullable=True, comment="Door Number")
|
door_number: Mapped[str] = mapped_column(String(24), nullable=True, comment="Door Number")
|
||||||
floor_number = mapped_column(String(24), nullable=True, comment="Floor Number")
|
floor_number: Mapped[str] = mapped_column(String(24), nullable=True, comment="Floor Number")
|
||||||
|
|
||||||
comment_address = mapped_column(String, nullable=False, comment="Address")
|
comment_address: Mapped[str] = mapped_column(String, nullable=False, comment="Address")
|
||||||
letter_address = mapped_column(String, nullable=False, comment="Address")
|
letter_address: Mapped[str] = mapped_column(String, nullable=False, comment="Address")
|
||||||
short_letter_address = mapped_column(String, nullable=False, comment="Address")
|
short_letter_address: Mapped[str] = mapped_column(String, nullable=False, comment="Address")
|
||||||
|
|
||||||
latitude: Mapped[float] = mapped_column(Numeric(20, 12), server_default="0")
|
latitude: Mapped[float] = mapped_column(Numeric(20, 12), server_default="0")
|
||||||
longitude: Mapped[float] = mapped_column(Numeric(20, 12), server_default="0")
|
longitude: Mapped[float] = mapped_column(Numeric(20, 12), server_default="0")
|
||||||
|
|
||||||
street_id: Mapped[Identity] = mapped_column(
|
street_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey("address_street.id"), nullable=False
|
ForeignKey("address_street.id"), nullable=False
|
||||||
)
|
)
|
||||||
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
||||||
|
|
@ -625,7 +625,7 @@ class AddressState(CrudCollection):
|
||||||
BigInteger, nullable=True, comment="Address Geographic Id"
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
||||||
)
|
)
|
||||||
|
|
||||||
country_id: Mapped[Identity] = mapped_column(ForeignKey("address_country.id"))
|
country_id: Mapped[int] = mapped_column(ForeignKey("address_country.id"))
|
||||||
country_uu_id = mapped_column(String, server_default="", comment="Country UUID")
|
country_uu_id = mapped_column(String, server_default="", comment="Country UUID")
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|
@ -656,7 +656,7 @@ class AddressCity(CrudCollection):
|
||||||
BigInteger, nullable=True, comment="Address Geographic Id"
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
||||||
)
|
)
|
||||||
|
|
||||||
state_id: Mapped[Identity] = mapped_column(ForeignKey("address_state.id"))
|
state_id: Mapped[int] = mapped_column(ForeignKey("address_state.id"))
|
||||||
state_uu_id = mapped_column(String, server_default="", comment="State UUID")
|
state_uu_id = mapped_column(String, server_default="", comment="State UUID")
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class ApiEnumDropdown(BaseCollection):
|
||||||
__tablename__ = "api_enum_dropdown"
|
__tablename__ = "api_enum_dropdown"
|
||||||
__exclude__fields__ = ["enum_class"]
|
__exclude__fields__ = ["enum_class"]
|
||||||
|
|
||||||
id: Mapped[Identity] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
uu_id: Mapped[UUID] = mapped_column(
|
uu_id: Mapped[UUID] = mapped_column(
|
||||||
UUID, server_default=text("gen_random_uuid()"), index=True, unique=True
|
UUID, server_default=text("gen_random_uuid()"), index=True, unique=True
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue