services are checked
This commit is contained in:
@@ -8,11 +8,13 @@ from databases.sql_models.core_mixin import CrudCollection
|
||||
from databases import (
|
||||
Build,
|
||||
BuildLivingSpace,
|
||||
BuildIbans,
|
||||
People,
|
||||
BuildParts,
|
||||
Companies,
|
||||
OccupantTypes,
|
||||
Services,
|
||||
)
|
||||
from api_library.date_time_actions.date_functions import DateTimeLocal
|
||||
from api_library.date_time_actions.date_functions import system_arrow, client_arrow
|
||||
|
||||
from sqlalchemy import (
|
||||
String,
|
||||
@@ -24,10 +26,11 @@ from sqlalchemy import (
|
||||
Text,
|
||||
Numeric,
|
||||
Integer,
|
||||
Identity,
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, Mapped, relationship
|
||||
|
||||
from validations import (
|
||||
from api_validations.validations_request import (
|
||||
InsertDecisionBook,
|
||||
InsertBuildDecisionBookItems,
|
||||
InsertBuildDecisionBookItemDebits,
|
||||
@@ -52,24 +55,34 @@ class BuildDecisionBook(CrudCollection):
|
||||
__tablename__ = "build_decision_book"
|
||||
__exclude__fields__ = []
|
||||
|
||||
decision_book_pdf_path = mapped_column(String)
|
||||
resp_company_fix_wage = mapped_column(Numeric(10, 2), server_default="0") #
|
||||
is_out_sourced = mapped_column(Boolean, server_default="0")
|
||||
contact_id = mapped_column(ForeignKey("contracts.id"), nullable=True, comment="Contract id")
|
||||
contact_uu_id = mapped_column(String, nullable=True, comment="Contract UUID")
|
||||
meeting_date = mapped_column(TIMESTAMP, server_default="1900-01-01")
|
||||
decision_type = mapped_column(String(3), server_default="RBM")
|
||||
|
||||
|
||||
meeting_is_completed = mapped_column(Boolean, server_default="0")
|
||||
meeting_completed_date = mapped_column(
|
||||
decision_book_pdf_path: Mapped[str] = mapped_column(String)
|
||||
resp_company_fix_wage: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), server_default="0"
|
||||
) #
|
||||
is_out_sourced: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
meeting_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01"
|
||||
)
|
||||
decision_type: Mapped[str] = mapped_column(String(3), server_default="RBM")
|
||||
meeting_is_completed: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
meeting_completed_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, nullable=True, comment="Meeting Completed Date"
|
||||
)
|
||||
|
||||
build_id = mapped_column(ForeignKey("build.id"), nullable=False)
|
||||
build_uu_id = mapped_column(String, nullable=True, comment="Build UUID")
|
||||
resp_company_id = mapped_column(ForeignKey("companies.id"))
|
||||
resp_company_uu_id = mapped_column(String, nullable=True, comment="Company UUID")
|
||||
build_id: Mapped[Identity] = mapped_column(ForeignKey("build.id"), nullable=False)
|
||||
build_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build UUID"
|
||||
)
|
||||
resp_company_id: Mapped[Identity] = mapped_column(ForeignKey("companies.id"))
|
||||
resp_company_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Company UUID"
|
||||
)
|
||||
contact_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("contracts.id"), nullable=True, comment="Contract id"
|
||||
)
|
||||
contact_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Contract UUID"
|
||||
)
|
||||
|
||||
buildings: Mapped["Build"] = relationship(
|
||||
"Build",
|
||||
@@ -93,11 +106,11 @@ class BuildDecisionBook(CrudCollection):
|
||||
@classmethod
|
||||
def retrieve_active_rbm(cls):
|
||||
related_build = Build.find_one(id=cls.build_id)
|
||||
related_date = DateTimeLocal.get(str(related_build.build_date))
|
||||
related_date = system_arrow.get(related_build.build_date)
|
||||
date_processed = related_date.replace(
|
||||
year=DateTimeLocal.now().date().year, month=related_date.month, day=1
|
||||
year=system_arrow.now().date().year, month=related_date.month, day=1
|
||||
)
|
||||
if DateTimeLocal.now().date() <= date_processed:
|
||||
if system_arrow.now().date() <= date_processed:
|
||||
book = cls.filter_active(
|
||||
cls.expiry_ends <= date_processed,
|
||||
cls.decision_type == "RBM",
|
||||
@@ -111,7 +124,6 @@ class BuildDecisionBook(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def select_action(cls, duty_id, token=None):
|
||||
from database_sql_models import Companies
|
||||
|
||||
related_companies = Companies.select_action(duty_id=duty_id)
|
||||
related_companies_ids = list(
|
||||
@@ -123,7 +135,6 @@ class BuildDecisionBook(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertDecisionBook, token=None):
|
||||
from database_sql_models import Build, Companies
|
||||
|
||||
data_dict = data.model_dump()
|
||||
if building := Build.find_one(uu_id=data.build_uu_id):
|
||||
@@ -137,25 +148,33 @@ class BuildDecisionBook(CrudCollection):
|
||||
status_code=status.HTTP_406_NOT_ACCEPTABLE,
|
||||
detail="Building must be given to create decision book.",
|
||||
)
|
||||
expiry_starts = datetime.strptime(
|
||||
str(data_dict.get("expiry_starts")), "%Y-%m-%d"
|
||||
expiry_starts = system_arrow.get(str(data_dict.get("expiry_starts"))).format(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
expiry_ends = datetime.strptime(str(data_dict.get("expiry_ends")), "%Y-%m-%d")
|
||||
data_dict["expiry_ends"] = expiry_ends.replace(
|
||||
month=expiry_ends.month + 1, day=1
|
||||
) - timedelta(days=1)
|
||||
decision_book = BuildDecisionBook.filter_active(
|
||||
data_dict["expiry_starts"] = str(expiry_starts)
|
||||
expiry_ends = system_arrow.get(str(data_dict.get("expiry_ends"))).format(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
data_dict["expiry_ends"] = str(
|
||||
expiry_ends.replace(month=expiry_ends.month + 1, day=1) - timedelta(days=1)
|
||||
)
|
||||
|
||||
if decision_book := BuildDecisionBook.filter_all(
|
||||
BuildDecisionBook.build_id == building.id,
|
||||
BuildDecisionBook.expiry_ends > data_dict["expiry_starts"],
|
||||
BuildDecisionBook.decision_type == data_dict.get("decision_type"),
|
||||
) # Decision book is already exist
|
||||
if decision_book.count:
|
||||
return
|
||||
).count: # Decision book is already exist:
|
||||
cls.raise_http_exception(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
error_case="RECORDEXITS",
|
||||
message="Decision Book is already exist.",
|
||||
data=decision_book.get_dict(),
|
||||
)
|
||||
|
||||
data_dict["expiry_starts"] = expiry_starts.replace(day=1)
|
||||
data_dict["expiry_ends"] = expiry_ends.replace(
|
||||
month=expiry_ends.month + 1, day=1
|
||||
) - timedelta(days=1)
|
||||
data_dict["expiry_starts"] = str(expiry_starts.replace(day=1))
|
||||
data_dict["expiry_ends"] = str(
|
||||
expiry_ends.replace(month=expiry_ends.month + 1, day=1) - timedelta(days=1)
|
||||
)
|
||||
del data_dict["build_uu_id"], data_dict["resp_company_uu_id"]
|
||||
return cls.find_or_create(**data_dict)
|
||||
|
||||
@@ -174,13 +193,15 @@ class BuildDecisionBook(CrudCollection):
|
||||
[True if letter in str(bank_date) else False for letter in ["-", " ", ":"]]
|
||||
):
|
||||
bank_date = datetime.strptime(str(bank_date), "%Y-%m-%d %H:%M:%S")
|
||||
date_valid = self.expiry_starts < bank_date < self.expiry_ends
|
||||
date_valid = (
|
||||
system_arrow.get(self.expiry_starts)
|
||||
< system_arrow.get(bank_date)
|
||||
< system_arrow.get(self.expiry_ends)
|
||||
)
|
||||
return date_valid and self.active and not self.deleted
|
||||
|
||||
@classmethod
|
||||
def retrieve_valid_book(cls, bank_date, iban):
|
||||
from database_sql_models import BuildIbans
|
||||
|
||||
if all(
|
||||
[True if letter in str(bank_date) else False for letter in ["-", " ", ":"]]
|
||||
):
|
||||
@@ -206,19 +227,25 @@ class BuildDecisionBookInvitations(CrudCollection):
|
||||
__tablename__ = "build_decision_book_invitations"
|
||||
__exclude__fields__ = []
|
||||
|
||||
build_id = mapped_column(Integer, nullable=False)
|
||||
build_uu_id = mapped_column(String, nullable=True, comment="Build UUID")
|
||||
decision_book_id = mapped_column(
|
||||
build_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
build_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build UUID"
|
||||
)
|
||||
decision_book_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=False
|
||||
)
|
||||
decision_book_uu_id = mapped_column(
|
||||
decision_book_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Decision Book UUID"
|
||||
)
|
||||
|
||||
invitation_type = mapped_column(String, nullable=False, comment="Invite Type")
|
||||
invitation_attempt = mapped_column(SmallInteger, server_default="1")
|
||||
living_part_count = mapped_column(SmallInteger, server_default="1")
|
||||
living_part_percentage = mapped_column(Numeric(10, 2), server_default="0.51")
|
||||
invitation_type: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Invite Type"
|
||||
)
|
||||
invitation_attempt: Mapped[int] = mapped_column(SmallInteger, server_default="1")
|
||||
living_part_count: Mapped[int] = mapped_column(SmallInteger, server_default="1")
|
||||
living_part_percentage: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), server_default="0.51"
|
||||
)
|
||||
|
||||
message = mapped_column(Text, nullable=True, comment="Invitation Message")
|
||||
planned_date = mapped_column(
|
||||
@@ -299,7 +326,7 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
__enum_list__ = [("management_typecode", "BuildManagementType", "bm")]
|
||||
|
||||
dues_percent_discount = mapped_column(SmallInteger, server_default="0")
|
||||
dues_fix_discount = mapped_column(Numeric(10, 2), server_default="0")
|
||||
dues_fix_discount: Mapped[float] = mapped_column(Numeric(10, 2), server_default="0")
|
||||
dues_discount_approval_date = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01 00:00:00"
|
||||
)
|
||||
@@ -310,7 +337,9 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
confirmed_date = mapped_column(
|
||||
TIMESTAMP, nullable=True, comment="Confirmation Date"
|
||||
)
|
||||
token = mapped_column(String, server_default="", comment="Invitation Token")
|
||||
token: Mapped[str] = mapped_column(
|
||||
String, server_default="", comment="Invitation Token"
|
||||
)
|
||||
|
||||
vicarious_person_id = mapped_column(
|
||||
ForeignKey("people.id"), nullable=True, comment="Vicarious Person ID"
|
||||
@@ -322,7 +351,9 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
invite_id = mapped_column(
|
||||
ForeignKey("build_decision_book_invitations.id"), nullable=False
|
||||
)
|
||||
invite_uu_id = mapped_column(String, nullable=False, comment="Invite UUID")
|
||||
invite_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Invite UUID"
|
||||
)
|
||||
|
||||
build_decision_book_id = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=False
|
||||
@@ -336,8 +367,8 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
build_living_space_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Living Space UUID"
|
||||
)
|
||||
person_id = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
# person_uu_id = mapped_column(String, nullable=False, comment="Person UUID")
|
||||
person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
# person_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Person UUID")
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
@@ -359,8 +390,9 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
return BuildDecisionBookPersonOccupants.filter_active(filter_records=False)
|
||||
|
||||
def add_occupant_type(self, occupant_type, build_living_space_id: int = None):
|
||||
from database_sql_models import Services
|
||||
from events.events_bind_services import ServiceBindOccupantEventMethods
|
||||
from api_events.events.events.events_bind_services import (
|
||||
ServiceBindOccupantEventMethods,
|
||||
)
|
||||
|
||||
book_dict = dict(
|
||||
build_decision_book_person_id=self.id,
|
||||
@@ -413,10 +445,10 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
occupant_type_uu_id=str(occupant_type.uu_id),
|
||||
person_id=living_space.person_id,
|
||||
person_uu_id=str(living_space.person_uu_id),
|
||||
expiry_starts=DateTimeLocal.get(
|
||||
expiry_starts=system_arrow.get(
|
||||
decision_book.meeting_date
|
||||
).__str__(),
|
||||
expiry_ends=DateTimeLocal.get(decision_book.meeting_date)
|
||||
expiry_ends=system_arrow.get(decision_book.meeting_date)
|
||||
.shift(hours=23)
|
||||
.__str__(),
|
||||
is_confirmed=True,
|
||||
@@ -426,9 +458,7 @@ class BuildDecisionBookPerson(CrudCollection):
|
||||
build_living_space_id=related_living_space.id,
|
||||
service_id=related_service.id,
|
||||
expires_at=str(
|
||||
DateTimeLocal.get(decision_book.meeting_date).shift(
|
||||
days=15
|
||||
)
|
||||
system_arrow.get(decision_book.meeting_date).shift(days=15)
|
||||
),
|
||||
)
|
||||
return person_occupants
|
||||
@@ -474,10 +504,16 @@ class BuildDecisionBookPersonOccupants(CrudCollection):
|
||||
invite_id = mapped_column(
|
||||
ForeignKey("build_decision_book_invitations.id"), nullable=True
|
||||
)
|
||||
invite_uu_id = mapped_column(String, nullable=True, comment="Invite UUID")
|
||||
invite_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Invite UUID"
|
||||
)
|
||||
|
||||
occupant_type_id = mapped_column(ForeignKey("occupant_types.id"), nullable=False)
|
||||
occupant_type_uu_id = mapped_column(String, nullable=True, comment="Occupant UUID")
|
||||
occupant_type_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("occupant_types.id"), nullable=False
|
||||
)
|
||||
occupant_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Occupant UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
@@ -513,8 +549,12 @@ class BuildDecisionBookItems(CrudCollection):
|
||||
Boolean, server_default="0", comment="Are payment Records Created"
|
||||
)
|
||||
|
||||
info_type_id = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
info_type_uu_id = mapped_column(String, nullable=True, comment="Info Type UUID")
|
||||
info_type_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
)
|
||||
info_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Info Type UUID"
|
||||
)
|
||||
|
||||
build_decision_book_id = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=False
|
||||
@@ -536,7 +576,6 @@ class BuildDecisionBookItems(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def select_action(cls, duty_id, token=None):
|
||||
from database_sql_models import Companies
|
||||
|
||||
related_companies = Companies.select_action(duty_id=duty_id)
|
||||
related_companies_ids = list(
|
||||
@@ -579,7 +618,6 @@ class BuildDecisionBookItems(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def check_meeting_is_valid_to_start_add_attendance(cls, decision_book, token_dict):
|
||||
from database_sql_models import OccupantTypes
|
||||
|
||||
active_invite = (
|
||||
BuildDecisionBookInvitations.check_invites_are_ready_for_meeting(
|
||||
@@ -728,8 +766,10 @@ class BuildDecisionBookItemsUnapproved(CrudCollection):
|
||||
decision_book_item_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Item"
|
||||
)
|
||||
person_id = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
person_uu_id = mapped_column(String, nullable=True, comment="Person UUID")
|
||||
person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
person_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Person UUID"
|
||||
)
|
||||
build_decision_book_item = mapped_column(
|
||||
ForeignKey("build_decision_book_items.id"), nullable=False
|
||||
)
|
||||
@@ -762,14 +802,18 @@ class BuildDecisionBookPayments(CrudCollection):
|
||||
payment_amount = mapped_column(
|
||||
Numeric(16, 2), nullable=False, comment="Payment Amount"
|
||||
)
|
||||
currency = mapped_column(String(8), server_default="TRY")
|
||||
currency: Mapped[str] = mapped_column(String(8), server_default="TRY")
|
||||
|
||||
payment_types_id = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
payment_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
||||
payment_types_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
)
|
||||
payment_types_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Dues Type UUID"
|
||||
)
|
||||
|
||||
period_time = mapped_column(String(12))
|
||||
process_date_y = mapped_column(SmallInteger)
|
||||
process_date_m = mapped_column(SmallInteger)
|
||||
period_time: Mapped[str] = mapped_column(String(12))
|
||||
process_date_y: Mapped[int] = mapped_column(SmallInteger)
|
||||
process_date_m: Mapped[int] = mapped_column(SmallInteger)
|
||||
|
||||
build_decision_book_item_id = mapped_column(
|
||||
ForeignKey("build_decision_book_items.id"),
|
||||
@@ -780,21 +824,33 @@ class BuildDecisionBookPayments(CrudCollection):
|
||||
String, nullable=True, comment="Decision Book Item UUID"
|
||||
)
|
||||
decision_book_project_id = mapped_column(
|
||||
ForeignKey("build_decision_book_projects.id"), nullable=True, comment="Decision Book Project ID"
|
||||
ForeignKey("build_decision_book_projects.id"),
|
||||
nullable=True,
|
||||
comment="Decision Book Project ID",
|
||||
)
|
||||
decision_book_project_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Project UUID"
|
||||
)
|
||||
|
||||
build_parts_id = mapped_column(ForeignKey("build_parts.id"), nullable=False)
|
||||
build_parts_uu_id = mapped_column(String, nullable=True, comment="Build Part UUID")
|
||||
build_parts_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("build_parts.id"), nullable=False
|
||||
)
|
||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Part UUID"
|
||||
)
|
||||
|
||||
budget_records_id = mapped_column(ForeignKey("account_records.id"))
|
||||
budget_records_uu_id = mapped_column(String, nullable=True, comment="Budget UUID")
|
||||
accounting_id = mapped_column(ForeignKey("account_detail.id"))
|
||||
accounting_uu_id = mapped_column(String, nullable=True, comment="Accounting UUID")
|
||||
# receive_debit_id = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# receive_debit_uu_id = mapped_column(String, nullable=True, comment="Debit UUID")
|
||||
budget_records_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("account_records.id")
|
||||
)
|
||||
budget_records_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Budget UUID"
|
||||
)
|
||||
accounting_id: Mapped[Identity] = mapped_column(ForeignKey("account_detail.id"))
|
||||
accounting_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Accounting UUID"
|
||||
)
|
||||
# receive_debit_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UUID")
|
||||
|
||||
# accounting: Mapped["AccountDetail"] = relationship(
|
||||
# "AccountDetail",
|
||||
@@ -851,8 +907,10 @@ class BuildDecisionBookLegal(CrudCollection):
|
||||
)
|
||||
|
||||
period_stop_date = mapped_column(TIMESTAMP, server_default="2099-12-31 23:59:59")
|
||||
decision_book_pdf_path = mapped_column(String(128))
|
||||
resp_company_total_wage = mapped_column(Numeric(10, 2), server_default="0")
|
||||
decision_book_pdf_path: Mapped[str] = mapped_column(String(128))
|
||||
resp_company_total_wage: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), server_default="0"
|
||||
)
|
||||
contact_agreement_path = mapped_column(String(128))
|
||||
contact_agreement_date = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01 00:00:00"
|
||||
@@ -861,12 +919,12 @@ class BuildDecisionBookLegal(CrudCollection):
|
||||
lawsuits_type = mapped_column(String(1), server_default="C")
|
||||
lawsuits_name = mapped_column(String(128))
|
||||
lawsuits_note = mapped_column(String(512))
|
||||
lawyer_cost = mapped_column(Numeric(20, 2))
|
||||
mediator_lawyer_cost = mapped_column(Numeric(20, 2))
|
||||
other_cost = mapped_column(Numeric(20, 2))
|
||||
legal_cost = mapped_column(Numeric(20, 2))
|
||||
approved_cost = mapped_column(Numeric(20, 2))
|
||||
total_price = mapped_column(Numeric(20, 2))
|
||||
lawyer_cost: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
mediator_lawyer_cost: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
other_cost: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
legal_cost: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
approved_cost: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
total_price: Mapped[float] = mapped_column(Numeric(20, 2))
|
||||
|
||||
build_db_item_id = mapped_column(
|
||||
ForeignKey("build_decision_book_items.id"), nullable=False
|
||||
@@ -874,13 +932,17 @@ class BuildDecisionBookLegal(CrudCollection):
|
||||
build_db_item_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Item UUID"
|
||||
)
|
||||
resp_attorney_id = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
resp_attorney_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("people.id"), nullable=False
|
||||
)
|
||||
resp_attorney_uu_id = mapped_column(String, nullable=True, comment="Attorney UUID")
|
||||
resp_attorney_company_id = mapped_column(ForeignKey("companies.id"))
|
||||
resp_attorney_company_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("companies.id")
|
||||
)
|
||||
resp_attorney_company_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Company UUID"
|
||||
)
|
||||
mediator_lawyer_person_id = mapped_column(ForeignKey("people.id"))
|
||||
mediator_lawyer_person_id: Mapped[Identity] = mapped_column(ForeignKey("people.id"))
|
||||
mediator_lawyer_person_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Mediator Lawyer UUID"
|
||||
)
|
||||
@@ -902,7 +964,9 @@ class BuildDecisionBookProjects(CrudCollection):
|
||||
__tablename__ = "build_decision_book_projects"
|
||||
__exclude__fields__ = []
|
||||
|
||||
project_no = mapped_column(String(12), nullable=True, comment="Project Number of Decision Book")
|
||||
project_no = mapped_column(
|
||||
String(12), nullable=True, comment="Project Number of Decision Book"
|
||||
)
|
||||
project_name = mapped_column(String, nullable=False, comment="Project Name")
|
||||
project_start_date = mapped_column(
|
||||
TIMESTAMP, nullable=False, comment="Project Start Date"
|
||||
@@ -914,33 +978,45 @@ class BuildDecisionBookProjects(CrudCollection):
|
||||
|
||||
decision_book_pdf_path = mapped_column(String)
|
||||
|
||||
resp_company_fix_wage = mapped_column(Numeric(10, 2), server_default="0")
|
||||
is_out_sourced = mapped_column(Boolean, server_default="0")
|
||||
contact_id = mapped_column(ForeignKey("contracts.id"), nullable=True, comment="Contract id")
|
||||
resp_company_fix_wage: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), server_default="0"
|
||||
)
|
||||
is_out_sourced: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
contact_id = mapped_column(
|
||||
ForeignKey("contracts.id"), nullable=True, comment="Contract id"
|
||||
)
|
||||
contact_uu_id = mapped_column(String, nullable=True, comment="Contract UUID")
|
||||
meeting_date = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01 00:00:00", index=True
|
||||
)
|
||||
currency = mapped_column(String(8), server_default="TRY")
|
||||
bid_price = mapped_column(Numeric(16, 4), server_default="0")
|
||||
approved_price = mapped_column(Numeric(16, 4), server_default="0")
|
||||
final_price = mapped_column(Numeric(16, 4), server_default="0")
|
||||
bid_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
approved_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
final_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
|
||||
build_decision_book_id = mapped_column(ForeignKey("build_decision_book.id"), nullable=False)
|
||||
build_decision_book_id = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=False
|
||||
)
|
||||
build_decision_book_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book UUID"
|
||||
)
|
||||
build_decision_book_item_id = mapped_column(ForeignKey("build_decision_book_items.id"), nullable=False)
|
||||
build_decision_book_item_id = mapped_column(
|
||||
ForeignKey("build_decision_book_items.id"), nullable=False
|
||||
)
|
||||
build_decision_book_item_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Item UUID"
|
||||
)
|
||||
project_response_living_space_id = mapped_column(
|
||||
ForeignKey("build_living_space.id"), nullable=True, comment="Project Response Person ID"
|
||||
ForeignKey("build_living_space.id"),
|
||||
nullable=True,
|
||||
comment="Project Response Person ID",
|
||||
)
|
||||
project_response_living_space_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Project Response Person UUID"
|
||||
)
|
||||
resp_company_id = mapped_column(ForeignKey("companies.id"), nullable=True)
|
||||
resp_company_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("companies.id"), nullable=True
|
||||
)
|
||||
resp_company_uu_id = mapped_column(String, nullable=True, comment="Company UUID")
|
||||
|
||||
build_decision_book_item: Mapped["BuildDecisionBookItems"] = relationship(
|
||||
@@ -951,11 +1027,6 @@ class BuildDecisionBookProjects(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def select_action(cls, duty_id, token=None):
|
||||
from database_sql_models import (
|
||||
Companies,
|
||||
BuildDecisionBook,
|
||||
BuildDecisionBookItems,
|
||||
)
|
||||
|
||||
related_companies = Companies.select_action(duty_id=duty_id)
|
||||
related_companies_ids = list(
|
||||
@@ -983,8 +1054,6 @@ class BuildDecisionBookProjects(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertBuildDecisionBookProjects, token=None):
|
||||
from database_sql_models import People, BuildDecisionBookItems, Companies
|
||||
|
||||
data_dict = data.dump()
|
||||
BuildDecisionBookItems.pre_query = BuildDecisionBookItems.select_action(
|
||||
duty_id=token.duty_list["duty_id"]
|
||||
@@ -1040,9 +1109,9 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
__enum_list__ = [("management_typecode", "ProjectTeamTypes", "PTT-EMP")]
|
||||
|
||||
dues_percent_discount = mapped_column(SmallInteger, server_default="0")
|
||||
job_fix_wage = mapped_column(Numeric(10, 2), server_default="0")
|
||||
bid_price = mapped_column(Numeric(10, 2), server_default="0")
|
||||
decision_price = mapped_column(Numeric(10, 2), server_default="0")
|
||||
job_fix_wage: Mapped[float] = mapped_column(Numeric(10, 2), server_default="0")
|
||||
bid_price: Mapped[float] = mapped_column(Numeric(10, 2), server_default="0")
|
||||
decision_price: Mapped[float] = mapped_column(Numeric(10, 2), server_default="0")
|
||||
|
||||
build_decision_book_project_id = mapped_column(
|
||||
ForeignKey("build_decision_book_projects.id"), nullable=False
|
||||
@@ -1050,8 +1119,12 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
build_decision_book_project_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Project UUID"
|
||||
)
|
||||
living_space_id = mapped_column(ForeignKey("build_living_space.id"), nullable=False)
|
||||
living_space_uu_id = mapped_column(String, nullable=True, comment="Living Space UUID")
|
||||
living_space_id: Mapped[Identity] = mapped_column(
|
||||
ForeignKey("build_living_space.id"), nullable=False
|
||||
)
|
||||
living_space_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Living Space UUID"
|
||||
)
|
||||
|
||||
project_team_type_id = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
@@ -1082,7 +1155,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
# Numeric(20, 2), nullable=False, comment="Default Payment Amount"
|
||||
# )
|
||||
#
|
||||
# dues_types_id = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# dues_types_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
||||
# build_decision_book_item_debits_id = mapped_column(
|
||||
# ForeignKey("build_decision_book_item_debits.id"), nullable=False
|
||||
@@ -1090,7 +1163,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
# build_decision_book_item_debits_uu_id = mapped_column(
|
||||
# String, nullable=True, comment="Decision Book Item Debit UUID"
|
||||
# )
|
||||
# build_parts_id = mapped_column(ForeignKey("build_parts.id"), nullable=False)
|
||||
# build_parts_id: Mapped[Identity] = mapped_column(ForeignKey("build_parts.id"), nullable=False)
|
||||
# build_parts_uu_id = mapped_column(String, nullable=True, comment="Build Part UUID")
|
||||
#
|
||||
# # decision_books_item_debits: Mapped["BuildDecisionBookItemDebits"] = relationship(
|
||||
@@ -1219,7 +1292,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
# __exclude__fields__ = []
|
||||
# __enum_list__ = [("dues_types", "BuildDuesTypes", "D")]
|
||||
#
|
||||
# dues_types_id = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# dues_types_id: Mapped[Identity] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# dues_types_uu_id = mapped_column(String, nullable=True, comment="Dues Type UUID")
|
||||
# # dues_values = mapped_column(
|
||||
# # MutableDict.as_mutable(JSONB()),
|
||||
@@ -1232,7 +1305,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
# flat_payment = mapped_column(
|
||||
# Numeric(20, 2), nullable=True, comment="Flat Payment Amount"
|
||||
# )
|
||||
# decision_taken = mapped_column(Boolean, server_default="0")
|
||||
# decision_taken: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
#
|
||||
# build_decision_book_item_id = mapped_column(
|
||||
# ForeignKey("build_decision_book_items.id"), nullable=False
|
||||
@@ -1350,15 +1423,15 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
#
|
||||
# item_order = mapped_column(SmallInteger, nullable=False, comment="Order Number")
|
||||
# budget_type = mapped_column(String, nullable=False, comment="Budget Type")
|
||||
# plan_value = mapped_column(Numeric(10, 2), nullable=False, comment="Plan Value")
|
||||
# plan_value: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False, comment="Plan Value")
|
||||
#
|
||||
# line_comment = mapped_column(String(32), server_default="")
|
||||
# process_date_y = mapped_column(SmallInteger)
|
||||
# process_date_m = mapped_column(SmallInteger)
|
||||
# process_date_w = mapped_column(SmallInteger)
|
||||
# process_date_y: Mapped[int] = mapped_column(SmallInteger)
|
||||
# process_date_m: Mapped[int] = mapped_column(SmallInteger)
|
||||
# process_date_w: Mapped[int] = mapped_column(SmallInteger)
|
||||
# period_time = mapped_column(String(12), server_default="")
|
||||
#
|
||||
# build_decision_book_id = mapped_column(ForeignKey("build_decision_book.id"))
|
||||
# build_decision_book_id: Mapped[Identity] = mapped_column(ForeignKey("build_decision_book.id"))
|
||||
# accounting_id = mapped_column(ForeignKey("account_detail.id"))
|
||||
#
|
||||
# __table_args__ = (
|
||||
@@ -1377,7 +1450,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
#
|
||||
# paid_date = mapped_column(TIMESTAMP, nullable=False, comment="Payment Due Date")
|
||||
# period_time = mapped_column(String(12), server_default="")
|
||||
# paid_value = mapped_column(Numeric(10, 2), server_default="0")
|
||||
# paid_value: Mapped[float] = mapped_column(Numeric(10, 2), server_default="0")
|
||||
#
|
||||
# build_decision_book_budget_id = mapped_column(
|
||||
# ForeignKey("build_decision_book_budget.id"), nullable=False
|
||||
@@ -1566,7 +1639,7 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
||||
# person_uu_id = mapped_column(String, nullable=False, comment="Person UUID")
|
||||
#
|
||||
# send_date = mapped_column(TIMESTAMP, nullable=False, comment="Confirmation Date")
|
||||
# is_confirmed = mapped_column(Boolean, server_default="0", comment="Message is Confirmed")
|
||||
# is_confirmed: Mapped[bool] = mapped_column(Boolean, server_default="0", comment="Message is Confirmed")
|
||||
# confirmed_date = mapped_column(TIMESTAMP, nullable=True, comment="Confirmation Date")
|
||||
# token = mapped_column(String, server_default="", comment="Invitation Token")
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user