Skip to content

[feature]: Add a virtual field bookCount聽#3890

Description

@hindochahitarth

馃憖 Is there an existing feature request for this?

  • I have searched the existing issues

馃敄 Enhancement description

Problem
When viewing an author, there is no quick way to see how many books they have written without fetching the entire list of books. This information is often needed for high-level summaries or author profiles.

Proposed Solution
Add a virtual field bookCount to the

Author
type in the GraphQL schema.

GraphQL Schema:
graphql
type Author {
id: ID
firstName: String
lastName: String
bookCount: Int # New Field
books: [Book]
}
Controller/Entity:
Add a method in the

BookController
or update the

Author
entity to calculate the size of the books list.
Expected Behavior
When querying an author, the user can request the bookCount field.
The system returns the integer count of books associated with that author.

馃帳 Why should this be worked on?

Data Efficiency: Allows clients to get aggregate data (count) without the overhead of transferring the full list of books.
Improved UX: Useful for UI components that display author statistics.
馃捇 Repository spring-boot-postgres-graphql

GDG CHARUSAT TEAM : T137

馃捇 Repository

keploy

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions