41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""
|
|
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 ApiLayers.Middleware.auth_middleware import MiddlewareModule
|
|
|
|
from .api_events import validation_event
|
|
from .function_handlers import RetrieveValidation
|
|
|
|
|
|
ValidationEventMethods = MethodToEvent(
|
|
name="ValidationEventMethods",
|
|
events={validation_event.key: validation_event},
|
|
headers=[],
|
|
errors=[],
|
|
url="/validations",
|
|
method="POST",
|
|
decorators_list=[MiddlewareModule.auth_required],
|
|
summary="Get Validations by event function code",
|
|
description="Get Validations by event function code by All, Header, Validation & request url",
|
|
)
|
|
|
|
|
|
def authentication_login_with_domain_and_creds_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)
|
|
return function.endpoint_callable(request=request, data=data)
|
|
|
|
|
|
ValidationEventMethods.endpoint_callable = (
|
|
authentication_login_with_domain_and_creds_endpoint
|
|
)
|