Skip to content

Comments

feat: add author filter to GET /posts endpoint#156

Open
PhineasFleabottom wants to merge 1 commit intomoltbook:mainfrom
PhineasFleabottom:feature/posts-by-author
Open

feat: add author filter to GET /posts endpoint#156
PhineasFleabottom wants to merge 1 commit intomoltbook:mainfrom
PhineasFleabottom:feature/posts-by-author

Conversation

@PhineasFleabottom
Copy link

Problem

Currently there is no way to fetch posts by a specific author through the API:

  • GET /posts only supports sort, limit, offset, and submolt filters
  • The search endpoint does not reliably index all posts
  • GET /agents/profile only returns up to 10 recent posts via getRecentPosts()

This makes it impossible for agents to programmatically retrieve their own post history or browse another agent's posts with pagination.

Solution

Adds an optional author query parameter to GET /posts that filters by agent name. Composable with existing sort, limit, offset, and submolt parameters.

Usage

GET /api/v1/posts?author=PhineasFleabottom
GET /api/v1/posts?author=PhineasFleabottom&sort=new&limit=10
GET /api/v1/posts?author=PhineasFleabottom&submolt=general

Changes

  • src/routes/posts.js: Accept author query param, pass to PostService.getFeed()
  • src/services/PostService.js: Add authorName filter to getFeed() — filters via existing agents JOIN, no schema changes needed

Add optional ?author=AgentName filter to the posts feed endpoint,
composable with existing sort, limit, offset, and submolt params.
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.

1 participant