Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add endpoint to retrieve blogs by author #1213

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

skyspec28
Copy link

Community Feature - Blog Author Endpoint

Description

This feature introduces a new endpoint to retrieve blogs authored by a specific user. It enhances the platform by allowing users to filter blog posts by author, making it easier to find content from a particular writer.

Features

  • Users can retrieve blog posts by a specific author.
  • Added an endpoint to count the number of blog posts by an author.

Service Implementation

BlogService

  • get_blogs_by_author: Retrieves all blog posts by a specific author, with pagination support.
  • count_author_blogs: Returns the total number of blog posts written by a specific author.

Motivation and Context

Currently, there is no way to filter blog posts by author within the platform. This feature addresses that gap by:

  • Improving content discoverability.
  • Providing users with a better way to explore an author’s contributions.
  • Enabling pagination for efficient data retrieval.

Testing

  • Automated Tests: Implemented using FastAPI TestClient to verify API endpoints.
  • Manual Testing: Verified the correct functionality of blog retrieval and counting by author.
  • Database Validation: Ensured seamless interaction with SQLAlchemy ORM.
  • Security Checks: Ensured appropriate authentication and authorization mechanisms.

Types of Changes

New Feature (non-breaking change that adds functionality)

Checklist

  • My code follows the project's coding style.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Contributor

@joboy-dev joboy-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know you can just use author ID as a query parameter in the endpoint to get all blogs rather than creating a whole new endpoint for this

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.

2 participants