Skip to content

Feat/category added#118

Open
hindochahitarth wants to merge 2 commits intokeploy:mainfrom
hindochahitarth:feat/Category-added
Open

Feat/category added#118
hindochahitarth wants to merge 2 commits intokeploy:mainfrom
hindochahitarth:feat/Category-added

Conversation

@hindochahitarth
Copy link

@hindochahitarth hindochahitarth commented Feb 27, 2026

Pull Request Template

GDG CHARUSAT TEAM ID Team 137

Description

This PR introduces a Categorization System to the library demo. Previously, books were only associated with authors. This change adds a

Category
entity, allowing books to be grouped by genres or topics (e.g., "Fiction", "Science", "Biography").

Summary of changes:

Created a

Category
JPA entity with id, name, and description.
Implemented

CategoryRepository
for data persistence.
Added

CategoryInput
DTO and updated

BookInput
to support linking books to categories via categoryId.
Updated the GraphQL Schema with:
New

Category
type.
Queries:

getAllCategories
,

getCategoryById
.
Mutation:

addCategory
.
Updated

Book
type to include its category details.
Enhanced

BookController
with mapping logic for the new GraphQL endpoints.
Fixes keploy/keploy#3889
Type of change
New feature (non-breaking change which adds functionality)
How Has This Been Tested?
The changes were verified manually using the GraphQL interface (localhost:8081/graphiql) and recorded using Keploy.

Reproduction Steps:

Start the app with Keploy: keploy record -c "./mvnw spring-boot:run"
Create a category:
graphql
mutation { addCategory(category: { name: "Biography", description: "Life stories" }) { id name } }
Create a book linked to that category:
graphql
mutation { addBook(book: { name: "Example Book", pageCount: 100, authorId: 1, categoryId: 1 }) { id name category { name } } }
Fetch all categories to see the linked books:
graphql
query { getAllCategories { name books { name } } }
Additional Context
The implementation preserves the existing functionality of the library demo while providing a foundation for more advanced features like genre-based filtering and search.

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>
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]: Implement a search query

1 participant