Compare commits
4 Commits
ba9b1a9a73
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 980da5a085 | |||
| 3bcec2abff | |||
| 533fe1f84e | |||
| 24eb6519f2 |
@@ -83,18 +83,14 @@ class RedisCategoryPageInfoKeysAction:
|
|||||||
page_index: str = (
|
page_index: str = (
|
||||||
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_URL}"
|
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_URL}"
|
||||||
)
|
)
|
||||||
|
page_mapper_key_language: str = (
|
||||||
page_mapper_key: str = (
|
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_LANGUAGE}"
|
||||||
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_URL}"
|
|
||||||
)
|
|
||||||
page_mapper_key: str = (
|
|
||||||
f"{page_mapper_key}:{RedisCategoryPageInfoKeys.PAGE_LANGUAGE}"
|
|
||||||
)
|
)
|
||||||
menu_mapper_key: str = (
|
menu_mapper_key: str = (
|
||||||
f"{RedisCategoryPageInfoKeys.PAGE_URL}:{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}"
|
f"{RedisCategoryPageInfoKeys.PAGE_URL}:{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}"
|
||||||
)
|
)
|
||||||
menu_mapper_key: str = (
|
menu_mapper_key_component: str = (
|
||||||
f"{menu_mapper_key}:{RedisCategoryPageInfoKeys.PAGE_MENU_COMPONENT}"
|
f"{RedisCategoryPageInfoKeys.PAGE_URL}:{RedisCategoryPageInfoKeys.PAGE_MENU_COMPONENT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
0
ApiLayers/LanguageModels/PageInfos/a.txt
Normal file
0
ApiLayers/LanguageModels/PageInfos/a.txt
Normal file
36
ApiLayers/LanguageModels/PageInfos/accounts/account.py
Normal file
36
ApiLayers/LanguageModels/PageInfos/accounts/account.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
class AccountLanguageModels:
|
||||||
|
|
||||||
|
account_language_update_models = {
|
||||||
|
"en": {
|
||||||
|
"page": "Update Account Records",
|
||||||
|
},
|
||||||
|
"tr": {
|
||||||
|
"page": "Hesap Kayıdı Güncelle",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
account_language_created_models = {
|
||||||
|
"en": {
|
||||||
|
"page": "Create Account Records",
|
||||||
|
},
|
||||||
|
"tr": {
|
||||||
|
"page": "Hesap Kayıdı Oluştur",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
account_language_list_models = {
|
||||||
|
"en": {
|
||||||
|
"page": "List Account Records",
|
||||||
|
},
|
||||||
|
"tr": {
|
||||||
|
"page": "Hesap Kaytlarını Listele",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
account_language_create_form_models = {
|
||||||
|
"en": {"page": "Create Account Records", "button": "Create"},
|
||||||
|
"tr": {"page": "Hesap Kayıdı Oluştur", "button": "Oluştur"},
|
||||||
|
},
|
||||||
|
account_language_update_form_models = {
|
||||||
|
"en": {"page": "Update Account Records", "button:": "Update"},
|
||||||
|
"tr": {"page": "Hesap Kayıdı Güncelle", "button:": "Güncelle"},
|
||||||
|
},
|
||||||
@@ -32,7 +32,7 @@ def setup_cors_middleware(app: FastAPI) -> None:
|
|||||||
"""
|
"""
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["*"],
|
allow_origins=["http://localhost:3000","*"],
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class ApiConfig(DefaultApiConfig):
|
|||||||
# Server Configuration
|
# Server Configuration
|
||||||
app = "app:app"
|
app = "app:app"
|
||||||
host = "0.0.0.0"
|
host = "0.0.0.0"
|
||||||
port = 41575
|
port = 8888
|
||||||
log_level = "info"
|
log_level = "info"
|
||||||
reload = True
|
reload = True
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def setup_cors_middleware(app: FastAPI) -> None:
|
|||||||
"""
|
"""
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["*"],
|
allow_origins=["http://localhost:3000","*"],
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ApiConfig(DefaultApiConfig):
|
|||||||
# Uvicorn server configuration
|
# Uvicorn server configuration
|
||||||
app = "app:app"
|
app = "app:app"
|
||||||
host = "0.0.0.0"
|
host = "0.0.0.0"
|
||||||
port = 41576
|
port = 8888
|
||||||
log_level = "info"
|
log_level = "info"
|
||||||
reload = True
|
reload = True
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def setup_cors_middleware(app: FastAPI) -> None:
|
|||||||
"""
|
"""
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["*"],
|
allow_origins=["http://localhost:3000","*"],
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ApiConfig(DefaultApiConfig):
|
|||||||
# App configuration
|
# App configuration
|
||||||
app = "app:app"
|
app = "app:app"
|
||||||
host = "0.0.0.0"
|
host = "0.0.0.0"
|
||||||
port = 41577
|
port = 8888
|
||||||
log_level = "info"
|
log_level = "info"
|
||||||
reload = True
|
reload = True
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ from Events.Engine.abstract_class import PageInfo
|
|||||||
authentication_page_info = PageInfo(
|
authentication_page_info = PageInfo(
|
||||||
name="Authentication",
|
name="Authentication",
|
||||||
url="",
|
url="",
|
||||||
language_models={},
|
|
||||||
endpoints={},
|
|
||||||
icon="Authentication",
|
icon="Authentication",
|
||||||
|
language_models=None,
|
||||||
|
endpoints=None,
|
||||||
|
info=None,
|
||||||
|
instructions=None,
|
||||||
sub_components=[],
|
sub_components=[],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from typing import Any, Dict, Optional
|
||||||
from Events.Engine.abstract_class import DefaultClusterName
|
from Events.Engine.abstract_class import DefaultClusterName
|
||||||
|
|
||||||
|
|
||||||
@@ -5,6 +6,17 @@ cluster_name = "AccountCluster"
|
|||||||
prefix = "/accounts"
|
prefix = "/accounts"
|
||||||
icon = "Building"
|
icon = "Building"
|
||||||
|
|
||||||
|
# Icons
|
||||||
|
class Icons:
|
||||||
|
PENCIL = "Pencil"
|
||||||
|
PLUS = "Plus"
|
||||||
|
TABLE = "Table"
|
||||||
|
|
||||||
|
# Components
|
||||||
|
class Components:
|
||||||
|
TABLE = "Table"
|
||||||
|
FORM = "Form"
|
||||||
|
LINK = "Link"
|
||||||
|
|
||||||
# Keys for the cluster
|
# Keys for the cluster
|
||||||
class KeyValidations:
|
class KeyValidations:
|
||||||
@@ -12,10 +24,41 @@ class KeyValidations:
|
|||||||
data = "data"
|
data = "data"
|
||||||
validation = "validations"
|
validation = "validations"
|
||||||
|
|
||||||
|
# Keys for Validation TYPES
|
||||||
|
class KeyTypeValidations:
|
||||||
|
HEADERS = "HEADERS"
|
||||||
|
DATA = "DATA"
|
||||||
|
MODIFY = "MODIFY"
|
||||||
|
VALIDATION = "VALIDATION"
|
||||||
|
BOTH = "BOTH"
|
||||||
|
|
||||||
|
# Types of keys
|
||||||
|
class KeyTypes:
|
||||||
|
REQUEST = "REQUEST"
|
||||||
|
RESPONSE = "RESPONSE"
|
||||||
|
BOTH = "BOTH"
|
||||||
|
|
||||||
# Key URLS for the cluster
|
# Key URLS for the cluster
|
||||||
class KeyURLs:
|
class KeyURLs:
|
||||||
validations = "/validations/validations"
|
validations = "/validations/validations"
|
||||||
|
|
||||||
|
|
||||||
|
# "data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers, "type": KeyTypes.RESPONSE},
|
||||||
|
class ValidationRequest:
|
||||||
|
|
||||||
|
def __init__(self, event_code: str, asked_field: str, type_: Optional[str] = "REQUEST"):
|
||||||
|
self.event_code = event_code
|
||||||
|
self.asked_field = asked_field
|
||||||
|
self.type = type_
|
||||||
|
|
||||||
|
def dump(self) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"event_code": self.event_code,
|
||||||
|
"asked_field": self.asked_field,
|
||||||
|
"type": self.type,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Keys for the cluster
|
# Keys for the cluster
|
||||||
class KeyBases:
|
class KeyBases:
|
||||||
create_key = f"{prefix}/create"
|
create_key = f"{prefix}/create"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ AccountCluster = CategoryCluster(
|
|||||||
},
|
},
|
||||||
mapping=page_2_keys,
|
mapping=page_2_keys,
|
||||||
include_in_schema=True,
|
include_in_schema=True,
|
||||||
|
template_ui="LCU",
|
||||||
sub_category=[],
|
sub_category=[],
|
||||||
is_client=True,
|
is_client=True,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
from Events.Engine.abstract_class import PageInfo
|
from Events.Engine.abstract_class import PageInfo
|
||||||
from .bases import KeyValidations, cluster_name, KeyBases, PageBases, icon, KeyURLs
|
from Events.base_request_model import AUTH_URL_EXTENSION, EVENTS_URL_EXTENSION, VALID_URL_EXTENSION
|
||||||
from .account_records import (
|
from .account_records import (
|
||||||
AccountRecordsUpdateEventMethods,
|
AccountRecordsUpdateEventMethods,
|
||||||
AccountRecordsCreateEventMethods,
|
AccountRecordsCreateEventMethods,
|
||||||
AccountRecordsListEventMethods,
|
AccountRecordsListEventMethods,
|
||||||
)
|
)
|
||||||
|
from .bases import Components, KeyTypeValidations, KeyTypes, ValidationRequest, icon, cluster_name
|
||||||
|
from .bases import KeyValidations, KeyBases, PageBases, KeyURLs
|
||||||
from .lang_models import (
|
from .lang_models import (
|
||||||
account_language_create_models_as_dict,
|
|
||||||
account_language_model_as_dict,
|
|
||||||
account_language_list_models_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_update_form_models_as_dict,
|
||||||
|
account_language_create_link_models_as_dict,
|
||||||
|
account_language_update_link_models_as_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ClustersPageInfo:
|
RedisValidation = dict(
|
||||||
|
NAME="AccountCluster",
|
||||||
# Cluster Page Infos that are available for the client
|
PREFIX="/accounts",
|
||||||
dashboard_page_info = PageInfo(
|
URL="/dashboard?site=AccountCluster",
|
||||||
name=f"{cluster_name}",
|
ICON="Building",
|
||||||
url=PageBases.DASHBOARD,
|
INFO={
|
||||||
icon=icon,
|
|
||||||
page_info={
|
|
||||||
"en": {
|
"en": {
|
||||||
"page": "Account Records for reaching user all types account information",
|
"page": "Account Records for reaching user all types account information",
|
||||||
},
|
},
|
||||||
@@ -29,53 +29,129 @@ class ClustersPageInfo:
|
|||||||
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları",
|
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıtları",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
instructions={
|
SUB_COMPONENTS={
|
||||||
str(KeyBases.list_key): {
|
"/accounts/create": {
|
||||||
|
"SITE_URL": "/events/create?site=AccountCluster",
|
||||||
|
"COMPONENT": "Link",
|
||||||
|
"PREFIX_URL": "/accounts/create",
|
||||||
|
"INFO": {
|
||||||
|
"en": {
|
||||||
|
"page": "Create Account Records",
|
||||||
|
"actions": "Actions",
|
||||||
|
"table": "Table",
|
||||||
|
},
|
||||||
|
"tr": {
|
||||||
|
"page": "Hesap Kayıdı Oluştur",
|
||||||
|
"actions": "Aksiyonlar",
|
||||||
|
"table": "Tablo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"INSTRUCTIONS": None,
|
||||||
|
},
|
||||||
|
"/accounts/list": {
|
||||||
|
"SITE_URL": "/events/dashboard?site=AccountCluster",
|
||||||
|
"COMPONENT": "Table",
|
||||||
|
"PREFIX_URL": "/accounts/list",
|
||||||
|
"INFO": {
|
||||||
|
"en": { "page": "List Account Records" },
|
||||||
|
"tr": { "page": "Hesap Kayıtlarını Listele" },
|
||||||
|
},
|
||||||
|
"INSTRUCTIONS": {
|
||||||
"headers": {
|
"headers": {
|
||||||
"store": True,
|
"store": True,
|
||||||
"url": KeyURLs.validations,
|
"url": "/validations/header",
|
||||||
"data": {"event_code": f"{KeyBases.list_key}", "asked_field": KeyValidations.headers},
|
"data": {
|
||||||
|
"event_code": "/accounts/list",
|
||||||
|
"asked_field": "headers",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"store": True,
|
"store": True,
|
||||||
"url": f"{KeyBases.list_key}",
|
"url": "/accounts/list",
|
||||||
"data": dict(page=1, limit=1),
|
"data": {
|
||||||
|
"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(
|
|
||||||
|
class ClustersPageInfo:
|
||||||
|
|
||||||
|
# Cluster Page Infos that are available for the client
|
||||||
|
DASHBOARD = PageInfo(
|
||||||
|
name=f"{cluster_name}",
|
||||||
|
url=PageBases.DASHBOARD,
|
||||||
|
icon=icon,
|
||||||
|
template_ui="LCU",
|
||||||
|
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ı",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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): {
|
||||||
|
"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"},
|
||||||
|
},
|
||||||
|
"ENDPOINTS": AccountRecordsListEventMethods.retrieve_all_event_keys(),
|
||||||
|
"LANGUAGE_MODELS": account_language_list_models_as_dict,
|
||||||
|
"INSTRUCTIONS": {
|
||||||
|
KeyTypeValidations.HEADERS: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{VALID_URL_EXTENSION}{KeyURLs.validations}",
|
||||||
|
"data": ValidationRequest(
|
||||||
|
event_code=f"{KeyBases.list_key}",
|
||||||
|
asked_field=KeyValidations.headers,
|
||||||
|
type_=KeyTypes.RESPONSE
|
||||||
|
).dump(),
|
||||||
|
},
|
||||||
|
KeyTypeValidations.DATA: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{EVENTS_URL_EXTENSION}{KeyBases.list_key}",
|
||||||
|
"params": None,
|
||||||
|
"data": dict(page=1, limit=1, order_by="uu_id", order_type="desc", query=None),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
CREATE = PageInfo(
|
||||||
name=f"{cluster_name}",
|
name=f"{cluster_name}",
|
||||||
url=PageBases.CREATE,
|
url=PageBases.CREATE,
|
||||||
icon=icon,
|
icon=icon,
|
||||||
instructions={
|
template_ui="LCU",
|
||||||
str(KeyBases.create_key): {
|
info={
|
||||||
"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": {
|
"en": {
|
||||||
"page": "Create Account Records for reaching user all types account information",
|
"page": "Create Account Records for reaching user all types account information",
|
||||||
},
|
},
|
||||||
@@ -83,33 +159,53 @@ class ClustersPageInfo:
|
|||||||
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıt Oluştur",
|
"page": "Kullanıcı tüm hesap bilgilerine ulaşmak için Hesap Kayıt Oluştur",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints={
|
sub_components={
|
||||||
str(KeyBases.create_key): AccountRecordsCreateEventMethods.retrieve_all_event_keys(),
|
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": {
|
||||||
|
KeyTypeValidations.VALIDATION: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{VALID_URL_EXTENSION}{KeyURLs.validations}",
|
||||||
|
"data": ValidationRequest(
|
||||||
|
event_code=f"{KeyBases.create_key}",
|
||||||
|
asked_field=KeyValidations.validation,
|
||||||
|
type_=KeyTypes.REQUEST
|
||||||
|
).dump(),
|
||||||
|
},
|
||||||
|
KeyTypeValidations.HEADERS: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{VALID_URL_EXTENSION}{KeyURLs.validations}",
|
||||||
|
"data": ValidationRequest(
|
||||||
|
event_code=f"{KeyBases.create_key}",
|
||||||
|
asked_field=KeyValidations.headers,
|
||||||
|
type_=KeyTypes.REQUEST
|
||||||
|
).dump(),
|
||||||
|
},
|
||||||
|
KeyTypeValidations.MODIFY: {
|
||||||
|
"store": False,
|
||||||
|
"url": f"{EVENTS_URL_EXTENSION}{KeyBases.create_key}",
|
||||||
|
"params": None,
|
||||||
|
"data": None,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
language_models={
|
|
||||||
str(KeyBases.create_key): account_language_create_models_as_dict,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
update_page_info = PageInfo(
|
UPDATE = PageInfo(
|
||||||
name=f"{cluster_name}",
|
name=f"{cluster_name}",
|
||||||
url=PageBases.UPDATE,
|
url=PageBases.UPDATE,
|
||||||
icon=icon,
|
icon=icon,
|
||||||
instructions={
|
template_ui="LCU",
|
||||||
str(KeyBases.update_key): {
|
info={
|
||||||
"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": {
|
"en": {
|
||||||
"page": "Update Account Records via all types account information",
|
"page": "Update Account Records via all types account information",
|
||||||
},
|
},
|
||||||
@@ -117,20 +213,52 @@ class ClustersPageInfo:
|
|||||||
"page": "Tüm hesap bilgileri aracılığıyla Hesap Kayıtlarını Güncelle",
|
"page": "Tüm hesap bilgileri aracılığıyla Hesap Kayıtlarını Güncelle",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints={
|
sub_components={
|
||||||
str(KeyBases.update_key): AccountRecordsUpdateEventMethods.retrieve_all_event_keys(),
|
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": {
|
||||||
|
KeyTypeValidations.VALIDATION: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{VALID_URL_EXTENSION}{KeyURLs.validations}",
|
||||||
|
"data": ValidationRequest(
|
||||||
|
event_code=f"{KeyBases.update_key}",
|
||||||
|
asked_field=KeyValidations.validation,
|
||||||
|
type_=KeyTypes.REQUEST
|
||||||
|
).dump(),
|
||||||
|
},
|
||||||
|
KeyTypeValidations.HEADERS: {
|
||||||
|
"store": True,
|
||||||
|
"url": f"{VALID_URL_EXTENSION}{KeyURLs.validations}",
|
||||||
|
"data": ValidationRequest(
|
||||||
|
event_code=f"{KeyBases.update_key}",
|
||||||
|
asked_field=KeyValidations.headers,
|
||||||
|
type_=KeyTypes.REQUEST
|
||||||
|
).dump(),
|
||||||
|
},
|
||||||
|
KeyTypeValidations.MODIFY: {
|
||||||
|
"store": False,
|
||||||
|
"url": f"{EVENTS_URL_EXTENSION}{KeyBases.update_key}",
|
||||||
|
"params": None,
|
||||||
|
"data": None,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
language_models={
|
|
||||||
str(KeyBases.update_key): account_language_update_form_models_as_dict,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Page Variations of the cluster
|
# Page Variations of the cluster
|
||||||
page_infos = {
|
page_infos = {
|
||||||
ClustersPageInfo.dashboard_page_info.URL: ClustersPageInfo.dashboard_page_info,
|
ClustersPageInfo.DASHBOARD.URL: ClustersPageInfo.DASHBOARD,
|
||||||
ClustersPageInfo.create_page_info.URL: ClustersPageInfo.create_page_info,
|
ClustersPageInfo.CREATE.URL: ClustersPageInfo.CREATE,
|
||||||
ClustersPageInfo.update_page_info.URL: ClustersPageInfo.update_page_info,
|
ClustersPageInfo.UPDATE.URL: ClustersPageInfo.UPDATE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,78 +1,44 @@
|
|||||||
from Events.Engine.abstract_class import DefaultClusterName, LanguageModels
|
from ApiLayers.LanguageModels.PageInfos.accounts.account import AccountLanguageModels
|
||||||
from .bases import KeyBases, cluster_name
|
from Events.Engine.abstract_class import LanguageModels
|
||||||
|
from .bases import Components, Icons, KeyBases, PageBases
|
||||||
|
|
||||||
|
|
||||||
account_language_update_models = LanguageModels()
|
account_language_update_models = LanguageModels()
|
||||||
account_language_update_models.COMPONENT = "Link"
|
account_language_update_models.COMPONENT = Components.LINK
|
||||||
account_language_update_models.SITE_URL = f"/update?{DefaultClusterName}={cluster_name}"
|
account_language_update_models.SITE_URL = PageBases.UPDATE
|
||||||
account_language_update_models.PREFIX_URL = (
|
account_language_update_models.ICON = Icons.PENCIL
|
||||||
KeyBases.update_key
|
account_language_update_models.PREFIX_URL = KeyBases.update_key
|
||||||
)
|
account_language_update_models.PAGE_INFO = AccountLanguageModels.account_language_update_models
|
||||||
account_language_update_models.PAGE_INFO = {
|
account_language_update_link_models_as_dict = account_language_update_models.as_dict()
|
||||||
"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_created_models = LanguageModels()
|
account_language_created_models = LanguageModels()
|
||||||
account_language_created_models.COMPONENT = "Link"
|
account_language_created_models.COMPONENT = Components.LINK
|
||||||
account_language_created_models.SITE_URL = f"/create?{DefaultClusterName}={cluster_name}"
|
account_language_created_models.ICON = Icons.PLUS
|
||||||
account_language_created_models.PREFIX_URL = (
|
account_language_created_models.SITE_URL = PageBases.CREATE
|
||||||
KeyBases.create_key
|
account_language_created_models.PREFIX_URL = KeyBases.create_key
|
||||||
)
|
account_language_created_models.PAGE_INFO = AccountLanguageModels.account_language_created_models
|
||||||
account_language_created_models.PAGE_INFO = {
|
account_language_create_link_models_as_dict = account_language_created_models.as_dict()
|
||||||
"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_list_models = LanguageModels()
|
account_language_list_models = LanguageModels()
|
||||||
account_language_list_models.COMPONENT = "Table"
|
account_language_list_models.COMPONENT = Components.TABLE
|
||||||
account_language_list_models.SITE_URL = f"/dashboard?{DefaultClusterName}={cluster_name}"
|
account_language_list_models.ICON = Icons.TABLE
|
||||||
account_language_list_models.PREFIX_URL = (
|
account_language_list_models.SITE_URL = PageBases.DASHBOARD
|
||||||
KeyBases.list_key
|
account_language_list_models.PREFIX_URL = KeyBases.list_key
|
||||||
)
|
account_language_list_models.PAGE_INFO = AccountLanguageModels.account_language_list_models
|
||||||
account_language_list_models.PAGE_INFO = {
|
|
||||||
"en": {
|
|
||||||
"page": "List Account Records",
|
|
||||||
},
|
|
||||||
"tr": {
|
|
||||||
"page": "Hesap Kayıtlarını Listele",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
account_language_list_models_as_dict = account_language_list_models.as_dict()
|
account_language_list_models_as_dict = account_language_list_models.as_dict()
|
||||||
|
|
||||||
account_language_create_form_models = LanguageModels()
|
account_language_create_form_models = LanguageModels()
|
||||||
account_language_create_form_models.COMPONENT = "Form"
|
account_language_create_form_models.COMPONENT = Components.FORM
|
||||||
account_language_create_form_models.SITE_URL = f"/create?{DefaultClusterName}={cluster_name}"
|
account_language_create_form_models.ICON = Icons.PLUS
|
||||||
account_language_create_form_models.PREFIX_URL = (
|
account_language_create_form_models.SITE_URL = PageBases.CREATE
|
||||||
KeyBases.create_key
|
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.PAGE_INFO = {
|
account_language_create_form_models_as_dict = account_language_create_form_models.as_dict()
|
||||||
"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_update_form_models = LanguageModels()
|
account_language_update_form_models = LanguageModels()
|
||||||
account_language_update_form_models.COMPONENT = "Form"
|
account_language_update_form_models.COMPONENT = Components.FORM
|
||||||
account_language_update_form_models.SITE_URL = f"/update?{DefaultClusterName}={cluster_name}"
|
account_language_update_form_models.ICON = Icons.PENCIL
|
||||||
account_language_update_form_models.PREFIX_URL = (
|
account_language_update_form_models.SITE_URL = PageBases.UPDATE
|
||||||
KeyBases.update_key
|
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.PAGE_INFO = {
|
account_language_update_form_models_as_dict = account_language_update_form_models.as_dict()
|
||||||
"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()
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ cluster_event.endpoint_callable = get_cluster_by_event_function_code
|
|||||||
# Page Event
|
# Page Event
|
||||||
page_event = Event(
|
page_event = Event(
|
||||||
name="page_event",
|
name="page_event",
|
||||||
key="",
|
key="2a43bff2-3720-4427-b226-9b2f6ef00b57",
|
||||||
request_validator=PagePydantic,
|
request_validator=PagePydantic,
|
||||||
language_models=[],
|
language_models=[],
|
||||||
statics=None,
|
statics=None,
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
Validation function handlers
|
Validation function handlers
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any, Optional
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
|
|
||||||
from ApiLayers.AllConfigs.Redis.configs import (
|
from ApiLayers.AllConfigs.Redis.configs import (
|
||||||
RedisValidationKeysAction,
|
|
||||||
RedisCategoryKeys,
|
RedisCategoryKeys,
|
||||||
|
RedisValidationKeysAction,
|
||||||
|
RedisCategoryPageInfoKeysAction,
|
||||||
)
|
)
|
||||||
|
from ApiLayers.ApiLibrary.common.line_number import get_line_number_for_error
|
||||||
|
from ApiLayers.ErrorHandlers.Exceptions.api_exc import HTTPExceptionApi
|
||||||
from Services.Redis.Actions.actions import RedisActions
|
from Services.Redis.Actions.actions import RedisActions
|
||||||
from Events.base_request_model import BaseRouteModel
|
from Events.base_request_model import BaseRouteModel
|
||||||
|
|
||||||
@@ -75,7 +78,7 @@ class RedisValidationRetrieve(ValidateBase):
|
|||||||
)
|
)
|
||||||
if redis_validation.status:
|
if redis_validation.status:
|
||||||
return redis_validation.first
|
return redis_validation.first
|
||||||
raise ValueError("Header not found")
|
raise ValueError("Validation not found")
|
||||||
|
|
||||||
|
|
||||||
class ValidationsBoth(RedisHeaderRetrieve, RedisValidationRetrieve):
|
class ValidationsBoth(RedisHeaderRetrieve, RedisValidationRetrieve):
|
||||||
@@ -155,14 +158,32 @@ class RetrievePage(BaseRouteModel):
|
|||||||
raise NotImplementedError("Cluster not found")
|
raise NotImplementedError("Cluster not found")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def retrieve_page(cls, data: Any):
|
def retrieve_page(cls, data: Any) -> Optional[Dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Retrieve page by event function code
|
Retrieve page by event function code
|
||||||
|
Check reachable codes for user to render which page and components on Frontend
|
||||||
|
Uses:
|
||||||
|
Context Token Retriever to get user information from ACCESS_TOKEN
|
||||||
|
CategoryCluster Retrieve Cluster Retrieve cluster by name
|
||||||
|
Check available instructions of page and info user with it
|
||||||
|
Args:
|
||||||
|
request: FastAPI request object
|
||||||
|
data.page: Request body containing login credentials
|
||||||
|
{
|
||||||
|
"page": "/dashboard?site=AccountCluster"
|
||||||
|
}
|
||||||
|
Returns:
|
||||||
|
NAME=cluster_name.name,
|
||||||
|
PREFIX=cluster_name.PREFIX,
|
||||||
|
URL=dict(page_info).get("URL", None),
|
||||||
|
ICON=dict(page_info).get("ICON", None),
|
||||||
|
INFO=dict(page_info).get("INFO", None),
|
||||||
|
SUB_COMPONENTS=sub_components,
|
||||||
"""
|
"""
|
||||||
from Events.Engine import CategoryCluster
|
from Events.Engine import CategoryCluster
|
||||||
from Events.JustEvents.events_file import retrieve_cluster_by_name
|
from Events.JustEvents.events_file import retrieve_cluster_by_name
|
||||||
|
|
||||||
reachable_codes = []
|
reachable_codes, page_name = [], getattr(data, "page", None)
|
||||||
if cls.context_retriever.token.is_employee:
|
if cls.context_retriever.token.is_employee:
|
||||||
reachable_codes = (
|
reachable_codes = (
|
||||||
cls.context_retriever.token.selected_company.reachable_event_codes
|
cls.context_retriever.token.selected_company.reachable_event_codes
|
||||||
@@ -171,46 +192,61 @@ class RetrievePage(BaseRouteModel):
|
|||||||
reachable_codes = (
|
reachable_codes = (
|
||||||
cls.context_retriever.token.selected_occupant.reachable_event_codes
|
cls.context_retriever.token.selected_occupant.reachable_event_codes
|
||||||
)
|
)
|
||||||
cluster_from_all_events = cls.get_site_cluster(page_name=data.page)
|
cluster_name = str(page_name).split("?")[1].split("=")[1]
|
||||||
if not cluster_from_all_events:
|
print("page_name", f"{RedisCategoryPageInfoKeysAction.page_index}:{page_name}")
|
||||||
raise ValueError(f"Cluster not found : {data.page}")
|
page_info_from_redis = RedisActions.get_json(
|
||||||
|
list_keys=[
|
||||||
cluster_name: CategoryCluster = retrieve_cluster_by_name(cluster_from_all_events)
|
RedisCategoryPageInfoKeysAction.page_index,
|
||||||
if not cluster_name:
|
cluster_name,
|
||||||
raise ValueError("Cluster not found")
|
]
|
||||||
|
|
||||||
page_info = cluster_name.retrieve_page_info().get(data.page, None)
|
|
||||||
if not page_info:
|
|
||||||
raise ValueError("Page not found")
|
|
||||||
|
|
||||||
endpoints: dict = dict(page_info).get("endpoints", {})
|
|
||||||
if not endpoints:
|
|
||||||
raise ValueError("Endpoints not found")
|
|
||||||
|
|
||||||
new_page_info_dict = dict(
|
|
||||||
name=cluster_name.name,
|
|
||||||
prefix=cluster_name.PREFIX,
|
|
||||||
url=dict(page_info).get("url", None),
|
|
||||||
icon=dict(page_info).get("icon", None),
|
|
||||||
mapping=cluster_name.MAPPING,
|
|
||||||
page_info=dict(page_info).get("page_info", None),
|
|
||||||
endpoints={},
|
|
||||||
language_models={},
|
|
||||||
instructions={},
|
|
||||||
)
|
)
|
||||||
for key, event_codes in dict(endpoints).items():
|
page_info_all = page_info_from_redis.first
|
||||||
# Meaning client can reach this endpoint [] & [] intersection
|
if not page_info_all:
|
||||||
if set(event_codes) & set(reachable_codes):
|
return dict(
|
||||||
language_models = dict(page_info).get("language_models", {})
|
NAME=f"{cluster_name}",
|
||||||
instructions = dict(page_info).get("instructions", {})
|
PREFIX=f"NOT IMPLEMENTED",
|
||||||
new_page_info_dict["endpoints"][key] = True
|
URL=f"{page_name}",
|
||||||
if language_models.get(key, None):
|
MESSAGE="Cluster not found"
|
||||||
if key in language_models[key].keys(): # key has sub key blocks inside lang model
|
)
|
||||||
for key_model, val_model in dict(language_models[key]).items():
|
|
||||||
if key_model in new_page_info_dict["endpoints"].keys():
|
page_info = page_info_all.get(page_name, {})
|
||||||
new_page_info_dict["language_models"][key_model] = language_models[key][key_model]
|
sub_components = dict(page_info).get("SUB_COMPONENTS", {})
|
||||||
else:
|
|
||||||
new_page_info_dict["language_models"][key] = language_models[key]
|
print("PAGE INFO : ", dict(
|
||||||
if instructions.get(key, None):
|
page_name=page_name,
|
||||||
new_page_info_dict["instructions"][key] = instructions.get(key, None)
|
page_info=page_info,
|
||||||
return new_page_info_dict
|
sub_components=sub_components,
|
||||||
|
NAME=cluster_name,
|
||||||
|
PREFIX=page_info_all.get("prefix", ""),
|
||||||
|
TEMPLATE_UI=dict(page_info).get("TEMPLATE_UI", ""),
|
||||||
|
URL=dict(page_info).get("URL", None),
|
||||||
|
ICON=dict(page_info).get("ICON", None),
|
||||||
|
INFO=dict(page_info).get("INFO", None),
|
||||||
|
SUB_COMPONENTS=sub_components,
|
||||||
|
# MAPPING=cluster_name.MAPPING,
|
||||||
|
))
|
||||||
|
new_page_info = dict(
|
||||||
|
NAME=cluster_name,
|
||||||
|
PREFIX=page_info_all.get("prefix", ""),
|
||||||
|
TEMPLATE_UI=dict(page_info).get("TEMPLATE_UI", ""),
|
||||||
|
URL=dict(page_info).get("URL", None),
|
||||||
|
ICON=dict(page_info).get("ICON", None),
|
||||||
|
INFO=dict(page_info).get("INFO", None),
|
||||||
|
SUB_COMPONENTS=sub_components,
|
||||||
|
# MAPPING=cluster_name.MAPPING,
|
||||||
|
)
|
||||||
|
for key, events in dict(sub_components).items():
|
||||||
|
# Meaning client can reach this endpoint [] & [] intersection in reachable_codes
|
||||||
|
endpoint_event_codes = dict(events).get("ENDPOINTS", [])
|
||||||
|
if not len(list(set(endpoint_event_codes) & set(reachable_codes))) == 1:
|
||||||
|
print(f"{endpoint_event_codes} :||: Endpoint is not available for the current user")
|
||||||
|
new_page_info["SUB_COMPONENTS"].pop(key, None)
|
||||||
|
for key in new_page_info["SUB_COMPONENTS"].keys():
|
||||||
|
new_page_info["SUB_COMPONENTS"][key].pop("ENDPOINTS", None)
|
||||||
|
if len(new_page_info["SUB_COMPONENTS"]) == 0:
|
||||||
|
return dict(
|
||||||
|
NAME=cluster_name,
|
||||||
|
PREFIX=page_info_all.get("prefix", ""),
|
||||||
|
MESSAGE="This cluster is not registered or not accessible for the current user"
|
||||||
|
)
|
||||||
|
return new_page_info
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
"""
|
"""
|
||||||
Validation records request and response models.
|
Validation records request and response models.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class ValidationsPydantic(BaseModel):
|
class ValidationsPydantic(BaseModel):
|
||||||
event_code: str
|
event_code: str
|
||||||
|
type: Optional[str] = "REQUEST"
|
||||||
asked_field: Optional[str] = "all"
|
asked_field: Optional[str] = "all"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,27 +53,94 @@ class PageInfo:
|
|||||||
"/update?site=AccountCluster": ["/accounts/update"],
|
"/update?site=AccountCluster": ["/accounts/update"],
|
||||||
"/create?site=AccountCluster": ["/accounts/create"],
|
"/create?site=AccountCluster": ["/accounts/create"],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
RedisValidation = dict(
|
||||||
|
NAME="AccountCluster",
|
||||||
|
PREFIX="/accounts",
|
||||||
|
URL="/dashboard?site=AccountCluster",
|
||||||
|
ICON="Building",
|
||||||
|
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ı",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SUB_COMPONENTS={
|
||||||
|
"/accounts/create": {
|
||||||
|
"SITE_URL": "/events/create?site=AccountCluster",
|
||||||
|
"COMPONENT": "Link",
|
||||||
|
"PREFIX_URL": "/accounts/create",
|
||||||
|
"INFO": {
|
||||||
|
"en": {
|
||||||
|
"page": "Create Account Records",
|
||||||
|
"actions": "Actions",
|
||||||
|
"table": "Table",
|
||||||
|
},
|
||||||
|
"tr": {
|
||||||
|
"page": "Hesap Kayıdı Oluştur",
|
||||||
|
"actions": "Aksiyonlar",
|
||||||
|
"table": "Tablo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"INSTRUCTIONS": None,
|
||||||
|
},
|
||||||
|
"/accounts/list": {
|
||||||
|
"SITE_URL": "/events/dashboard?site=AccountCluster",
|
||||||
|
"COMPONENT": "Table",
|
||||||
|
"PREFIX_URL": "/accounts/list",
|
||||||
|
"INFO": {
|
||||||
|
"en": { "page": "List Account Records" },
|
||||||
|
"tr": { "page": "Hesap Kayıtlarını Listele" },
|
||||||
|
},
|
||||||
|
"INSTRUCTIONS": {
|
||||||
|
"headers": {
|
||||||
|
"store": True,
|
||||||
|
"url": "/validations/header",
|
||||||
|
"data": {
|
||||||
|
"event_code": "/accounts/list",
|
||||||
|
"asked_field": "headers",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"store": True,
|
||||||
|
"url": "/accounts/list",
|
||||||
|
"data": {
|
||||||
|
"page": 1,
|
||||||
|
"limit": 1,
|
||||||
|
"order_by": "uu_id",
|
||||||
|
"order_type": "desc",
|
||||||
|
"query": None,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
NAME: str
|
NAME: str
|
||||||
PAGE_URL: str
|
PAGE_URL: str
|
||||||
PAGEINFO: Dict[str, Any]
|
INFO: Dict[str, Any]
|
||||||
URL: str = ""
|
URL: str = ""
|
||||||
ENDPOINTS: Dict[str, Any]
|
ENDPOINTS: Dict[str, Any]
|
||||||
LANGUAGE_MODELS: Dict[str, Any]
|
LANGUAGE_MODELS: Dict[str, Any]
|
||||||
SUB_COMPONENTS: Optional[list["PageComponent"]] = None
|
SUB_COMPONENTS: Optional[list["PageComponent"]] = None
|
||||||
INSTRUCTIONS: Optional[Dict[str, Any]] = None
|
INSTRUCTIONS: Optional[Dict[str, Any]] = None
|
||||||
|
TEMPLATE_UI: Optional[str] = "LCU"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
icon: str,
|
icon: str,
|
||||||
url: str,
|
url: str,
|
||||||
endpoints: Dict[str, Any],
|
info: Optional[Dict[str, Any]] = None,
|
||||||
language_models: Dict[str, Any],
|
endpoints: Optional[Dict[str, Any]] = None,
|
||||||
page_info: Optional[Dict[str, Any]] = None,
|
language_models: Optional[Dict[str, Any]] = None,
|
||||||
sub_components: Optional[list["PageComponent"]] = None,
|
sub_components: Optional[list[Dict[str, Any]]] = None,
|
||||||
instructions: Optional[Dict[str, Any]] = None,
|
instructions: Optional[Dict[str, Any]] = None,
|
||||||
|
template_ui: Optional[str] = "LCU",
|
||||||
):
|
):
|
||||||
self.NAME = name
|
self.NAME = name
|
||||||
self.LANGUAGE_MODELS = language_models
|
self.LANGUAGE_MODELS = language_models
|
||||||
@@ -81,8 +148,9 @@ class PageInfo:
|
|||||||
self.URL = url
|
self.URL = url
|
||||||
self.SUB_COMPONENTS = sub_components
|
self.SUB_COMPONENTS = sub_components
|
||||||
self.ENDPOINTS = endpoints
|
self.ENDPOINTS = endpoints
|
||||||
self.PAGEINFO = page_info
|
self.INFO = info
|
||||||
self.INSTRUCTIONS = instructions
|
self.INSTRUCTIONS = instructions
|
||||||
|
self.TEMPLATE_UI = template_ui
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def endpoints(self):
|
def endpoints(self):
|
||||||
@@ -95,17 +163,14 @@ class PageInfo:
|
|||||||
@property
|
@property
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
as_dict = {
|
as_dict = {
|
||||||
"name": self.NAME,
|
"NAME": self.NAME,
|
||||||
"icon": self.ICON,
|
"ICON": self.ICON,
|
||||||
"url": self.URL,
|
"URL": self.URL,
|
||||||
"endpoints": self.ENDPOINTS,
|
"TEMPLATE_UI": self.TEMPLATE_UI,
|
||||||
"language_models": self.LANGUAGE_MODELS,
|
"LANGUAGE_MODELS": self.LANGUAGE_MODELS,
|
||||||
"page_info": self.PAGEINFO,
|
"INFO": self.INFO,
|
||||||
|
"SUB_COMPONENTS": self.SUB_COMPONENTS,
|
||||||
}
|
}
|
||||||
if self.INSTRUCTIONS:
|
|
||||||
as_dict["instructions"] = self.INSTRUCTIONS
|
|
||||||
if self.SUB_COMPONENTS:
|
|
||||||
as_dict["sub_components"] = [i.as_dict() for i in self.SUB_COMPONENTS]
|
|
||||||
return as_dict
|
return as_dict
|
||||||
|
|
||||||
|
|
||||||
@@ -268,6 +333,7 @@ class CategoryCluster:
|
|||||||
DESCRIPTION: str
|
DESCRIPTION: str
|
||||||
ENDPOINTS: dict[str, MethodToEvent] # {"MethodToEvent": MethodToEvent, ...}
|
ENDPOINTS: dict[str, MethodToEvent] # {"MethodToEvent": MethodToEvent, ...}
|
||||||
SUBCATEGORY: Optional[List["CategoryCluster"]] # [CategoryCluster, ...]
|
SUBCATEGORY: Optional[List["CategoryCluster"]] # [CategoryCluster, ...]
|
||||||
|
TEMPLATE_UI: Optional[str] = "LCU" # LCU as List/Create/Update
|
||||||
MAPPING: Optional[List[Dict[str, Any]]] # [{"key": "value"}, ...]
|
MAPPING: Optional[List[Dict[str, Any]]] # [{"key": "value"}, ...]
|
||||||
INCLUDE_IN_SCHEMA: Optional[bool] = True
|
INCLUDE_IN_SCHEMA: Optional[bool] = True
|
||||||
IS_CLIENT: Optional[bool] = False
|
IS_CLIENT: Optional[bool] = False
|
||||||
@@ -282,6 +348,7 @@ class CategoryCluster:
|
|||||||
sub_category: list,
|
sub_category: list,
|
||||||
mapping: Optional[List[Dict[str, Any]]] = None,
|
mapping: Optional[List[Dict[str, Any]]] = None,
|
||||||
pageinfo: Optional[Dict["str", PageInfo]] = None,
|
pageinfo: Optional[Dict["str", PageInfo]] = None,
|
||||||
|
template_ui: Optional[str] = "LCU",
|
||||||
include_in_schema: Optional[bool] = True,
|
include_in_schema: Optional[bool] = True,
|
||||||
is_client: Optional[bool] = False,
|
is_client: Optional[bool] = False,
|
||||||
):
|
):
|
||||||
@@ -294,6 +361,7 @@ class CategoryCluster:
|
|||||||
self.SUBCATEGORY = sub_category or []
|
self.SUBCATEGORY = sub_category or []
|
||||||
self.INCLUDE_IN_SCHEMA = include_in_schema
|
self.INCLUDE_IN_SCHEMA = include_in_schema
|
||||||
self.MAPPING = mapping
|
self.MAPPING = mapping
|
||||||
|
self.TEMPLATE_UI = template_ui
|
||||||
self.IS_CLIENT = is_client
|
self.IS_CLIENT = is_client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -347,6 +415,7 @@ class CategoryCluster:
|
|||||||
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **page_infos}
|
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **page_infos}
|
||||||
"""
|
"""
|
||||||
page_infos = {}
|
page_infos = {}
|
||||||
|
print('def retrieve_page_info self.PAGEINFO',self.PAGEINFO)
|
||||||
if isinstance(self.PAGEINFO, dict):
|
if isinstance(self.PAGEINFO, dict):
|
||||||
for page_key, page_info in dict(self.PAGEINFO).items():
|
for page_key, page_info in dict(self.PAGEINFO).items():
|
||||||
if page_info_dict := getattr(page_info, "as_dict", None):
|
if page_info_dict := getattr(page_info, "as_dict", None):
|
||||||
@@ -354,7 +423,7 @@ class CategoryCluster:
|
|||||||
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **page_infos}
|
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **page_infos}
|
||||||
if hasattr(self.PAGEINFO, "as_dict"):
|
if hasattr(self.PAGEINFO, "as_dict"):
|
||||||
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **self.PAGEINFO.as_dict}
|
return {"prefix": self.PREFIX, "mapping": self.MAPPING, **self.PAGEINFO.as_dict}
|
||||||
return
|
return {"prefix": self.PREFIX, "mapping": self.MAPPING}
|
||||||
|
|
||||||
|
|
||||||
class LanguageModels:
|
class LanguageModels:
|
||||||
@@ -363,6 +432,7 @@ class LanguageModels:
|
|||||||
PREFIX_URL: str = ""
|
PREFIX_URL: str = ""
|
||||||
PAGE_INFO: dict
|
PAGE_INFO: dict
|
||||||
STATIC_PATH: str = STATIC_PATH
|
STATIC_PATH: str = STATIC_PATH
|
||||||
|
ICON: str = ""
|
||||||
|
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
return {
|
return {
|
||||||
@@ -370,6 +440,7 @@ class LanguageModels:
|
|||||||
"COMPONENT": self.COMPONENT,
|
"COMPONENT": self.COMPONENT,
|
||||||
"PREFIX_URL": self.PREFIX_URL,
|
"PREFIX_URL": self.PREFIX_URL,
|
||||||
"PAGE_INFO": self.PAGE_INFO,
|
"PAGE_INFO": self.PAGE_INFO,
|
||||||
|
"ICON": self.ICON,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ from Services.PostgresDb.Models.pagination import (
|
|||||||
TokenDictType = Union[EmployeeTokenObject, OccupantTokenObject]
|
TokenDictType = Union[EmployeeTokenObject, OccupantTokenObject]
|
||||||
|
|
||||||
STATIC_PATH = "events"
|
STATIC_PATH = "events"
|
||||||
|
AUTH_URL_EXTENSION = "http://auth-service:8888"
|
||||||
|
EVENTS_URL_EXTENSION = "http://events-service:8888"
|
||||||
|
VALID_URL_EXTENSION = "http://validation-service:8888"
|
||||||
|
|
||||||
|
|
||||||
class EndpointBaseRequestModel(BaseModel):
|
class EndpointBaseRequestModel(BaseModel):
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,48 @@
|
|||||||
services:
|
services:
|
||||||
init-service:
|
|
||||||
|
initservice:
|
||||||
|
container_name: initservice
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: DockerApiServices/InitServiceApi/Dockerfile
|
dockerfile: DockerApiServices/InitServiceApi/Dockerfile
|
||||||
|
|
||||||
auth-service:
|
authservice:
|
||||||
|
container_name: authservice
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: DockerApiServices/AuthServiceApi/Dockerfile
|
dockerfile: DockerApiServices/AuthServiceApi/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8081:41575"
|
- "8081:8888"
|
||||||
depends_on:
|
depends_on:
|
||||||
- init-service
|
- initservice
|
||||||
|
networks:
|
||||||
|
- wag-network
|
||||||
|
|
||||||
validation-service:
|
validationservice:
|
||||||
|
container_name: validationservice
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: DockerApiServices/ValidationServiceApi/Dockerfile
|
dockerfile: DockerApiServices/ValidationServiceApi/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8082:41577"
|
- "8082:8888"
|
||||||
depends_on:
|
depends_on:
|
||||||
- init-service
|
- initservice
|
||||||
|
networks:
|
||||||
|
- wag-network
|
||||||
|
|
||||||
event-service:
|
eventservice:
|
||||||
|
container_name: eventservice
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: DockerApiServices/EventServiceApi/Dockerfile
|
dockerfile: DockerApiServices/EventServiceApi/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8083:41576"
|
- "8083:8888"
|
||||||
depends_on:
|
depends_on:
|
||||||
- init-service
|
- initservice
|
||||||
|
networks:
|
||||||
|
- wag-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
wag-network:
|
||||||
|
name: wag-network
|
||||||
|
external: true
|
||||||
|
|||||||
26
run.sh
Executable file
26
run.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if wag-network exists
|
||||||
|
if ! docker network ls | grep -q "wag-network"; then
|
||||||
|
echo "Creating wag-network..."
|
||||||
|
docker network create wag-network
|
||||||
|
else
|
||||||
|
echo "wag-network already exists"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Bring down existing containers
|
||||||
|
echo "Stopping and removing existing containers..."
|
||||||
|
docker compose down --remove-orphans
|
||||||
|
|
||||||
|
# Build and start containers
|
||||||
|
echo "Building and starting containers..."
|
||||||
|
docker compose -f docker-compose-services.yml up --build -d
|
||||||
|
|
||||||
|
# Add container to wag-network
|
||||||
|
echo "Adding container to wag-network..."
|
||||||
|
docker container inspect authservice > /dev/null && docker network connect wag-network authservice
|
||||||
|
docker container inspect eventservice > /dev/null && docker network connect wag-network eventservice
|
||||||
|
docker container inspect validationservice > /dev/null && docker network connect wag-network validationservice
|
||||||
|
|
||||||
|
# Run migrations
|
||||||
|
echo "Setup complete! Backend Services Auth | Event | Validation are running..."
|
||||||
Reference in New Issue
Block a user