155 lines
6.2 KiB
Python
155 lines
6.2 KiB
Python
from uuid import UUID
|
|
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,
|
|
handle_employee_selection,
|
|
handle_occupant_selection,
|
|
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,
|
|
)
|
|
|
|
|
|
# Auth Login
|
|
authentication_login_super_user_event = Event(
|
|
key=UUID("a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e"),
|
|
request_validator=LoginSuperUserRequestModel,
|
|
response_validator=LoginSuperUserResponseModel,
|
|
description="Login super user",
|
|
)
|
|
authentication_login_super_user_event.endpoint_callable = authentication_login_with_domain_and_creds
|
|
|
|
# Auth Select Company or Occupant Type
|
|
authentication_select_company_or_occupant_type_super_user_event = Event(
|
|
key=UUID("a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e"),
|
|
request_validator=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_employee_selection_super_user_event = Event(
|
|
key=UUID("a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e"),
|
|
request_validator=EmployeeSelectionSuperUserRequestModel,
|
|
response_validator=EmployeeSelectionSuperUserResponseModel,
|
|
description="Employee selection super user",
|
|
)
|
|
authentication_employee_selection_super_user_event.endpoint_callable = handle_employee_selection
|
|
|
|
authentication_occupant_selection_super_user_event = Event(
|
|
key=UUID("a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e"),
|
|
request_validator=OccupantSelectionSuperUserRequestModel,
|
|
response_validator=OccupantSelectionSuperUserResponseModel,
|
|
description="Occupant selection super user",
|
|
)
|
|
authentication_occupant_selection_super_user_event.endpoint_callable = handle_occupant_selection
|
|
|
|
# Check Token Validity
|
|
authentication_check_token_event = Event(
|
|
key=UUID("b6e3d1e2-4f9c-5c1g-9d8e-7e5f6f5e5d5f"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Check if token is valid",
|
|
)
|
|
authentication_check_token_event.endpoint_callable = authentication_check_token_is_valid
|
|
|
|
# Refresh User Info
|
|
authentication_refresh_user_info_event = Event(
|
|
key=UUID("c7f4e2f3-5g0d-6d2h-0e9f-8f6g7g6f6e6g"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Refresh user information",
|
|
)
|
|
authentication_refresh_user_info_event.endpoint_callable = authentication_refresh_user_info
|
|
|
|
# Change Password
|
|
authentication_change_password_event = Event(
|
|
key=UUID("d8g5f3g4-6h1e-7e3i-1f0g-9g7h8h7g7f7h"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Change user password",
|
|
)
|
|
authentication_change_password_event.endpoint_callable = authentication_change_password
|
|
|
|
# Create Password
|
|
authentication_create_password_event = Event(
|
|
key=UUID("e9h6g4h5-7i2f-8f4j-2g1h-0h8i9i8h8g8i"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Create new password",
|
|
)
|
|
authentication_create_password_event.endpoint_callable = authentication_create_password
|
|
|
|
# Disconnect User
|
|
authentication_disconnect_user_event = Event(
|
|
key=UUID("f0i7h5i6-8j3g-9g5k-3h2i-1i9j0j9i9h9j"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Disconnect all user sessions",
|
|
)
|
|
authentication_disconnect_user_event.endpoint_callable = authentication_disconnect_user
|
|
|
|
# Logout User
|
|
authentication_logout_user_event = Event(
|
|
key=UUID("g1j8i6j7-9k4h-0h6l-4i3j-2j0k1k0j0i0k"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Logout user session",
|
|
)
|
|
authentication_logout_user_event.endpoint_callable = authentication_logout_user
|
|
|
|
# Refresh Token
|
|
authentication_refresher_token_event = Event(
|
|
key=UUID("h2k9j7k8-0l5i-1i7m-5j4k-3k1l2l1k1j1l"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Refresh authentication token",
|
|
)
|
|
authentication_refresher_token_event.endpoint_callable = authentication_refresher_token
|
|
|
|
# Forgot Password
|
|
authentication_forgot_password_event = Event(
|
|
key=UUID("i3l0k8l9-1m6j-2j8n-6k5l-4l2m3m2l2k2m"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Request password reset",
|
|
)
|
|
authentication_forgot_password_event.endpoint_callable = authentication_forgot_password
|
|
|
|
# Reset Password
|
|
authentication_reset_password_event = Event(
|
|
key=UUID("j4m1l9m0-2n7k-3k9o-7l6m-5m3n4n3m3l3n"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Reset user password",
|
|
)
|
|
authentication_reset_password_event.endpoint_callable = authentication_reset_password
|
|
|
|
# Download Avatar
|
|
authentication_download_avatar_event = Event(
|
|
key=UUID("k5n2m0n1-3o8l-4l0p-8m7n-6n4o5o4n4m4o"),
|
|
request_validator=None, # TODO: Add request validator
|
|
response_validator=None, # TODO: Add response validator
|
|
description="Download user avatar and profile info",
|
|
)
|
|
authentication_download_avatar_event.endpoint_callable = authentication_download_avatar
|