payment re-arragend tru raw sql
This commit is contained in:
@@ -26,7 +26,7 @@ from Schemas.address.address import (
|
||||
AddressStreet,
|
||||
)
|
||||
from Schemas.building.build import (
|
||||
BuildTypes,
|
||||
# BuildTypes,
|
||||
Part2Employee,
|
||||
RelationshipEmployee2Build,
|
||||
Build,
|
||||
@@ -139,7 +139,7 @@ __all__ = [
|
||||
"AddressLocality",
|
||||
"AddressNeighborhood",
|
||||
"AddressStreet",
|
||||
"BuildTypes",
|
||||
# "BuildTypes",
|
||||
"Part2Employee",
|
||||
"RelationshipEmployee2Build",
|
||||
"Build",
|
||||
|
||||
@@ -315,6 +315,7 @@ class AccountRecordExchanges(CrudCollection):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class AccountDelayInterest(CrudCollection):
|
||||
|
||||
__tablename__ = "account_delay_interest"
|
||||
@@ -354,6 +355,44 @@ class AccountDelayInterest(CrudCollection):
|
||||
)
|
||||
|
||||
|
||||
class AccountRecordsModelTrain(CrudCollection):
|
||||
|
||||
__tablename__ = "account_records_model_train"
|
||||
__exclude__fields__ = []
|
||||
|
||||
start_index: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
end_index: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
search_text: Mapped[str] = mapped_column(String, nullable=False)
|
||||
|
||||
category_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=False)
|
||||
category_uu_id: Mapped[str] = mapped_column(String(100), nullable=False)
|
||||
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=False)
|
||||
account_records_uu_id: Mapped[str] = mapped_column(String(100), nullable=False)
|
||||
is_model_trained: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
trained_at: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=True)
|
||||
|
||||
|
||||
class AccountRecordsPredict(CrudCollection):
|
||||
"""
|
||||
prediction_model = tahmin eden model ismi
|
||||
prediction_result = tahmin edilen sonuc
|
||||
treshold = tahmin edilen sonucun yüzdesi
|
||||
is_first_prediction = account record da kullanılmak tahmin mi?
|
||||
"""
|
||||
__tablename__ = "account_records_predict"
|
||||
__exclude__fields__ = []
|
||||
|
||||
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=False)
|
||||
account_records_uu_id: Mapped[str] = mapped_column(String(100), nullable=False)
|
||||
prediction_model: Mapped[str] = mapped_column(String(10), nullable=False)
|
||||
prediction_result: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
prediction_field: Mapped[str] = mapped_column(String(10), nullable=False, server_default="")
|
||||
treshold: Mapped[float] = mapped_column(Numeric(18, 6), nullable=True)
|
||||
is_first_prediction: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
is_approved: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
approved_at: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=True)
|
||||
|
||||
|
||||
class AccountRecords(CrudCollection):
|
||||
"""
|
||||
build_decision_book_id = kaydın sorumlu olduğu karar defteri
|
||||
@@ -368,6 +407,7 @@ class AccountRecords(CrudCollection):
|
||||
iban: Mapped[str] = mapped_column(String(64), nullable=False, comment="IBAN Number of Bank")
|
||||
bank_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=False, comment="Bank Transaction Date")
|
||||
currency_value: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Currency Value")
|
||||
remainder_balance: Mapped[float] = mapped_column(Numeric(20, 6), server_default="0")
|
||||
bank_balance: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Bank Balance")
|
||||
currency: Mapped[str] = mapped_column(String(5), nullable=False, comment="Unit of Currency")
|
||||
additional_balance: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Additional Balance")
|
||||
@@ -377,12 +417,13 @@ class AccountRecords(CrudCollection):
|
||||
process_comment: Mapped[str] = mapped_column(String, nullable=False, comment="Transaction Record Comment")
|
||||
process_garbage: Mapped[str] = mapped_column(String, nullable=True, comment="Transaction Record Garbage")
|
||||
bank_reference_code: Mapped[str] = mapped_column(String, nullable=False, comment="Bank Reference Code")
|
||||
|
||||
add_comment_note: Mapped[str] = mapped_column(String, server_default="")
|
||||
is_receipt_mail_send: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
|
||||
found_from = mapped_column(String, server_default="")
|
||||
similarity: Mapped[float] = mapped_column(Numeric(20, 6), server_default="0")
|
||||
remainder_balance: Mapped[float] = mapped_column(Numeric(20, 6), server_default="0")
|
||||
import_file_name: Mapped[str] = mapped_column(String, nullable=True, comment="XLS Key")
|
||||
|
||||
bank_date_y: Mapped[int] = mapped_column(Integer)
|
||||
bank_date_m: Mapped[int] = mapped_column(SmallInteger)
|
||||
@@ -394,8 +435,6 @@ class AccountRecords(CrudCollection):
|
||||
accounting_receipt_number: Mapped[int] = mapped_column(Integer, server_default="0")
|
||||
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||
|
||||
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
import_file_name: Mapped[str] = mapped_column(String, nullable=True, comment="XLS Key")
|
||||
receive_debit: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UU ID")
|
||||
budget_type: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
@@ -422,7 +461,7 @@ class AccountRecords(CrudCollection):
|
||||
payment_result_type: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
payment_result_type_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Payment Result Type UU ID")
|
||||
is_commission_applied: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
|
||||
|
||||
__table_args__ = (
|
||||
Index("_budget_records_ndx_00", is_receipt_mail_send, bank_date),
|
||||
Index("_budget_records_ndx_01", iban, bank_date, bank_reference_code, bank_balance, unique=True),
|
||||
|
||||
@@ -148,7 +148,7 @@ class Build(CrudCollection):
|
||||
site_uu_id: Mapped[str] = mapped_column(String, comment="Site UUID", nullable=True)
|
||||
address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"), nullable=False)
|
||||
address_uu_id: Mapped[str] = mapped_column(String, comment="Address UUID", nullable=False)
|
||||
build_types_id: Mapped[int] = mapped_column(ForeignKey("build_types.id"), nullable=False, comment="Building Type")
|
||||
build_types_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=False, comment="Building Type")
|
||||
build_types_uu_id: Mapped[str] = mapped_column(String, comment="Building Type UUID")
|
||||
|
||||
parts: Mapped[List["BuildParts"]] = relationship("BuildParts", back_populates="buildings", foreign_keys="BuildParts.build_id")
|
||||
@@ -238,8 +238,8 @@ class Build(CrudCollection):
|
||||
building_types = None
|
||||
for part in self.parts:
|
||||
building_types = {}
|
||||
build_type = BuildTypes.query.filter(
|
||||
BuildTypes.id == part.build_part_type_id
|
||||
build_type = ApiEnumDropdown.query.filter(
|
||||
ApiEnumDropdown.id == part.part_type_id
|
||||
).first()
|
||||
if not build_type:
|
||||
raise HTTPException(
|
||||
@@ -316,7 +316,7 @@ class BuildParts(CrudCollection):
|
||||
String, nullable=True, comment="Part Direction UUID"
|
||||
)
|
||||
part_type_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_types.id"), nullable=False, comment="Building Part Type"
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=False, comment="Building Part Type"
|
||||
)
|
||||
part_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Building Part Type UUID"
|
||||
@@ -332,9 +332,9 @@ class BuildParts(CrudCollection):
|
||||
)
|
||||
|
||||
def part_name(self, db):
|
||||
BuildTypes.set_session(db)
|
||||
if build_type := BuildTypes.query.filter(
|
||||
BuildTypes.id == self.part_type_id
|
||||
ApiEnumDropdown.set_session(db)
|
||||
if build_type := ApiEnumDropdown.query.filter(
|
||||
ApiEnumDropdown.id == self.part_type_id
|
||||
).first():
|
||||
return f"{str(build_type.type_name).upper()} : {str(self.part_no).upper()}"
|
||||
return f"Undefined:{str(build_type.type_name).upper()}"
|
||||
@@ -488,7 +488,7 @@ class BuildArea(CrudCollection):
|
||||
build_id: Mapped[int] = mapped_column(ForeignKey("build.id"))
|
||||
build_uu_id: Mapped[str] = mapped_column(String, comment="Building UUID")
|
||||
part_type_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_types.id"), nullable=True, comment="Building Part Type"
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True, comment="Building Part Type"
|
||||
)
|
||||
part_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Building Part Type UUID"
|
||||
|
||||
@@ -17,6 +17,7 @@ class ApiEnumDropdown(CrudCollection):
|
||||
uu_id: Mapped[str] = mapped_column(
|
||||
UUID, server_default=text("gen_random_uuid()"), index=True, unique=True
|
||||
)
|
||||
lang: Mapped[str] = mapped_column(String, nullable=False, server_default="tr", comment="Language")
|
||||
enum_class: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Enum Constant Name"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user