auth and token middleware context update
This commit is contained in:
@@ -135,11 +135,11 @@ class MethodToEvent:
|
||||
return found_event
|
||||
raise ValueError(f"Event with function code {event_function_code} not found")
|
||||
|
||||
def retrieve_redis_value(self, cluster_name: str) -> Dict:
|
||||
def retrieve_redis_value(self, cluster: "CategoryCluster") -> Dict:
|
||||
"""
|
||||
Key("METHOD_FUNCTION_CODES:{ClusterToMethod}:MethodEvent:Endpoint") : Value([FUNCTION_CODE, ...])
|
||||
"""
|
||||
redis_key = f"{RedisCategoryKeys.METHOD_FUNCTION_CODES}:{cluster_name}:{self.name}:{self.URL}"
|
||||
redis_key = f"{RedisCategoryKeys.METHOD_FUNCTION_CODES}:{cluster.name}:{self.name}:{f"{cluster.PREFIX}{self.URL}"}"
|
||||
return {redis_key: self.retrieve_all_event_keys()}
|
||||
|
||||
@staticmethod
|
||||
@@ -156,8 +156,8 @@ class CategoryCluster:
|
||||
PREFIX: str
|
||||
PAGEINFO: PageInfo
|
||||
DESCRIPTION: str
|
||||
ENDPOINTS: list[MethodToEvent] # [MethodToEvent, ...]
|
||||
SUBCATEGORY: Optional[List["CategoryCluster"]] # [CategoryCluster, ...]
|
||||
ENDPOINTS: dict[str, MethodToEvent] # {"MethodToEvent": MethodToEvent, ...}
|
||||
SUBCATEGORY: Optional[List["CategoryCluster"]] # [CategoryCluster, ...]
|
||||
INCLUDE_IN_SCHEMA: Optional[bool] = True
|
||||
|
||||
def __init__(
|
||||
@@ -167,7 +167,7 @@ class CategoryCluster:
|
||||
prefix: str,
|
||||
description: str,
|
||||
pageinfo: PageInfo,
|
||||
endpoints: list[MethodToEvent],
|
||||
endpoints: dict[str, MethodToEvent],
|
||||
sub_category: list,
|
||||
include_in_schema: Optional[bool] = True,
|
||||
):
|
||||
@@ -176,7 +176,7 @@ class CategoryCluster:
|
||||
self.PREFIX = prefix
|
||||
self.PAGEINFO = pageinfo
|
||||
self.DESCRIPTION = description
|
||||
self.ENDPOINTS = endpoints or []
|
||||
self.ENDPOINTS = endpoints or {}
|
||||
self.SUBCATEGORY = sub_category or []
|
||||
self.INCLUDE_IN_SCHEMA = include_in_schema
|
||||
|
||||
@@ -189,7 +189,7 @@ class CategoryCluster:
|
||||
RedisCategoryKeys.CLUSTER_2_METHOD_EVENT
|
||||
Returns the class name and function codes for the class.
|
||||
"""
|
||||
dict_cluster_2_method, list_endpoints = {}, [i.name for i in self.ENDPOINTS]
|
||||
dict_cluster_2_method, list_endpoints = {}, [i.name for i in self.ENDPOINTS.values()]
|
||||
for endpoint_name in list_endpoints:
|
||||
dict_cluster_2_method[endpoint_name] = self.name
|
||||
dict_cluster_2_method[self.name] = list_endpoints
|
||||
@@ -200,7 +200,7 @@ class CategoryCluster:
|
||||
Retrieves all function codes by iterating over the events list.
|
||||
"""
|
||||
all_function_codes = []
|
||||
for event_method in self.ENDPOINTS:
|
||||
for event_method in self.ENDPOINTS.values():
|
||||
all_function_codes.extend([str(event_key) for event_key in event_method.EVENTS.keys()])
|
||||
return all_function_codes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user