Skip to content

Feature/book count#121

Open
hindochahitarth wants to merge 5 commits intokeploy:mainfrom
hindochahitarth:feature/Book-Count
Open

Feature/book count#121
hindochahitarth wants to merge 5 commits intokeploy:mainfrom
hindochahitarth:feature/Book-Count

Conversation

@hindochahitarth
Copy link

@hindochahitarth hindochahitarth commented Feb 28, 2026

Pull Request Template

GDG CHARUSAT TEAM ID Team 137

Description

Description
This PR introduces a

bookCount
virtual field to the

Author
type. Previously, to find out how many books an author had written, clients had to fetch the entire list of books and count them manually. This enhancement provides a direct, efficient way to retrieve the total count.

Summary of changes:

GraphQL Schema: Added bookCount: Int to the

Author
type definition.

BookController
: Implemented a @schemamapping method

bookCount(Author author)
that calculates the size of the author's book collection.
Performance: This allows clients to query for high-level statistics without the overhead of downloading full book details.
Closes keploy/keploy#3890

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The changes were verified manually using curl against the local GraphQL endpoint.

Test Case: Fetching Author Statistics

Setup: Ensure an author exists with multiple books assigned.
Execution: Run the following curl command:
bash
curl -X POST http://localhost:8081/graphql
-H "Content-Type: application/json"
-d '{"query": "{ getAllAuthors { firstName lastName bookCount } }"}'
Expected Result: The API returns the authors with a

bookCount
integer representing the number of books they are associated with.

Additional Context (Please include any Screenshots/gifs if relevant)

This is a non-breaking enhancement that improves data efficiency for UI components like author lists or profile summaries where only the count is required.
...

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • I have tagged the reviewers in a comment below incase my pull request is ready for a review
  • I have signed the commit message to agree to Developer Certificate of Origin (DCO) (to certify that you wrote or otherwise have the right to submit your contribution to the project.) by adding "--signoff" to my git commit command.

GDG CHARUSAT TEAM ID Team 137

X
feat:Added CRUD Operations for book and author

Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
Signed-off-by: Hitarth Hindocha <hindochahitarth@gmail.com>
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.

[feature]: Add a virtual field bookCount

1 participant