auth updated routes tested & password is not yet tested

This commit is contained in:
2025-01-29 15:58:42 +03:00
parent a0b1b1bef9
commit f7eedb5ea0
11 changed files with 147 additions and 84 deletions

View File

@@ -13,11 +13,10 @@ from ApiLayers.ApiValidations.Custom.token_objects import (
OccupantTokenObject,
)
from ApiLayers.ApiValidations.Custom.wrapper_contexts import AuthContext, EventContext
from ApiLayers.AllConfigs.Token.config import Auth
TokenDictType = Union[
EmployeeTokenObject, OccupantTokenObject
] # Type aliases for common types
TokenDictType = Union[EmployeeTokenObject, OccupantTokenObject]
class EndpointBaseRequestModel(BaseModel):
@@ -81,3 +80,13 @@ class ContextRetrievers:
def base(self) -> Optional[dict[str, Any]]:
"""Retrieve base request model from a function."""
return getattr(self.context, "base", None)
@property
def get_token(self) -> Optional[str]:
"""Retrieve access key from a function."""
return getattr(self.request, "headers", {}).get(Auth.ACCESS_TOKEN_TAG, None)
class BaseRouteModel:
context_retriever: Union[ContextRetrievers] = None