events started
This commit is contained in:
@@ -7,7 +7,7 @@ from .models import ValidationsPydantic
|
||||
from .function_handlers import RetrieveValidation
|
||||
|
||||
|
||||
# Auth Login
|
||||
# Validation Event
|
||||
validation_event = Event(
|
||||
name="validation_event",
|
||||
key="02b5a596-14ba-4361-90d7-c6755727c63f",
|
||||
@@ -23,3 +23,21 @@ def get_validation_by_event_function_code(request: Request, data: Any):
|
||||
|
||||
|
||||
validation_event.endpoint_callable = get_validation_by_event_function_code
|
||||
|
||||
|
||||
# Menu Event
|
||||
menu_event = Event(
|
||||
name="menu_event",
|
||||
key="a1613ca0-4843-498b-bfff-07ecea6777b2",
|
||||
request_validator=ValidationsPydantic,
|
||||
language_models=[],
|
||||
statics=None,
|
||||
description="Get Left Menu of the user",
|
||||
)
|
||||
|
||||
|
||||
def get_menu_by_event_function_code(request: Request, data: Any):
|
||||
return RetrieveValidation.retrieve_validation(data=data)
|
||||
|
||||
|
||||
menu_event.endpoint_callable = get_menu_by_event_function_code
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
|
||||
from .validation import ValidationEventMethods
|
||||
from .validation import (
|
||||
ValidationEventMethods,
|
||||
MenuEventMethods,
|
||||
)
|
||||
|
||||
|
||||
ValidationsCluster = CategoryCluster(
|
||||
@@ -10,6 +13,7 @@ ValidationsCluster = CategoryCluster(
|
||||
description="Validations cluster",
|
||||
endpoints={
|
||||
"ValidationEventMethods": ValidationEventMethods,
|
||||
"MenuEventMethods": MenuEventMethods,
|
||||
},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
template related API endpoints.
|
||||
Validation related API endpoints.
|
||||
"""
|
||||
|
||||
from typing import Any, Dict
|
||||
@@ -9,7 +9,7 @@ from Events.Engine.abstract_class import MethodToEvent
|
||||
from Events.base_request_model import EndpointBaseRequestModel, ContextRetrievers
|
||||
from ApiLayers.Middleware.auth_middleware import MiddlewareModule
|
||||
|
||||
from .api_events import validation_event
|
||||
from .api_events import validation_event, menu_event
|
||||
from .function_handlers import RetrieveValidation
|
||||
|
||||
|
||||
@@ -26,19 +26,41 @@ ValidationEventMethods = MethodToEvent(
|
||||
)
|
||||
|
||||
|
||||
def authentication_login_with_domain_and_creds_endpoint(
|
||||
def validations_endpoint(
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
function = ValidationEventMethods.retrieve_event(
|
||||
event_function_code=f"{validation_event.key}"
|
||||
)
|
||||
data = function.REQUEST_VALIDATOR(**data.data)
|
||||
RetrieveValidation.context_retriever = ContextRetrievers(
|
||||
func=authentication_login_with_domain_and_creds_endpoint
|
||||
)
|
||||
RetrieveValidation.context_retriever = ContextRetrievers(func=validations_endpoint)
|
||||
return function.endpoint_callable(request=request, data=data)
|
||||
|
||||
|
||||
ValidationEventMethods.endpoint_callable = (
|
||||
authentication_login_with_domain_and_creds_endpoint
|
||||
ValidationEventMethods.endpoint_callable = validations_endpoint
|
||||
|
||||
|
||||
MenuEventMethods = MethodToEvent(
|
||||
name="MenuEventMethods",
|
||||
events={menu_event.key: menu_event},
|
||||
headers=[],
|
||||
errors=[],
|
||||
url="/menu",
|
||||
method="POST",
|
||||
decorators_list=[MiddlewareModule.auth_required],
|
||||
summary="Get Left Menu of the user",
|
||||
description="Get Left Menu of the user",
|
||||
)
|
||||
|
||||
|
||||
def menu_endpoint(
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
function = ValidationEventMethods.retrieve_event(
|
||||
event_function_code=f"{menu_event.key}"
|
||||
)
|
||||
data = function.REQUEST_VALIDATOR(**data.data)
|
||||
RetrieveValidation.context_retriever = ContextRetrievers(func=validations_endpoint)
|
||||
return function.endpoint_callable(request=request, data=data)
|
||||
|
||||
MenuEventMethods.endpoint_callable = menu_endpoint
|
||||
|
||||
Reference in New Issue
Block a user