middleware and respnse models updated

This commit is contained in:
2025-01-27 17:25:49 +03:00
parent e403993d24
commit b88f910a43
54 changed files with 1125 additions and 808 deletions

View File

@@ -1,56 +1,39 @@
from Events.Engine.abstract_class import Event
from .models import (
LoginSuperUserRequestModel,
LoginSuperUserResponseModel,
SelectCompanyOrOccupantTypeSuperUserRequestModel,
SelectCompanyOrOccupantTypeSuperUserResponseModel,
EmployeeSelectionSuperUserRequestModel,
EmployeeSelectionSuperUserResponseModel,
OccupantSelectionSuperUserRequestModel,
OccupantSelectionSuperUserResponseModel,
)
from .function_handlers import (
authentication_login_with_domain_and_creds,
authentication_select_company_or_occupant_type,
authentication_check_token_is_valid,
authentication_refresh_user_info,
authentication_change_password,
authentication_create_password,
authentication_disconnect_user,
authentication_logout_user,
authentication_refresher_token,
authentication_forgot_password,
authentication_reset_password,
authentication_download_avatar,
)
from .models import AuthenticationRequestModels, AuthenticationResponseModels
from .function_handlers import AuthenticationFunctions
# Auth Login
authentication_login_super_user_event = Event(
name="authentication_login_super_user_event",
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
request_validator=LoginSuperUserRequestModel,
request_validator=AuthenticationRequestModels.LoginSuperUserRequestModel,
# response_validator=LoginSuperUserResponseModel,
description="Login super user",
)
authentication_login_super_user_event.endpoint_callable = (
authentication_login_with_domain_and_creds
AuthenticationFunctions.authentication_login_with_domain_and_creds
)
# Auth Select Company or Occupant Type
authentication_select_company_or_occupant_type_super_user_event = Event(
name="authentication_select_company_or_occupant_type_super_user_event",
authentication_select_super_user_event = Event(
name="authentication_select_super_user_event",
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
request_validator=SelectCompanyOrOccupantTypeSuperUserRequestModel,
request_validator=AuthenticationRequestModels.SelectCompanyOrOccupantTypeSuperUserRequestModel,
# response_validator=SelectCompanyOrOccupantTypeSuperUserResponseModel,
description="Select company or occupant type super user",
)
authentication_select_company_or_occupant_type_super_user_event.endpoint_callable = (
authentication_select_company_or_occupant_type
authentication_select_super_user_event.endpoint_callable = (
AuthenticationFunctions.authentication_select_company_or_occupant_type
)
# Check Token Validity
authentication_check_token_event = Event(
name="authentication_check_token_event",
@@ -59,7 +42,12 @@ authentication_check_token_event = Event(
# response_validator=None, # TODO: Add response validator
description="Check if token is valid",
)
authentication_check_token_event.endpoint_callable = authentication_check_token_is_valid
authentication_check_token_event.endpoint_callable = (
AuthenticationFunctions.authentication_check_token_is_valid
)
# Refresh User Info
authentication_refresh_user_info_event = Event(
@@ -69,10 +57,13 @@ authentication_refresh_user_info_event = Event(
# response_validator=None, # TODO: Add response validator
description="Refresh user information",
)
authentication_refresh_user_info_event.endpoint_callable = (
authentication_refresh_user_info
AuthenticationFunctions.authentication_refresh_user_info
)
# Change Password
authentication_change_password_event = Event(
name="authentication_change_password_event",
@@ -81,7 +72,12 @@ authentication_change_password_event = Event(
# response_validator=None, # TODO: Add response validator
description="Change user password",
)
authentication_change_password_event.endpoint_callable = authentication_change_password
authentication_change_password_event.endpoint_callable = (
AuthenticationFunctions.authentication_change_password
)
# Create Password
authentication_create_password_event = Event(
@@ -91,7 +87,12 @@ authentication_create_password_event = Event(
# response_validator=None, # TODO: Add response validator
description="Create new password",
)
authentication_create_password_event.endpoint_callable = authentication_create_password
authentication_create_password_event.endpoint_callable = (
AuthenticationFunctions.authentication_create_password
)
# Disconnect User
authentication_disconnect_user_event = Event(
@@ -101,7 +102,12 @@ authentication_disconnect_user_event = Event(
# response_validator=None, # TODO: Add response validator
description="Disconnect all user sessions",
)
authentication_disconnect_user_event.endpoint_callable = authentication_disconnect_user
authentication_disconnect_user_event.endpoint_callable = (
AuthenticationFunctions.authentication_disconnect_user
)
# Logout User
authentication_logout_user_event = Event(
@@ -111,7 +117,12 @@ authentication_logout_user_event = Event(
# response_validator=None, # TODO: Add response validator
description="Logout user session",
)
authentication_logout_user_event.endpoint_callable = authentication_logout_user
authentication_logout_user_event.endpoint_callable = (
AuthenticationFunctions.authentication_logout_user
)
# Refresh Token
authentication_refresher_token_event = Event(
@@ -121,7 +132,12 @@ authentication_refresher_token_event = Event(
# response_validator=None, # TODO: Add response validator
description="Refresh authentication token",
)
authentication_refresher_token_event.endpoint_callable = authentication_refresher_token
authentication_refresher_token_event.endpoint_callable = (
AuthenticationFunctions.authentication_refresher_token
)
# Forgot Password
authentication_forgot_password_event = Event(
@@ -131,7 +147,12 @@ authentication_forgot_password_event = Event(
# response_validator=None, # TODO: Add response validator
description="Request password reset",
)
authentication_forgot_password_event.endpoint_callable = authentication_forgot_password
authentication_forgot_password_event.endpoint_callable = (
AuthenticationFunctions.authentication_forgot_password
)
# Reset Password
authentication_reset_password_event = Event(
@@ -141,7 +162,12 @@ authentication_reset_password_event = Event(
# response_validator=None, # TODO: Add response validator
description="Reset user password",
)
authentication_reset_password_event.endpoint_callable = authentication_reset_password
authentication_reset_password_event.endpoint_callable = (
AuthenticationFunctions.authentication_reset_password
)
# Download Avatar
authentication_download_avatar_event = Event(
@@ -151,4 +177,8 @@ authentication_download_avatar_event = Event(
# response_validator=None, # TODO: Add response validator
description="Download user avatar and profile info",
)
authentication_download_avatar_event.endpoint_callable = authentication_download_avatar
authentication_download_avatar_event.endpoint_callable = (
AuthenticationFunctions.authentication_download_avatar
)