language models updated

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

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__