Skip to content

Conversation

@tofarr
Copy link
Collaborator

@tofarr tofarr commented Sep 28, 2025

Summary

This PR enhances the sandboxed conversation router by adding comprehensive search filtering capabilities and implementing a count endpoint.

Changes Made

1. Enhanced Search Endpoint (/search)

Added all search parameters from SandboxedConversationService to the router's search method:

  • title__contains: Filter conversations by title containing a specific string
  • created_at__gte: Filter by created_at greater than or equal to datetime
  • created_at__lt: Filter by created_at less than datetime
  • updated_at__gte: Filter by updated_at greater than or equal to datetime
  • updated_at__lt: Filter by updated_at less than datetime

2. New Count Endpoint (/count)

Implemented a new /count endpoint that:

  • Returns the total count of sandboxed conversations matching the given filters
  • Uses the same filter parameters as the search endpoint for consistency
  • Calls the count_sandboxed_conversations method from the service layer

3. Technical Improvements

  • Added datetime import for proper type annotations
  • Maintained consistent parameter naming and documentation
  • Used FastAPI's Query annotations with descriptive titles for better API documentation

API Changes

Updated /search endpoint

GET /sandboxed-conversations/search?title__contains=example&created_at__gte=2023-01-01T00:00:00Z&limit=50

New /count endpoint

GET /sandboxed-conversations/count?title__contains=example&created_at__gte=2023-01-01T00:00:00Z

Testing

  • Code compiles successfully without syntax errors
  • All parameters are properly typed and documented
  • Maintains backward compatibility with existing API usage

Notes

This change brings the router in full alignment with the service layer's capabilities, enabling clients to perform more sophisticated filtering and counting operations on sandboxed conversations.

@tofarr can click here to continue refining the PR

… count endpoint

- Add all search parameters from SandboxedConversationService to the search endpoint:
  - title__contains: Filter by title containing string
  - created_at__gte: Filter by created_at >= datetime
  - created_at__lt: Filter by created_at < datetime
  - updated_at__gte: Filter by updated_at >= datetime
  - updated_at__lt: Filter by updated_at < datetime
- Implement new /count endpoint with same filter parameters as search
- Add datetime import for proper type annotations
@tofarr tofarr marked this pull request as ready for review September 28, 2025 22:20
@tofarr tofarr merged commit b1904ca into main Sep 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants