events started
This commit is contained in:
@@ -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