Skip to content

Commit

Permalink
fix: return 201 for resource creation apis
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandan committed Feb 12, 2025
1 parent 88bd1e9 commit b8a735c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/api/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ async def get_api_key_user(
return user


@router.post("/conversations/", response_model=CreateConversationResponse)
@router.post(
"/conversations/", response_model=CreateConversationResponse, status_code=201
)
async def create_conversation(
conversation: SimpleConversationRequest,
db: Session = Depends(get_db),
Expand Down
4 changes: 3 additions & 1 deletion app/modules/conversations/conversations_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@

class ConversationAPI:
@staticmethod
@router.post("/conversations/", response_model=CreateConversationResponse)
@router.post(
"/conversations/", response_model=CreateConversationResponse, status_code=201
)
async def create_conversation(
conversation: CreateConversationRequest,
db: Session = Depends(get_db),
Expand Down
2 changes: 1 addition & 1 deletion app/modules/intelligence/prompts/prompt_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class PromptAPI:
@staticmethod
@router.post("/prompts/", response_model=PromptResponse)
@router.post("/prompts/", response_model=PromptResponse, status_code=201)
async def create_prompt(
prompt: PromptCreate,
db: Session = Depends(get_db),
Expand Down
4 changes: 2 additions & 2 deletions app/modules/key_management/secret_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_secret_id(
raise HTTPException(status_code=400, detail="Invalid provider")
return secret_id

@router.post("/secrets")
@router.post("/secrets", status_code=201)
def create_secret(
request: CreateSecretRequest,
user=Depends(AuthService.check_auth),
Expand Down Expand Up @@ -253,7 +253,7 @@ def delete_secret(
except Exception as e:
raise HTTPException(status_code=404, detail=f"Secret not found: {str(e)}")

@router.post("/api-keys", response_model=APIKeyResponse)
@router.post("/api-keys", response_model=APIKeyResponse, status_code=201)
async def create_api_key(
user=Depends(AuthService.check_auth),
db: Session = Depends(get_db),
Expand Down
2 changes: 1 addition & 1 deletion app/modules/parsing/graph_construction/parsing_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
router = APIRouter()


@router.post("/parse")
@router.post("/parse", status_code=201)
async def parse_directory(
repo_details: ParsingRequest,
db: Session = Depends(get_db),
Expand Down

0 comments on commit b8a735c

Please sign in to comment.