1818from .models .errored_models import ErroredRequestModel , ErroredResponseModel
1919from .controller .errored_state import errored_state
2020
21- from .models .graph_models import UpsertGraphTemplateRequest , UpsertGraphTemplateResponse
22- from .controller .upsert_graph_template import upsert_graph_template as upsert_graph_template_controller
23-
2421
2522
2623logger = LogsManager ().get_logger ()
2724
28- router = APIRouter (prefix = "/v0/namespace/{namespace_name}" , tags = ["state" ])
25+ router = APIRouter (prefix = "/v0/namespace/{namespace_name}/states " , tags = ["state" ])
2926
3027
3128@router .post (
32- "/states/ enqueue" ,
29+ "/enqueue" ,
3330 response_model = EnqueueResponseModel ,
3431 status_code = status .HTTP_200_OK ,
3532 response_description = "State enqueued on node queue successfully"
@@ -48,7 +45,7 @@ async def enqueue_state(namespace_name: str, body: EnqueueRequestModel, request:
4845
4946
5047@router .post (
51- "/states/ create" ,
48+ "/create" ,
5249 response_model = CreateResponseModel ,
5350 status_code = status .HTTP_200_OK ,
5451 response_description = "States created successfully"
@@ -67,7 +64,7 @@ async def create_state(namespace_name: str, body: CreateRequestModel, request: R
6764
6865
6966@router .post (
70- "/states/ {state_id}/executed" ,
67+ "/{state_id}/executed" ,
7168 response_model = ExecutedResponseModel ,
7269 status_code = status .HTTP_200_OK ,
7370 response_description = "State executed successfully"
@@ -86,7 +83,7 @@ async def executed_state_route(namespace_name: str, state_id: str, body: Execute
8683
8784
8885@router .post (
89- "/states/ {state_id}/errored" ,
86+ "/{state_id}/errored" ,
9087 response_model = ErroredResponseModel ,
9188 status_code = status .HTTP_200_OK ,
9289 response_description = "State errored successfully"
@@ -101,22 +98,4 @@ async def errored_state_route(namespace_name: str, state_id: str, body: ErroredR
10198 logger .error (f"API key is invalid for namespace { namespace_name } " , x_exosphere_request_id = x_exosphere_request_id )
10299 raise HTTPException (status_code = status .HTTP_401_UNAUTHORIZED , detail = "Invalid API key" )
103100
104- return await errored_state (namespace_name , ObjectId (state_id ), body , x_exosphere_request_id )
105-
106-
107- @router .put (
108- "/graph-templates/{graph_name}" ,
109- response_model = UpsertGraphTemplateResponse ,
110- status_code = status .HTTP_200_OK ,
111- response_description = "Graph template upserted successfully"
112- )
113- async def upsert_graph_template (namespace_name : str , graph_name : str , body : UpsertGraphTemplateRequest , request : Request , api_key : str = Depends (check_api_key )):
114- x_exosphere_request_id = getattr (request .state , "x_exosphere_request_id" , str (uuid4 ()))
115-
116- if api_key :
117- logger .info (f"API key is valid for namespace { namespace_name } " , x_exosphere_request_id = x_exosphere_request_id )
118- else :
119- logger .error (f"API key is invalid for namespace { namespace_name } " , x_exosphere_request_id = x_exosphere_request_id )
120- raise HTTPException (status_code = status .HTTP_401_UNAUTHORIZED , detail = "Invalid API key" )
121-
122- return await upsert_graph_template_controller (namespace_name , graph_name , body , x_exosphere_request_id )
101+ return await errored_state (namespace_name , ObjectId (state_id ), body , x_exosphere_request_id )
0 commit comments