updated account info gathering

This commit is contained in:
2025-02-13 16:41:15 +03:00
parent 533fe1f84e
commit 3bcec2abff
8 changed files with 339 additions and 185 deletions

View File

@@ -1,3 +1,4 @@
from typing import Any, Dict, Optional
from Events.Engine.abstract_class import DefaultClusterName
@@ -5,6 +6,17 @@ cluster_name = "AccountCluster"
prefix = "/accounts"
icon = "Building"
# Icons
class Icons:
PENCIL = "Pencil"
PLUS = "Plus"
TABLE = "Table"
# Components
class Components:
TABLE = "Table"
FORM = "Form"
LINK = "Link"
# Keys for the cluster
class KeyValidations:
@@ -12,10 +24,32 @@ class KeyValidations:
data = "data"
validation = "validations"
# Types of keys
class KeyTypes:
REQUEST = "REQUEST"
RESPONSE = "RESPONSE"
BOTH = "BOTH"
# Key URLS for the cluster
class KeyURLs:
validations = "/validations/validations"
# "data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers, "type": KeyTypes.RESPONSE},
class ValidationRequest:
event_code: str
asked_field: str
type: Optional[str] = "REQUEST"
@classmethod
def dump(cls) -> Dict[str, Any]:
return {
"event_code": cls.event_code,
"asked_field": cls.asked_field,
"type": cls.type,
}
# Keys for the cluster
class KeyBases:
create_key = f"{prefix}/create"

View File

@@ -1,16 +1,17 @@
from Events.Engine.abstract_class import PageInfo
from .bases import KeyValidations, cluster_name, KeyBases, PageBases, icon, KeyURLs
from .bases import Components, KeyTypes, ValidationRequest, icon, cluster_name
from .bases import KeyValidations, KeyBases, PageBases, 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_create_form_models_as_dict,
account_language_update_form_models_as_dict,
account_language_create_link_models_as_dict,
account_language_update_link_models_as_dict,
)
@@ -27,7 +28,7 @@ RedisValidation = dict(
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları",
},
},
SUBCATEGORIES={
SUB_COMPONENTS={
"/accounts/create": {
"SITE_URL": "/events/create?site=AccountCluster",
"COMPONENT": "Link",
@@ -87,7 +88,7 @@ class ClustersPageInfo:
name=f"{cluster_name}",
url=PageBases.DASHBOARD,
icon=icon,
page_info={
info={
"en": {
"page": "Account Records for reaching user all types account information",
},
@@ -95,53 +96,59 @@ class ClustersPageInfo:
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları",
},
},
instructions={
sub_components={
str(KeyBases.create_key): {
"SITE_URL": PageBases.CREATE,
"COMPONENT": Components.LINK,
"PREFIX_URL": KeyBases.create_key,
"ENDPOINTS": AccountRecordsCreateEventMethods.retrieve_all_event_keys(),
"LANGUAGE_MODELS": account_language_create_link_models_as_dict,
"INSTRUCTIONS": {},
},
str(KeyBases.update_key): {
"SITE_URL": PageBases.UPDATE,
"COMPONENT": Components.LINK,
"PREFIX_URL": KeyBases.update_key,
"ENDPOINTS": AccountRecordsUpdateEventMethods.retrieve_all_event_keys(),
"LANGUAGE_MODELS": account_language_update_link_models_as_dict,
"INSTRUCTIONS": {},
},
str(KeyBases.list_key): {
"headers": {
"store": True,
"url": KeyURLs.validations,
"data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers},
"SITE_URL": PageBases.DASHBOARD,
"COMPONENT": Components.TABLE,
"PREFIX_URL": KeyBases.list_key,
"INFO": {
"en": {"page": "List Account Records"},
"tr": {"page": "Hesap Kayıtlarını Listele"},
},
"data": {
"store": True,
"url": f"{KeyBases.list_key}",
"data": dict(page=1, limit=1),
"ENDPOINTS": AccountRecordsListEventMethods.retrieve_all_event_keys(),
"LANGUAGE_MODELS": account_language_list_models_as_dict,
"INSTRUCTIONS": {
"HEADERS": {
"store": True,
"url": KeyURLs.validations,
"data": ValidationRequest(
event_code=f"{KeyBases.list_key}",
asked_field=KeyValidations.headers,
type=KeyTypes.RESPONSE
).dump(),
},
"DATA": {
"store": True,
"url": f"{KeyBases.list_key}",
"params": None,
"data": dict(page=1, limit=1, order_by="uu_id", order_type="desc", query=None),
},
},
},
},
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={
info={
"en": {
"page": "Create Account Records for reaching user all types account information",
},
@@ -149,11 +156,38 @@ class ClustersPageInfo:
"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,
sub_components={
str(KeyBases.create_key): {
"SITE_URL": PageBases.CREATE,
"COMPONENT": Components.FORM,
"PREFIX_URL": KeyBases.create_key,
"INFO": {
"en": {"page": "Create Account Records", "button": "Create"},
"tr": {"page": "Hesap Kayıtlarını Oluştur", "button": "Oluştur"},
},
"ENDPOINTS": AccountRecordsCreateEventMethods.retrieve_all_event_keys(),
"LANGUAGE_MODELS": account_language_create_form_models_as_dict,
"INSTRUCTIONS": {
"VALIDATION": {
"store": True,
"url": KeyURLs.validations,
"data": ValidationRequest(
event_code=f"{KeyBases.create_key}",
asked_field=KeyValidations.validation,
type=KeyTypes.REQUEST
).dump(),
},
"HEADERS": {
"store": True,
"url": KeyURLs.validations,
"data": ValidationRequest(
event_code=f"{KeyBases.create_key}",
asked_field=KeyValidations.headers,
type=KeyTypes.REQUEST
).dump(),
},
},
},
},
)
@@ -161,21 +195,7 @@ class ClustersPageInfo:
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={
info={
"en": {
"page": "Update Account Records via all types account information",
},
@@ -183,15 +203,47 @@ class ClustersPageInfo:
"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,
sub_components={
str(KeyBases.update_key): {
"SITE_URL": PageBases.UPDATE,
"COMPONENT": Components.FORM,
"PREFIX_URL": KeyBases.update_key,
"INFO": {
"en": {"page": "Update Account Records", "button": "Update"},
"tr": {"page": "Hesap Kayıtlarını Güncelle", "button": "Güncelle"},
},
"ENDPOINTS": AccountRecordsUpdateEventMethods.retrieve_all_event_keys(),
"LANGUAGE_MODELS": account_language_update_form_models_as_dict,
"INSTRUCTIONS": {
"VALIDATION": {
"store": True,
"url": KeyURLs.validations,
"data": ValidationRequest(
event_code=f"{KeyBases.update_key}",
asked_field=KeyValidations.validation,
type=KeyTypes.REQUEST
).dump(),
},
"HEADERS": {
"store": True,
"url": KeyURLs.validations,
"data": ValidationRequest(
event_code=f"{KeyBases.update_key}",
asked_field=KeyValidations.headers,
type=KeyTypes.REQUEST
).dump(),
},
"DATA": {
"store": True,
"url": f"{KeyBases.list_key}",
"params": {"uu_id": "SomeUUID"},
"data": dict(page=1, size=1, limit=1, order_by="uu_id", order_type="desc", query={"uu_id": "SomeUUID"}),
},
},
},
},
)
# Page Variations of the cluster
page_infos = {
ClustersPageInfo.dashboard_page_info.URL: ClustersPageInfo.dashboard_page_info,

View File

@@ -1,78 +1,44 @@
from Events.Engine.abstract_class import DefaultClusterName, LanguageModels
from .bases import KeyBases, cluster_name
from ApiLayers.LanguageModels.PageInfos.accounts.account import AccountLanguageModels
from Events.Engine.abstract_class import LanguageModels
from .bases import Components, Icons, KeyBases, PageBases
account_language_update_models = LanguageModels()
account_language_update_models.COMPONENT = "Link"
account_language_update_models.SITE_URL = f"/update?{DefaultClusterName}={cluster_name}"
account_language_update_models.PREFIX_URL = (
KeyBases.update_key
)
account_language_update_models.PAGE_INFO = {
"en": {
"page": "Update Account Records",
},
"tr": {
"page": "Hesap Kayıdı Güncelle",
},
}
account_language_model_as_dict = account_language_update_models.as_dict()
account_language_update_models.COMPONENT = Components.LINK
account_language_update_models.SITE_URL = PageBases.UPDATE
account_language_update_models.ICON = Icons.PENCIL
account_language_update_models.PREFIX_URL = KeyBases.update_key
account_language_update_models.PAGE_INFO = AccountLanguageModels.account_language_update_models
account_language_update_link_models_as_dict = account_language_update_models.as_dict()
account_language_created_models = LanguageModels()
account_language_created_models.COMPONENT = "Link"
account_language_created_models.SITE_URL = f"/create?{DefaultClusterName}={cluster_name}"
account_language_created_models.PREFIX_URL = (
KeyBases.create_key
)
account_language_created_models.PAGE_INFO = {
"en": {
"page": "Create Account Records",
},
"tr": {"page": "Hesap Kayıdı Oluştur"},
}
account_language_created_models_as_dict = account_language_created_models.as_dict()
account_language_created_models.COMPONENT = Components.LINK
account_language_created_models.ICON = Icons.PLUS
account_language_created_models.SITE_URL = PageBases.CREATE
account_language_created_models.PREFIX_URL = KeyBases.create_key
account_language_created_models.PAGE_INFO = AccountLanguageModels.account_language_created_models
account_language_create_link_models_as_dict = account_language_created_models.as_dict()
account_language_list_models = LanguageModels()
account_language_list_models.COMPONENT = "Table"
account_language_list_models.SITE_URL = f"/dashboard?{DefaultClusterName}={cluster_name}"
account_language_list_models.PREFIX_URL = (
KeyBases.list_key
)
account_language_list_models.PAGE_INFO = {
"en": {
"page": "List Account Records",
},
"tr": {
"page": "Hesap Kayıtlarını Listele",
},
}
account_language_list_models.COMPONENT = Components.TABLE
account_language_list_models.ICON = Icons.TABLE
account_language_list_models.SITE_URL = PageBases.DASHBOARD
account_language_list_models.PREFIX_URL = KeyBases.list_key
account_language_list_models.PAGE_INFO = AccountLanguageModels.account_language_list_models
account_language_list_models_as_dict = account_language_list_models.as_dict()
account_language_create_form_models = LanguageModels()
account_language_create_form_models.COMPONENT = "Form"
account_language_create_form_models.SITE_URL = f"/create?{DefaultClusterName}={cluster_name}"
account_language_create_form_models.PREFIX_URL = (
KeyBases.create_key
)
account_language_create_form_models.PAGE_INFO = {
"en": {"page": "List Account Records", "button:": "Create"},
"tr": {"page": "Hesap Kayıtlarını Listele", "button:": "Oluştur"},
}
account_language_create_models_as_dict = account_language_create_form_models.as_dict()
account_language_create_form_models.COMPONENT = Components.FORM
account_language_create_form_models.ICON = Icons.PLUS
account_language_create_form_models.SITE_URL = PageBases.CREATE
account_language_create_form_models.PREFIX_URL = KeyBases.create_key
account_language_create_form_models.PAGE_INFO = AccountLanguageModels.account_language_create_form_models
account_language_create_form_models_as_dict = account_language_create_form_models.as_dict()
account_language_update_form_models = LanguageModels()
account_language_update_form_models.COMPONENT = "Form"
account_language_update_form_models.SITE_URL = f"/update?{DefaultClusterName}={cluster_name}"
account_language_update_form_models.PREFIX_URL = (
KeyBases.update_key
)
account_language_update_form_models.PAGE_INFO = {
"en": {"page": "Update Account Records", "button:": "Update"},
"tr": {"page": "Hesap Kayıdı Güncelle", "button:": "Güncelle"},
}
account_language_update_form_models_as_dict = (
account_language_update_form_models.as_dict()
)
account_language_update_form_models.COMPONENT = Components.FORM
account_language_update_form_models.ICON = Icons.PENCIL
account_language_update_form_models.SITE_URL = PageBases.UPDATE
account_language_update_form_models.PREFIX_URL = KeyBases.update_key
account_language_update_form_models.PAGE_INFO = AccountLanguageModels.account_language_update_form_models
account_language_update_form_models_as_dict = account_language_update_form_models.as_dict()