language models updated

This commit is contained in:
berkay 2025-01-08 23:00:31 +03:00
parent 08896e4c61
commit 4fe1f36006
4 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,45 @@
from databases.sql_models.account.account import AccountBooks
from databases.sql_models.core_mixin import CrudCollection
AccountBooksLanguageModel = dict(
tr={
str(AccountBooks.created_at.key): "Oluşturulma Tarihi",
str(AccountBooks.updated_at.key): "Güncellenme Tarihi",
},
en={
str(AccountBooks.created_at.key): "Created At",
str(AccountBooks.updated_at.key): "Updated At",
}
)
AccountCodesLanguageModel = dict(
tr={},
en={}
)
AccountCodeParserLanguageModel = dict(
tr={},
en={}
)
AccountMasterLanguageModel = dict(
tr={},
en={}
)
AccountDetailLanguageModel = dict(
tr={},
en={}
)
AccountRecordsLanguageModel = dict(
tr={},
en={}
)
AccountRecordExchangesLanguageModel = dict(
tr={},
en={}
)

View File

@ -0,0 +1,113 @@
from sqlalchemy.orm import mapped_column, Mapped
from sqlalchemy import String, ForeignKey, Index, TIMESTAMP, SmallInteger, Identity
from databases.sql_models.core_mixin import CrudCollection
class BuildIbans(CrudCollection):
"""
BuildParts class based on declarative_base and BaseMixin via session
"""
__tablename__ = "build_ibans"
__exclude__fields__ = []
iban: Mapped[str] = mapped_column(
String(40), server_default="", nullable=False, comment="IBAN number"
)
start_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), nullable=False, comment="Bank Transaction Start Date"
)
stop_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), server_default="2900-01-01 00:00:00"
)
bank_code: Mapped[str] = mapped_column(String(24), server_default="TR0000000000000")
xcomment: Mapped[str] = mapped_column(String(64), server_default="????")
build_id: Mapped[int] = mapped_column(
ForeignKey("build.id"), nullable=True, comment="Building ID"
)
build_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Building UUID", index=True
)
# building: Mapped["Build"] = relationship(
# "Build", back_populates="build_ibans", foreign_keys=[build_id]
# )
__table_args__ = (
Index("_build_ibans_ndx_01", iban, start_date, unique=True),
{"comment": "IBANs related to money transactions due to building objects"},
)
# @property
# def enums(self):
# return_dict = {}
# for key, enum in self.__enums_list__.items():
# for enum_item in EnumDropdown.filter_by(enum_class=enum):
# return_dict[key] = {
# enum_item.get_dict(include=["key", "value", "description"])
# }
# return return_dict
class BuildIbanDescription(CrudCollection):
"""
SearchComments class based on declarative_base and CrudCollection via session
"""
__tablename__ = "build_iban_description"
__exclude__fields__ = []
iban: Mapped[str] = mapped_column(String, nullable=False, comment="IBAN Number")
group_id: Mapped[int] = mapped_column(
SmallInteger, nullable=False, comment="Group ID"
)
search_word: Mapped[str] = mapped_column(
String, nullable=False, comment="Search Word", index=True
)
# decision_book_project_id: Mapped[int] = mapped_column(
# ForeignKey("build_decision_book_projects.id")
# )
# decision_book_project_uu_id: Mapped[str] = mapped_column(
# String, nullable=False, comment="Decision Book Project UUID"
# )
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
customer_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Customer UUID"
)
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
company_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Company UUID"
)
build_parts_id: Mapped[int] = mapped_column(
ForeignKey("build_parts.id"), nullable=True
)
build_parts_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Parts UUID"
)
# decision_book_project: Mapped["BuildDecisionBookProjects"] = relationship(
# "BuildDecisionBookProjects",
# back_populates="search_iban_description",
# foreign_keys=[decision_book_project_id],
# )
# customer: Mapped["People"] = relationship(
# "People", back_populates="search_iban_description", foreign_keys=[customer_id]
# )
# company: Mapped["Companies"] = relationship(
# "Company", back_populates="search_iban_description", foreign_keys=[company_id]
# )
# parts: Mapped["BuildParts"] = relationship(
# "BuildParts",
# back_populates="search_iban_description",
# foreign_keys=[build_parts_id],
# )
__table_args__ = (
Index(
"_search_iban_description_ndx_00", iban, search_word, group_id, unique=True
),
{"comment": "Search Iban Description Information"},
)

View File

@ -1,3 +1,5 @@
from api_validations.validations_request import ListOptions
from databases.language_models.account.account import AccountBooksLanguageModel
from databases.sql_models.core_mixin import CrudCollection
from sqlalchemy.orm import mapped_column, Mapped
@ -18,6 +20,7 @@ class AccountBooks(CrudCollection):
__tablename__ = "account_books"
__exclude__fields__ = []
__language_model__ = AccountBooksLanguageModel
country: Mapped[str] = mapped_column(String, nullable=False)
branch_type: Mapped[str] = mapped_column(SmallInteger, server_default="0")
@ -50,6 +53,8 @@ class AccountBooks(CrudCollection):
)
class AccountCodes(CrudCollection):
__tablename__ = "account_codes"

View File

@ -403,6 +403,13 @@ class CrudCollection(BaseMixin, SmartQueryMixin):
is_notification_send: Mapped[bool] = mapped_column(Boolean, server_default="0")
is_email_send: Mapped[bool] = mapped_column(Boolean, server_default="0")
@classmethod
def retrieve_language_model(cls, lang: str, response_model):
headers_and_validation = {}
__language_model__ = getattr(cls.__language_model__, lang, "tr")
for i in response_model.__annotations__.keys():
headers_and_validation[i] = getattr(__language_model__, i, "Lang Not found")
# all_arguments = [
# record
# for record in self.__class__.__dict__