events updated
This commit is contained in:
parent
6ccb13809a
commit
d2cc195ccf
|
|
@ -33,7 +33,6 @@ class CrudMixin(Base, SmartQueryMixin, SessionMixin, FilterAttributes):
|
|||
__abstract__ = True # The model is abstract not a database table.
|
||||
__session__ = Base.session # The session to use in the model.
|
||||
__system__fields__create__ = (
|
||||
"ref_id",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"cryp_uu_id",
|
||||
|
|
@ -49,8 +48,6 @@ class CrudMixin(Base, SmartQueryMixin, SessionMixin, FilterAttributes):
|
|||
"active",
|
||||
"is_notification_send",
|
||||
"is_email_send",
|
||||
"expiry_starts",
|
||||
"expiry_ends",
|
||||
) # The system fields to use in the model.
|
||||
__system__fields__update__ = (
|
||||
"cryp_uu_id",
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ class AlchemyResponse:
|
|||
return self.__query.first()
|
||||
except Exception as e:
|
||||
err = e
|
||||
self.__query.session.expunge_all()
|
||||
self.__query.session.close()
|
||||
return None
|
||||
try:
|
||||
return self.__query.all()
|
||||
except Exception as e:
|
||||
err = e
|
||||
self.__query.session.expunge_all()
|
||||
self.__query.session.close()
|
||||
return []
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class FilterAttributes:
|
|||
"order_field": getattr(cls.filter_attr, "order_field", "id"),
|
||||
"order_type": getattr(cls.filter_attr, "order_type", "asc"),
|
||||
"include_joins": getattr(cls.filter_attr, "include_joins", []),
|
||||
"query": getattr(cls.filter_attr, "query", {}),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
|
@ -172,19 +173,24 @@ class FilterAttributes:
|
|||
"""
|
||||
Filters all the records regardless of is_deleted, is_confirmed.
|
||||
"""
|
||||
arg_left = lambda arg_obj: getattr(getattr(arg_obj, "left", None), "key", None)
|
||||
if not system:
|
||||
args = cls.add_new_arg_to_args(
|
||||
args, "is_confirmed", cls.is_confirmed == True
|
||||
)
|
||||
args = cls.get_not_expired_query_arg(args)
|
||||
|
||||
filter_list = cls.get_filter_attributes()
|
||||
if filter_list.get("query", None):
|
||||
for smart_iter in cls.filter_expr(**filter_list.get('query', {})):
|
||||
if key := arg_left(smart_iter):
|
||||
args = cls.add_new_arg_to_args(args, key, smart_iter)
|
||||
query = cls._query().filter(*args)
|
||||
cls.total_count = query.count()
|
||||
if cls.filter_attr:
|
||||
filter_list = cls.get_filter_attributes()
|
||||
data_query = cls.add_query_to_filter(query, filter_list)
|
||||
cls.filter_attr = None
|
||||
return AlchemyResponse(query=data_query, first=False)
|
||||
cls.filter_attr = None
|
||||
return AlchemyResponse(query=query, first=False)
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ def migrate_build_living_space(requester: BothAPIS):
|
|||
|
||||
response = requester.local_api.post(
|
||||
endpoint="/building/parts/list",
|
||||
data={"page": 1, "size": 1, "query": {"ref_id": response_data.get("build_parts_uu_id")}},
|
||||
data={"page": 1, "size": 30, "query": {"ref_id": response_data.get("build_parts_uu_id")}},
|
||||
)
|
||||
print("/building/parts/list response", response.text)
|
||||
response_data["build_parts_uu_id"] = response.json()["data"][0]["uu_id"]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from service_app_test.test_application.migrate_old_data.company import migrate_c
|
|||
from service_app_test.test_application.migrate_old_data.accounts import migrate_account_records
|
||||
|
||||
|
||||
password_token = "D0UjFwQjReEjhQuXzytYXj_tPkkFPbRJsj_0Pp9ha2dlvaEj5jC9b76J7UPfKb-s_UqJQAXvRgP3jaKyfTvc_POtMQFALiLzlPUp4Sg-Qjiz9wEECJNc8fWqbfNPtLOFzV5XktV72Whnb4AJYr4pQ9AnuGm4txQnjB_NTPnuZYjyLVnqj9mrLkDKzuXLPSVd"
|
||||
password_token = ""
|
||||
login_data = {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||||
|
|
@ -34,16 +34,16 @@ wag_api.selected_object = wag_api.login_via_email_and_password(
|
|||
local_api = RequestToApi()
|
||||
local_api.overwrite_base_url(base_url=LocalAPI.base_url)
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_data, is_password_valid=False
|
||||
login_data=login_data, is_password_valid=True
|
||||
)
|
||||
|
||||
both_apis = BothAPIS()
|
||||
both_apis.wag_api = wag_api
|
||||
both_apis.local_api = local_api
|
||||
|
||||
migrate_company(requester=both_apis)
|
||||
migrate_people(requester=both_apis)
|
||||
migrate_build(requester=both_apis)
|
||||
# migrate_company(requester=both_apis)
|
||||
# migrate_people(requester=both_apis)
|
||||
# migrate_build(requester=both_apis)
|
||||
migrate_build_living_space(requester=both_apis)
|
||||
|
||||
# migrate_account_records(requester=both_apis)
|
||||
|
|
|
|||
Loading…
Reference in New Issue