language models and set defaults are updated
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Authentication related API endpoints.
|
||||
"""
|
||||
|
||||
from typing import Any, Dict
|
||||
from fastapi import Request
|
||||
|
||||
@@ -40,7 +41,7 @@ AuthenticationLoginEventMethods = MethodToEvent(
|
||||
|
||||
|
||||
def authentication_login_with_domain_and_creds_endpoint(
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
event_2_catch = AuthenticationLoginEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_login_super_user_event.key}"
|
||||
@@ -70,21 +71,27 @@ AuthenticationSelectEventMethods = MethodToEvent(
|
||||
|
||||
|
||||
def authentication_select_company_or_occupant_type(
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Select company or occupant type.
|
||||
"""
|
||||
context_retriever = ContextRetrievers(func=authentication_select_company_or_occupant_type)
|
||||
context_retriever = ContextRetrievers(
|
||||
func=authentication_select_company_or_occupant_type
|
||||
)
|
||||
function = AuthenticationSelectEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_select_super_user_event.key}"
|
||||
)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
data_model = None
|
||||
if context_retriever.token.is_employee:
|
||||
data_model = function.REQUEST_VALIDATOR.get('EmployeeSelection', None)(**data.data)
|
||||
data_model = function.REQUEST_VALIDATOR.get("EmployeeSelection", None)(
|
||||
**data.data
|
||||
)
|
||||
elif context_retriever.token.is_occupant:
|
||||
data_model = function.REQUEST_VALIDATOR.get('OccupantSelection', None)(**data.data)
|
||||
data_model = function.REQUEST_VALIDATOR.get("OccupantSelection", None)(
|
||||
**data.data
|
||||
)
|
||||
return function.endpoint_callable(data=data_model)
|
||||
|
||||
|
||||
@@ -163,7 +170,9 @@ AuthenticationChangePasswordEventMethods = MethodToEvent(
|
||||
|
||||
|
||||
def authentication_change_password_event_callable(data: EndpointBaseRequestModel):
|
||||
context_retriever = ContextRetrievers(func=authentication_change_password_event_callable)
|
||||
context_retriever = ContextRetrievers(
|
||||
func=authentication_change_password_event_callable
|
||||
)
|
||||
function = AuthenticationChangePasswordEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_change_password_event.key}"
|
||||
)
|
||||
@@ -177,7 +186,7 @@ AuthenticationChangePasswordEventMethods.endpoint_callable = (
|
||||
|
||||
AuthenticationCreatePasswordEventMethods = MethodToEvent(
|
||||
name="AuthenticationCreatePasswordEventMethods",
|
||||
events={authentication_create_password_event: authentication_create_password_event},
|
||||
events={authentication_create_password_event.key: authentication_create_password_event},
|
||||
headers=[],
|
||||
errors=[],
|
||||
url="/create-password",
|
||||
|
||||
Reference in New Issue
Block a user