This commit is contained in:
berkay 2025-02-06 23:42:37 +03:00
parent 378d016d0c
commit 45ed5b86fd
3 changed files with 97 additions and 110 deletions

View File

@ -6,23 +6,7 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="b5202e0c-6ddf-4a56-a13a-e18798c4c7cf" name="Changes" comment=""> <list default="true" id="b5202e0c-6ddf-4a56-a13a-e18798c4c7cf" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ApiLayers/AllConfigs/Redis/configs.py" beforeDir="false" afterPath="$PROJECT_DIR$/ApiLayers/AllConfigs/Redis/configs.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/DockerApiServices/AuthServiceApi/events_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/DockerApiServices/AuthServiceApi/events_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/DockerApiServices/EventServiceApi/events_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/DockerApiServices/EventServiceApi/events_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/DockerApiServices/ValidationServiceApi/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/DockerApiServices/ValidationServiceApi/Dockerfile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/DockerApiServices/ValidationServiceApi/events_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/DockerApiServices/ValidationServiceApi/events_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/account/api_events.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/account/api_events.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/account/info.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/account/info.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/address/info.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/address/info.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/api_events.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/api_events.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/cluster.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/cluster.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/function_handlers.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/function_handlers.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/function_handlers.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/function_handlers.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/models.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/AllEvents/validations/validation/validation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/validations/validation/validation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/Engine/abstract_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/Engine/abstract_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/Engine/set_defaults/prepare_redis_items.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/Engine/set_defaults/prepare_redis_items.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Events/Engine/set_defaults/setClusters.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/Engine/set_defaults/setClusters.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@ -72,6 +72,102 @@ class AccountListEventMethods(BaseRouteModel):
response_model=getattr(cls.context_retriever, "RESPONSE_VALIDATOR", None), response_model=getattr(cls.context_retriever, "RESPONSE_VALIDATOR", None),
) )
class AccountCreateEventMethods(BaseRouteModel):
@classmethod
def account_records_create(cls, data: Any):
data_dict = data.excluded_dump()
db_session = AccountRecords.new_session()
if cls.context_retriever.token.is_occupant:
build_iban = BuildIbans.filter_one(
BuildIbans.iban == data.iban,
BuildIbans.build_id
== cls.context_retriever.token.selected_occupant.build_id,
db=db_session,
).data
if not build_iban:
raise BuildIbans.raise_http_exception(
status_code="HTTP_404_NOT_FOUND",
error_case="UNAUTHORIZED",
message=f"{data.iban} is not found in company related to your organization",
data={"iban": data.iban},
)
account_record = AccountRecords.find_or_create(**data.excluded_dump())
# return AlchemyJsonResponse(
# completed=True,
# message="Account record created successfully",
# result=account_record,
# )
elif cls.context_retriever.token.is_employee:
# Build.pre_query = Build.select_action(
# employee_id=token_dict.selected_employee.employee_id,
# )
# build_ids_list = Build.filter_all(
# )
# build_iban = BuildIbans.filter_one(
# BuildIbans.iban == data.iban,
# BuildIbans.build_id.in_([build.id for build in build_ids_list.data]),
# ).data
# if not build_iban:
# BuildIbans.raise_http_exception(
# status_code="HTTP_404_NOT_FOUND",
# error_case="UNAUTHORIZED",
# message=f"{data.iban} is not found in company related to your organization",
# data={
# "iban": data.iban,
# },
# )
bank_date = system_arrow.get(data.bank_date)
data_dict["bank_date_w"] = bank_date.weekday()
data_dict["bank_date_m"] = bank_date.month
data_dict["bank_date_d"] = bank_date.day
data_dict["bank_date_y"] = bank_date.year
if int(data.currency_value) < 0:
debit_type = ApiEnumDropdown.filter_by_one(
system=True, enum_class="DebitTypes", key="DT-D", db=db_session
).data
data_dict["receive_debit"] = debit_type.id
data_dict["receive_debit_uu_id"] = str(debit_type.uu_id)
else:
debit_type = ApiEnumDropdown.filter_by_one(
system=True, enum_class="DebitTypes", key="DT-R", db=db_session
).data
data_dict["receive_debit"] = debit_type.id
data_dict["receive_debit_uu_id"] = str(debit_type.uu_id)
account_record = AccountRecords.find_or_create(
data_dict, db=db_session
).data
# return AlchemyJsonResponse(
# completed=True,
# message="Account record created successfully",
# result=account_record,
# )
class AccountUpdateEventMethods(BaseRouteModel):
@classmethod
def account_records_update(cls, build_uu_id: str, data: Any):
if cls.context_retriever.token.is_occupant:
pass
elif cls.context_retriever.token.is_employee:
pass
AccountRecords.build_parts_id = (
cls.context_retriever.token.selected_occupant.build_part_id
)
account_record = AccountRecords.update_one(build_uu_id, data).data
# return AlchemyJsonResponse(
# completed=True,
# message="Account record updated successfully",
# result=account_record,
# cls_object=AccountRecords,
# response_model=UpdateAccountRecord,
# )
# @classmethod # @classmethod
# def account_records_list_flt_res(cls, list_options: ListOptions) -> PaginationResult: # def account_records_list_flt_res(cls, list_options: ListOptions) -> PaginationResult:
# list_options_base = ListOptionsBase( # list_options_base = ListOptionsBase(
@ -207,97 +303,3 @@ class AccountListEventMethods(BaseRouteModel):
# response_model=AccountRecordResponse, # response_model=AccountRecordResponse,
# ) # )
class AccountCreateEventMethods(BaseRouteModel):
@classmethod
def account_records_create(cls, data: Any):
data_dict = data.excluded_dump()
db_session = AccountRecords.new_session()
if cls.context_retriever.token.is_occupant:
build_iban = BuildIbans.filter_one(
BuildIbans.iban == data.iban,
BuildIbans.build_id
== cls.context_retriever.token.selected_occupant.build_id,
db=db_session,
).data
if not build_iban:
raise BuildIbans.raise_http_exception(
status_code="HTTP_404_NOT_FOUND",
error_case="UNAUTHORIZED",
message=f"{data.iban} is not found in company related to your organization",
data={"iban": data.iban},
)
account_record = AccountRecords.find_or_create(**data.excluded_dump())
# return AlchemyJsonResponse(
# completed=True,
# message="Account record created successfully",
# result=account_record,
# )
elif cls.context_retriever.token.is_employee:
# Build.pre_query = Build.select_action(
# employee_id=token_dict.selected_employee.employee_id,
# )
# build_ids_list = Build.filter_all(
# )
# build_iban = BuildIbans.filter_one(
# BuildIbans.iban == data.iban,
# BuildIbans.build_id.in_([build.id for build in build_ids_list.data]),
# ).data
# if not build_iban:
# BuildIbans.raise_http_exception(
# status_code="HTTP_404_NOT_FOUND",
# error_case="UNAUTHORIZED",
# message=f"{data.iban} is not found in company related to your organization",
# data={
# "iban": data.iban,
# },
# )
bank_date = system_arrow.get(data.bank_date)
data_dict["bank_date_w"] = bank_date.weekday()
data_dict["bank_date_m"] = bank_date.month
data_dict["bank_date_d"] = bank_date.day
data_dict["bank_date_y"] = bank_date.year
if int(data.currency_value) < 0:
debit_type = ApiEnumDropdown.filter_by_one(
system=True, enum_class="DebitTypes", key="DT-D", db=db_session
).data
data_dict["receive_debit"] = debit_type.id
data_dict["receive_debit_uu_id"] = str(debit_type.uu_id)
else:
debit_type = ApiEnumDropdown.filter_by_one(
system=True, enum_class="DebitTypes", key="DT-R", db=db_session
).data
data_dict["receive_debit"] = debit_type.id
data_dict["receive_debit_uu_id"] = str(debit_type.uu_id)
account_record = AccountRecords.find_or_create(
data_dict, db=db_session
).data
# return AlchemyJsonResponse(
# completed=True,
# message="Account record created successfully",
# result=account_record,
# )
class AccountUpdateEventMethods(BaseRouteModel):
@classmethod
def account_records_update(cls, build_uu_id: str, data: Any):
if cls.context_retriever.token.is_occupant:
pass
elif cls.context_retriever.token.is_employee:
pass
AccountRecords.build_parts_id = (
cls.context_retriever.token.selected_occupant.build_part_id
)
account_record = AccountRecords.update_one(build_uu_id, data).data
# return AlchemyJsonResponse(
# completed=True,
# message="Account record updated successfully",
# result=account_record,
# cls_object=AccountRecords,
# response_model=UpdateAccountRecord,
# )

View File

@ -198,6 +198,7 @@ class RetrievePage(BaseRouteModel):
instructions={}, instructions={},
) )
for key, event_codes in dict(endpoints).items(): for key, event_codes in dict(endpoints).items():
# Meaning client can reach this endpoint [] & [] intersection
if set(event_codes) & set(reachable_codes): if set(event_codes) & set(reachable_codes):
language_models = dict(page_info).get("language_models", {}) language_models = dict(page_info).get("language_models", {})
instructions = dict(page_info).get("instructions", {}) instructions = dict(page_info).get("instructions", {})