40 lines
1.1 KiB
Python
40 lines
1.1 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 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
|
|
)
|