auth response and error codes imp

This commit is contained in:
2025-01-28 21:35:52 +03:00
parent 8550c2af71
commit a0b1b1bef9
16 changed files with 639 additions and 314 deletions

View File

@@ -18,8 +18,7 @@ class PageInfo:
title: Dict[str, Any],
description: Dict[str, Any],
icon: str,
parent: str,
url: str,
parent: str
):
self.NAME = name
self.TITLE = title
@@ -35,6 +34,7 @@ class Event:
REQUEST_VALIDATOR: Optional[Any]
DESCRIPTION: str
LANGUAGE_MODELS: list
RESPONSE_VALIDATOR_STATIC: str
EXTRA_OPTIONS: Optional[Dict[str, Any]] = None
endpoint_callable: Any
@@ -44,6 +44,7 @@ class Event:
key: str | UUID,
description: str,
language_models: list[Dict[str, Dict]],
response_validation_static: str = None,
request_validator: Optional[Any] = None,
response_validator: Optional[Any] = None,
extra_options: Optional[Dict[str, Any]] = None,
@@ -52,17 +53,29 @@ class Event:
self.KEY_ = key
self.REQUEST_VALIDATOR = request_validator
self.RESPONSE_VALIDATOR = response_validator
self.RESPONSE_VALIDATOR_STATIC = response_validation_static
self.LANGUAGE_MODELS = language_models
self.DESCRIPTION = description
self.EXTRA_OPTIONS = extra_options
@property
def request_headers(self):
return self.LANGUAGE_MODELS
def is_static_response(self):
return bool(self.RESPONSE_VALIDATOR_STATIC)
@property
def response_headers(self):
return self.LANGUAGE_MODELS
def static_response(self):
from Services.Redis.Actions.actions import RedisActions
from ApiLayers.AllConfigs.Redis.configs import RedisValidationKeysAction
if self.is_static_response:
static_response = RedisActions.get_json(
list_keys=[
f"{RedisValidationKeysAction.static_response_key}:{self.RESPONSE_VALIDATOR_STATIC}"
]
)
if static_response.status:
return static_response.first
return None
@property
def description(self):