people endpoints and super user events built
This commit is contained in:
90
ApiServices/IdentityService/endpoints/user/route.py
Normal file
90
ApiServices/IdentityService/endpoints/user/route.py
Normal file
@@ -0,0 +1,90 @@
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter, Request, Response, Header
|
||||
|
||||
from ApiServices.IdentityService.config import api_config
|
||||
from ApiServices.IdentityService.events.user.event import supers_users_list
|
||||
|
||||
|
||||
user_route = APIRouter(prefix="/user", tags=["User"])
|
||||
|
||||
|
||||
@user_route.post(
|
||||
path="/list",
|
||||
description="Test Template Route",
|
||||
operation_id="5bc09312-d3f2-4f47-baba-17c928706da8",
|
||||
)
|
||||
def test_template(
|
||||
request: Request,
|
||||
response: Response,
|
||||
language: str = Header(None, alias="language"),
|
||||
domain: str = Header(None, alias="domain"),
|
||||
tz: str = Header(None, alias="timezone"),
|
||||
):
|
||||
"""
|
||||
Test Template Route
|
||||
"""
|
||||
event_code = "bb20c8c6-a289-4cab-9da7-34ca8a36c8e5"
|
||||
token = request.headers.get(api_config.ACCESS_TOKEN_TAG, None)
|
||||
headers = {
|
||||
"language": language or "",
|
||||
"domain": domain or "",
|
||||
"eys-ext": f"{str(uuid.uuid4())}",
|
||||
"tz": tz or "GMT+3",
|
||||
"token": token,
|
||||
}
|
||||
event_cluster_matched = supers_users_list.match_event(
|
||||
event_keys=[
|
||||
"3f510dcf-9f84-4eb9-b919-f582f30adab1",
|
||||
"9f403034-deba-4e1f-b43e-b25d3c808d39",
|
||||
"b8ec6e64-286a-4f60-8554-7a3865454944",
|
||||
]
|
||||
)
|
||||
response.headers["X-Header"] = "Test Header GET"
|
||||
if runner_callable := event_cluster_matched.example_callable():
|
||||
return runner_callable
|
||||
raise ValueError("Event key not found or multiple matches found")
|
||||
|
||||
|
||||
@user_route.post(
|
||||
path="/create",
|
||||
description="Test Template Route with Post Method",
|
||||
operation_id="08d4b572-1584-47bb-aa42-8d068e5514e7",
|
||||
)
|
||||
def test_template_post(request: Request, response: Response):
|
||||
"""
|
||||
Test Template Route with Post Method
|
||||
"""
|
||||
event_cluster_matched = supers_users_list.match_event(
|
||||
event_keys=[
|
||||
"3f510dcf-9f84-4eb9-b919-f582f30adab1",
|
||||
"9f403034-deba-4e1f-b43e-b25d3c808d39",
|
||||
"b8ec6e64-286a-4f60-8554-7a3865454944",
|
||||
]
|
||||
)
|
||||
response.headers["X-Header"] = "Test Header POST"
|
||||
if runner_callable := event_cluster_matched.example_callable():
|
||||
return runner_callable
|
||||
raise ValueError("Event key not found or multiple matches found")
|
||||
|
||||
|
||||
@user_route.post(
|
||||
path="/update",
|
||||
description="Test Template Route with Post Method",
|
||||
operation_id="b641236a-928d-4f19-a1d2-5edf611d1e56",
|
||||
)
|
||||
def test_template_post(request: Request, response: Response):
|
||||
"""
|
||||
Test Template Route with Post Method
|
||||
"""
|
||||
event_cluster_matched = supers_users_list.match_event(
|
||||
event_keys=[
|
||||
"3f510dcf-9f84-4eb9-b919-f582f30adab1",
|
||||
"9f403034-deba-4e1f-b43e-b25d3c808d39",
|
||||
"b8ec6e64-286a-4f60-8554-7a3865454944",
|
||||
]
|
||||
)
|
||||
response.headers["X-Header"] = "Test Header POST"
|
||||
if runner_callable := event_cluster_matched.example_callable():
|
||||
return runner_callable
|
||||
raise ValueError("Event key not found or multiple matches found")
|
||||
Reference in New Issue
Block a user