141 lines
5.1 KiB
Python
141 lines
5.1 KiB
Python
from Events.Engine.abstract_class import PageInfo
|
||
from .bases import KeyValidations, cluster_name, KeyBases, PageBases, icon, KeyURLs
|
||
from .account_records import (
|
||
AccountRecordsUpdateEventMethods,
|
||
AccountRecordsCreateEventMethods,
|
||
AccountRecordsListEventMethods,
|
||
)
|
||
from .lang_models import (
|
||
account_language_create_models_as_dict,
|
||
account_language_model_as_dict,
|
||
account_language_list_models_as_dict,
|
||
account_language_created_models_as_dict,
|
||
account_language_update_form_models_as_dict,
|
||
)
|
||
|
||
|
||
class ClustersPageInfo:
|
||
|
||
# Cluster Page Infos that are available for the client
|
||
dashboard_page_info = PageInfo(
|
||
name=f"{cluster_name}",
|
||
url=PageBases.DASHBOARD,
|
||
icon=icon,
|
||
page_info={
|
||
"en": {
|
||
"page": "Account Records for reaching user all types account information",
|
||
},
|
||
"tr": {
|
||
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları",
|
||
},
|
||
},
|
||
instructions={
|
||
str(KeyBases.list_key): {
|
||
"headers": {
|
||
"store": True,
|
||
"url": KeyURLs.validations,
|
||
"data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers},
|
||
},
|
||
"data": {
|
||
"store": True,
|
||
"url": f"{KeyBases.list_key}",
|
||
"data": dict(page=1, limit=1),
|
||
},
|
||
},
|
||
},
|
||
endpoints={
|
||
str(KeyBases.update_key): AccountRecordsUpdateEventMethods.retrieve_all_event_keys(),
|
||
str(KeyBases.create_key): AccountRecordsCreateEventMethods.retrieve_all_event_keys(),
|
||
str(KeyBases.list_key): AccountRecordsListEventMethods.retrieve_all_event_keys(),
|
||
},
|
||
language_models={
|
||
str(KeyBases.list_key): {
|
||
str(KeyBases.update_key): account_language_model_as_dict,
|
||
str(KeyBases.create_key): account_language_created_models_as_dict,
|
||
str(KeyBases.list_key): account_language_list_models_as_dict,
|
||
}
|
||
},
|
||
)
|
||
|
||
create_page_info = PageInfo(
|
||
name=f"{cluster_name}",
|
||
url=PageBases.CREATE,
|
||
icon=icon,
|
||
instructions={
|
||
str(KeyBases.create_key): {
|
||
"validation": {
|
||
"store": True,
|
||
"url": KeyURLs.validations,
|
||
"data": {"event_code": f"{KeyBases.create_key}", "asked_field": KeyValidations.validation },
|
||
},
|
||
"headers": {
|
||
"store": True,
|
||
"url": KeyURLs.validations,
|
||
"data": {"event_code": f"{KeyBases.create_key}", "asked_field": KeyValidations.headers},
|
||
},
|
||
},
|
||
},
|
||
page_info={
|
||
"en": {
|
||
"page": "Create Account Records for reaching user all types account information",
|
||
},
|
||
"tr": {
|
||
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıt Oluştur",
|
||
},
|
||
},
|
||
endpoints={
|
||
str(KeyBases.create_key): AccountRecordsCreateEventMethods.retrieve_all_event_keys(),
|
||
},
|
||
language_models={
|
||
str(KeyBases.create_key): account_language_create_models_as_dict,
|
||
},
|
||
)
|
||
|
||
update_page_info = PageInfo(
|
||
name=f"{cluster_name}",
|
||
url=PageBases.UPDATE,
|
||
icon=icon,
|
||
instructions={
|
||
str(KeyBases.update_key): {
|
||
"validation": {
|
||
"store": True,
|
||
"url": KeyURLs.validations,
|
||
"data": {"event_code": f"{KeyBases.update_key}", "asked_field": KeyValidations.validation},
|
||
},
|
||
"headers": {
|
||
"store": True,
|
||
"url": KeyURLs.validations,
|
||
"data": {"event_code": f"{KeyBases.update_key}", "asked_field": KeyValidations.headers},
|
||
},
|
||
},
|
||
},
|
||
page_info={
|
||
"en": {
|
||
"page": "Update Account Records via all types account information",
|
||
},
|
||
"tr": {
|
||
"page": "Tüm hesap bilgileri aracılığıyla Hesap Kayıtlarını Güncelle",
|
||
},
|
||
},
|
||
endpoints={
|
||
str(KeyBases.update_key): AccountRecordsUpdateEventMethods.retrieve_all_event_keys(),
|
||
},
|
||
language_models={
|
||
str(KeyBases.update_key): account_language_update_form_models_as_dict,
|
||
},
|
||
)
|
||
|
||
|
||
# Page Variations of the cluster
|
||
page_infos = {
|
||
ClustersPageInfo.dashboard_page_info.URL: ClustersPageInfo.dashboard_page_info,
|
||
ClustersPageInfo.create_page_info.URL: ClustersPageInfo.create_page_info,
|
||
ClustersPageInfo.update_page_info.URL: ClustersPageInfo.update_page_info,
|
||
}
|
||
|
||
|
||
# Check if all the page info is implemented in the mappings
|
||
for t in [x for k, x in PageBases.__dict__.items() if not str(k).startswith("__")]:
|
||
if t not in list(dict(page_infos).keys()):
|
||
raise NotImplementedError(f"Page Info of : {t} is not implemented in mappings")
|