black shift
This commit is contained in:
@@ -22,7 +22,7 @@ def people_route_list(
|
||||
List people endpoint
|
||||
"""
|
||||
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||
FoundCluster = PeopleRouterCluster.get_event_cluster("PeopleList")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
@@ -41,7 +41,7 @@ def people_route_create(
|
||||
Create people endpoint
|
||||
"""
|
||||
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||
FoundCluster = PeopleRouterCluster.get_event_cluster("PeopleCreate")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
@@ -60,7 +60,7 @@ def people_route_update(
|
||||
Update people endpoint
|
||||
"""
|
||||
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||
FoundCluster = PeopleRouterCluster.get_event_cluster("PeopleUpdate")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
|
||||
@@ -4,10 +4,8 @@ from fastapi import APIRouter
|
||||
def get_routes() -> list[APIRouter]:
|
||||
from .people.route import people_route
|
||||
from .user.route import user_route
|
||||
return [
|
||||
user_route,
|
||||
people_route
|
||||
]
|
||||
|
||||
return [user_route, people_route]
|
||||
|
||||
|
||||
def get_safe_endpoint_urls() -> list[tuple[str, str]]:
|
||||
|
||||
@@ -28,7 +28,9 @@ def user_list_route(
|
||||
endpoint_code = "5bc09312-d3f2-4f47-baba-17c928706da8"
|
||||
token = request.headers.get(api_config.ACCESS_TOKEN_TAG, None)
|
||||
token_object = TokenProvider.get_dict_from_redis(token=token)
|
||||
event_key = TokenProvider.retrieve_event_codes(endpoint_code=endpoint_code, token=token_object)
|
||||
event_key = TokenProvider.retrieve_event_codes(
|
||||
endpoint_code=endpoint_code, token=token_object
|
||||
)
|
||||
headers = {
|
||||
"language": language or "",
|
||||
"domain": domain or "",
|
||||
@@ -36,7 +38,9 @@ def user_list_route(
|
||||
"tz": tz or "GMT+3",
|
||||
"token": token,
|
||||
}
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster("UserList").match_event(event_key=event_key)
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster("UserList").match_event(
|
||||
event_key=event_key
|
||||
)
|
||||
response.headers["X-Header"] = "Test Header GET"
|
||||
if runner_callable := event_cluster_matched.event_callable():
|
||||
return runner_callable
|
||||
@@ -71,7 +75,9 @@ def user_create_route(
|
||||
"tz": tz or "GMT+3",
|
||||
"token": token,
|
||||
}
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster("UserCreate").match_event(event_key=event_key)
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster(
|
||||
"UserCreate"
|
||||
).match_event(event_key=event_key)
|
||||
response.headers["X-Header"] = "Test Header POST"
|
||||
if runner_callable := event_cluster_matched.event_callable():
|
||||
return runner_callable
|
||||
@@ -100,7 +106,9 @@ def user_update_route(request: Request, response: Response):
|
||||
"tz": tz or "GMT+3",
|
||||
"token": token,
|
||||
}
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster("UserUpdate").match_event(event_key=event_key)
|
||||
event_cluster_matched = UserRouterCluster.get_event_cluster(
|
||||
"UserUpdate"
|
||||
).match_event(event_key=event_key)
|
||||
response.headers["X-Header"] = "Test Header POST"
|
||||
if runner_callable := event_cluster_matched.event_callable():
|
||||
return runner_callable
|
||||
|
||||
@@ -2,31 +2,24 @@ from ApiControllers.abstracts.event_clusters import EventCluster, RouterCluster
|
||||
from .supers_events import (
|
||||
SupersPeopleCreateEvent,
|
||||
SupersPeopleUpdateEvent,
|
||||
SupersPeopleListEvent
|
||||
SupersPeopleListEvent,
|
||||
)
|
||||
|
||||
PeopleRouterCluster = RouterCluster(
|
||||
name="PeopleRouterCluster"
|
||||
)
|
||||
PeopleRouterCluster = RouterCluster(name="PeopleRouterCluster")
|
||||
|
||||
PeopleEventClusterList = EventCluster(
|
||||
name="PeopleList",
|
||||
endpoint_uu_id="f102db46-031a-43e4-966a-dae6896f985b"
|
||||
name="PeopleList", endpoint_uu_id="f102db46-031a-43e4-966a-dae6896f985b"
|
||||
)
|
||||
PeopleEventClusterList.add_event(SupersPeopleListEvent)
|
||||
PeopleEventClusterCreate = EventCluster(
|
||||
name="PeopleCreate",
|
||||
endpoint_uu_id="eb465fde-337f-4b81-94cf-28c6d4f2b1b6"
|
||||
name="PeopleCreate", endpoint_uu_id="eb465fde-337f-4b81-94cf-28c6d4f2b1b6"
|
||||
)
|
||||
PeopleEventClusterCreate.add_event(SupersPeopleCreateEvent)
|
||||
PeopleEventClusterUpdate = EventCluster(
|
||||
name="PeopleUpdate",
|
||||
endpoint_uu_id="c9e5ba69-6915-43f5-8f9c-a5c2aa865b89"
|
||||
name="PeopleUpdate", endpoint_uu_id="c9e5ba69-6915-43f5-8f9c-a5c2aa865b89"
|
||||
)
|
||||
PeopleEventClusterUpdate.add_event(SupersPeopleUpdateEvent)
|
||||
|
||||
PeopleRouterCluster.set_event_cluster(PeopleEventClusterList)
|
||||
PeopleRouterCluster.set_event_cluster(PeopleEventClusterCreate)
|
||||
PeopleRouterCluster.set_event_cluster(PeopleEventClusterUpdate)
|
||||
|
||||
|
||||
|
||||
@@ -1,29 +1,24 @@
|
||||
from ApiControllers.abstracts.event_clusters import EventCluster, RouterCluster
|
||||
from .supers_events import (
|
||||
SuperUsersListEvent,
|
||||
SuperUsersCreateEvent,
|
||||
SuperUsersListEvent,
|
||||
SuperUsersCreateEvent,
|
||||
SuperUsersUpdateEvent,
|
||||
)
|
||||
|
||||
UserRouterCluster = RouterCluster(
|
||||
name="UserRouterCluster"
|
||||
)
|
||||
UserRouterCluster = RouterCluster(name="UserRouterCluster")
|
||||
|
||||
UserEventClusterList = EventCluster(
|
||||
name="UserList",
|
||||
endpoint_uu_id="5bc09312-d3f2-4f47-baba-17c928706da8"
|
||||
name="UserList", endpoint_uu_id="5bc09312-d3f2-4f47-baba-17c928706da8"
|
||||
)
|
||||
UserEventClusterList.add_event(SuperUsersListEvent)
|
||||
|
||||
UserEventClusterCreate = EventCluster(
|
||||
name="UserCreate",
|
||||
endpoint_uu_id="08d4b572-1584-47bb-aa42-8d068e5514e7"
|
||||
name="UserCreate", endpoint_uu_id="08d4b572-1584-47bb-aa42-8d068e5514e7"
|
||||
)
|
||||
UserEventClusterCreate.add_event(SuperUsersCreateEvent)
|
||||
|
||||
UserEventClusterUpdate = EventCluster(
|
||||
name="UserUpdate",
|
||||
endpoint_uu_id="b641236a-928d-4f19-a1d2-5edf611d1e56"
|
||||
name="UserUpdate", endpoint_uu_id="b641236a-928d-4f19-a1d2-5edf611d1e56"
|
||||
)
|
||||
UserEventClusterUpdate.add_event(SuperUsersUpdateEvent)
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ def supers_users_create_callable():
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
SuperUsersCreateEvent.event_callable = supers_users_create_callable
|
||||
|
||||
# Update endpoint
|
||||
@@ -96,4 +97,5 @@ def supers_users_update_callable():
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
SuperUsersUpdateEvent.event_callable = supers_users_update_callable
|
||||
|
||||
Reference in New Issue
Block a user