diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1738102..404cebb 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,16 +6,8 @@
-
-
-
-
-
-
-
-
-
-
+
+
@@ -40,16 +32,17 @@
- {
- "keyToString": {
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "git-widget-placeholder": "development",
- "last_opened_file_path": "/home/berkay/git-gitea-evyos/wag-managment-api-service-version-5/ApiLayers/LanguageModels/templates"
+
+}]]>
+
diff --git a/Events/AllEvents/template/template/api_events.py b/Events/AllEvents/template/template/api_events.py
new file mode 100644
index 0000000..000a7d5
--- /dev/null
+++ b/Events/AllEvents/template/template/api_events.py
@@ -0,0 +1,23 @@
+from Events.Engine.abstract_class import Event
+from ApiLayers.LanguageModels.Request import (
+ LoginRequestLanguageModel,
+)
+
+from models import TemplateResponseModels, TemplateRequestModels
+from function_handlers import TemplateFunctions
+
+
+# Auth Login
+template_event = Event(
+ name="authentication_login_super_user_event",
+ key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
+ request_validator=TemplateRequestModels.TemplateRequestModelX,
+ language_models=[LoginRequestLanguageModel],
+ response_validation_static="LOGIN_SUCCESS",
+ description="Login super user",
+)
+
+
+template_event.endpoint_callable = (
+ TemplateFunctions.template_example_function()
+)
diff --git a/Events/AllEvents/template/template/cluster.py b/Events/AllEvents/template/template/cluster.py
new file mode 100644
index 0000000..de5066b
--- /dev/null
+++ b/Events/AllEvents/template/template/cluster.py
@@ -0,0 +1,14 @@
+from Events.Engine.abstract_class import CategoryCluster
+from info import template_page_info
+
+
+TemplateCluster = CategoryCluster(
+ name="TemplateCluster",
+ tags=["template"],
+ prefix="/template",
+ description="Template cluster",
+ pageinfo=template_page_info,
+ endpoints={},
+ include_in_schema=True,
+ sub_category=[],
+)
diff --git a/Events/AllEvents/template/template/function_handlers.py b/Events/AllEvents/template/template/function_handlers.py
new file mode 100644
index 0000000..cee881b
--- /dev/null
+++ b/Events/AllEvents/template/template/function_handlers.py
@@ -0,0 +1,21 @@
+from typing import Any, Union
+from fastapi import Request
+
+from Events.base_request_model import TokenDictType, BaseRouteModel
+
+
+class Handlers:
+ """Class for handling authentication functions"""
+
+ @classmethod # Requires no auth context
+ def handle_function(cls, **kwargs):
+ """Handle function with kwargs"""
+ return
+
+
+class TemplateFunctions(BaseRouteModel):
+ """Class for handling authentication functions"""
+
+ @classmethod
+ def template_example_function(cls):
+ return
diff --git a/Events/AllEvents/template/template/info.py b/Events/AllEvents/template/template/info.py
new file mode 100644
index 0000000..4ace812
--- /dev/null
+++ b/Events/AllEvents/template/template/info.py
@@ -0,0 +1,11 @@
+from Events.Engine.abstract_class import PageInfo
+
+
+template_page_info = PageInfo(
+ name="template",
+ title={"en": "template"},
+ description={"en": "template"},
+ icon="",
+ parent="",
+ url=""
+)
diff --git a/Events/AllEvents/template/template/models.py b/Events/AllEvents/template/template/models.py
new file mode 100644
index 0000000..07f361d
--- /dev/null
+++ b/Events/AllEvents/template/template/models.py
@@ -0,0 +1,12 @@
+from ApiLayers.ApiValidations.Request import (
+ BaseModelRegular
+)
+
+
+class TemplateRequestModels:
+ TemplateRequestModelX = BaseModelRegular
+
+
+
+class TemplateResponseModels:
+ TemplateResponseModelsX = BaseModelRegular
diff --git a/Events/AllEvents/template/template/template.py b/Events/AllEvents/template/template/template.py
new file mode 100644
index 0000000..7a443eb
--- /dev/null
+++ b/Events/AllEvents/template/template/template.py
@@ -0,0 +1,39 @@
+"""
+template related API endpoints.
+"""
+
+from typing import Any, Dict
+from fastapi import Request
+
+from Events.Engine.abstract_class import MethodToEvent
+from Events.base_request_model import EndpointBaseRequestModel, ContextRetrievers
+from api_events import template_event
+
+
+AuthenticationLoginEventMethods = MethodToEvent(
+ name="AuthenticationLoginEventMethods",
+ events={
+ template_event.key: template_event,
+ },
+ headers=[],
+ errors=[],
+ url="/login",
+ method="POST",
+ summary="Login via domain and access key : [email] | [phone]",
+ description="Login to the system via domain, access key : [email] | [phone]",
+)
+
+
+def authentication_login_with_domain_and_creds_endpoint(
+ request: Request, data: EndpointBaseRequestModel
+) -> Dict[str, Any]:
+ event_2_catch = AuthenticationLoginEventMethods.retrieve_event(
+ event_function_code=f"{template_event.key}"
+ )
+ data = event_2_catch.REQUEST_VALIDATOR(**data.data)
+ return event_2_catch.endpoint_callable(request=request, data=data)
+
+
+AuthenticationLoginEventMethods.endpoint_callable = (
+ authentication_login_with_domain_and_creds_endpoint
+)
diff --git a/Events/AllEvents/validations/validation/api_events.py b/Events/AllEvents/validations/validation/api_events.py
new file mode 100644
index 0000000..000a7d5
--- /dev/null
+++ b/Events/AllEvents/validations/validation/api_events.py
@@ -0,0 +1,23 @@
+from Events.Engine.abstract_class import Event
+from ApiLayers.LanguageModels.Request import (
+ LoginRequestLanguageModel,
+)
+
+from models import TemplateResponseModels, TemplateRequestModels
+from function_handlers import TemplateFunctions
+
+
+# Auth Login
+template_event = Event(
+ name="authentication_login_super_user_event",
+ key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
+ request_validator=TemplateRequestModels.TemplateRequestModelX,
+ language_models=[LoginRequestLanguageModel],
+ response_validation_static="LOGIN_SUCCESS",
+ description="Login super user",
+)
+
+
+template_event.endpoint_callable = (
+ TemplateFunctions.template_example_function()
+)
diff --git a/Events/AllEvents/validations/validation/cluster.py b/Events/AllEvents/validations/validation/cluster.py
new file mode 100644
index 0000000..de5066b
--- /dev/null
+++ b/Events/AllEvents/validations/validation/cluster.py
@@ -0,0 +1,14 @@
+from Events.Engine.abstract_class import CategoryCluster
+from info import template_page_info
+
+
+TemplateCluster = CategoryCluster(
+ name="TemplateCluster",
+ tags=["template"],
+ prefix="/template",
+ description="Template cluster",
+ pageinfo=template_page_info,
+ endpoints={},
+ include_in_schema=True,
+ sub_category=[],
+)
diff --git a/Events/AllEvents/validations/validation/endpoints.py b/Events/AllEvents/validations/validation/endpoints.py
deleted file mode 100644
index 415c5f5..0000000
--- a/Events/AllEvents/validations/validation/endpoints.py
+++ /dev/null
@@ -1,128 +0,0 @@
-from typing import Dict, Any
-
-from .models import ValidationsPydantic
-from ErrorHandlers.Exceptions.api_exc import HTTPExceptionApi
-
-from .validation import (
- ValidationsBoth,
- ValidationsHeaders,
- ValidationsValidations,
-)
-from ApiEvents.abstract_class import RouteFactoryConfig, EndpointFactoryConfig
-from ApiEvents.base_request_model import EndpointBaseRequestModel
-from ApiLibrary.common.line_number import get_line_number_for_error
-
-from Services.PostgresDb.Models.alchemy_response import DictJsonResponse
-from fastapi import Request, Path, Body
-
-from middleware.token_event_middleware import TokenEventMiddleware
-
-
-prefix = "/validation"
-
-
-@TokenEventMiddleware.validation_required
-async def validations_validations_select(
- request: Request, data: EndpointBaseRequestModel
-) -> Dict[str, Any]:
- """
- Select validations.
- """
- wrapped_context = getattr(validations_validations_select, "__wrapped__", None)
- auth_context = getattr(wrapped_context, "auth", None)
- validation_code = getattr(
- validations_validations_select, "validation_code", {"validation_code": None}
- )
- if not validation_code:
- raise HTTPExceptionApi(
- error_code="",
- lang="en",
- loc=get_line_number_for_error(),
- sys_msg="Validation code not found",
- )
- validations_pydantic = ValidationsPydantic(
- class_model=validation_code.get("class", None),
- reachable_event_code=validation_code.get("reachable_event_code", None),
- lang=getattr(auth_context, "lang", None),
- )
- validations_both = ValidationsBoth.retrieve_both_validations_and_headers(
- validations_pydantic
- )
- return {"status": "OK", "validation_code": validation_code, **validations_both}
-
-
-@TokenEventMiddleware.validation_required
-async def validations_headers_select(
- request: Request, data: EndpointBaseRequestModel
-) -> Dict[str, Any]:
- """
- Select headers.
- """
- ValidationsHeaders.retrieve_headers()
- return {
- "status": "OK",
- }
-
-
-@TokenEventMiddleware.validation_required
-async def validations_validations_and_headers_select(
- request: Request, data: EndpointBaseRequestModel
-) -> Dict[str, Any]:
- """
- Select validations and headers.
- """
- ValidationsBoth.retrieve_both_validations_and_headers()
- return {
- "status": "OK",
- }
-
-
-VALIDATION_CONFIG_MAIN = RouteFactoryConfig(
- name="validations",
- prefix=prefix,
- tags=["Validation"],
- include_in_schema=True,
- endpoints=[
- EndpointFactoryConfig(
- url_prefix=prefix,
- url_endpoint="/select",
- url_of_endpoint=f"{prefix}/validations/select",
- endpoint="/select",
- method="POST",
- summary="Select company or occupant type",
- description="Select company or occupant type",
- is_auth_required=True, # Needs token_dict
- is_event_required=False,
- endpoint_function=validations_validations_select,
- ),
- EndpointFactoryConfig(
- url_prefix=prefix,
- url_endpoint="/headers/select",
- url_of_endpoint=f"{prefix}/headers/select",
- endpoint="/headers/select",
- method="POST",
- summary="Select company or occupant type",
- description="Select company or occupant type",
- is_auth_required=True, # Needs token_dict
- is_event_required=False,
- endpoint_function=validations_headers_select,
- ),
- EndpointFactoryConfig(
- url_prefix=prefix,
- url_endpoint="/both/select",
- url_of_endpoint=f"{prefix}/validationsAndHeaders/select",
- endpoint="/both/select",
- method="POST",
- summary="Select company or occupant type",
- description="Select company or occupant type",
- is_auth_required=True, # Needs token_dict
- is_event_required=False,
- endpoint_function=validations_validations_and_headers_select,
- ),
- ],
-)
-VALIDATION_CONFIG = VALIDATION_CONFIG_MAIN.as_dict()
-
-VALIDATION_ENDPOINTS = [
- endpoint.url_of_endpoint for endpoint in VALIDATION_CONFIG_MAIN.endpoints
-]
diff --git a/Events/AllEvents/validations/validation/function_handlers.py b/Events/AllEvents/validations/validation/function_handlers.py
new file mode 100644
index 0000000..cee881b
--- /dev/null
+++ b/Events/AllEvents/validations/validation/function_handlers.py
@@ -0,0 +1,21 @@
+from typing import Any, Union
+from fastapi import Request
+
+from Events.base_request_model import TokenDictType, BaseRouteModel
+
+
+class Handlers:
+ """Class for handling authentication functions"""
+
+ @classmethod # Requires no auth context
+ def handle_function(cls, **kwargs):
+ """Handle function with kwargs"""
+ return
+
+
+class TemplateFunctions(BaseRouteModel):
+ """Class for handling authentication functions"""
+
+ @classmethod
+ def template_example_function(cls):
+ return
diff --git a/Events/AllEvents/validations/validation/info.py b/Events/AllEvents/validations/validation/info.py
new file mode 100644
index 0000000..4ace812
--- /dev/null
+++ b/Events/AllEvents/validations/validation/info.py
@@ -0,0 +1,11 @@
+from Events.Engine.abstract_class import PageInfo
+
+
+template_page_info = PageInfo(
+ name="template",
+ title={"en": "template"},
+ description={"en": "template"},
+ icon="",
+ parent="",
+ url=""
+)
diff --git a/Events/AllEvents/validations/validation/models.py b/Events/AllEvents/validations/validation/models.py
index e31046e..3228b46 100644
--- a/Events/AllEvents/validations/validation/models.py
+++ b/Events/AllEvents/validations/validation/models.py
@@ -4,12 +4,7 @@ Validation records request and response models.
from typing import TYPE_CHECKING, Dict, Any
from pydantic import BaseModel, Field, RootModel
-from ApiEvents.base_request_model import BaseRequestModel
-if TYPE_CHECKING:
- from ApiValidations.Request import (
- ListOptions,
- )
class ValidationsPydantic(BaseModel):
@@ -18,13 +13,13 @@ class ValidationsPydantic(BaseModel):
lang: str
-class InsertValidationRecordRequestModel(BaseRequestModel):
+class InsertValidationRecordRequestModel:
pass
-class UpdateValidationRecordRequestModel(BaseRequestModel):
+class UpdateValidationRecordRequestModel:
pass
-class ListOptionsValidationRecordRequestModel(BaseRequestModel):
+class ListOptionsValidationRecordRequestModel:
pass