Skip to content

feat:Added CRUD Operations for book and author#117

Open
hindochahitarth wants to merge 1 commit intokeploy:mainfrom
hindochahitarth:feature/GraphQL-CRUD
Open

feat:Added CRUD Operations for book and author#117
hindochahitarth wants to merge 1 commit intokeploy:mainfrom
hindochahitarth:feature/GraphQL-CRUD

Conversation

@hindochahitarth
Copy link

@hindochahitarth hindochahitarth commented Feb 24, 2026

GDG CHARUSAT TEAM ID <Team 137>

Pull Request Template

Description

This pull request upgrades the Library Demo application from a read-only GraphQL service to a fully functional API supporting complete CRUD (Create, Read, Update, Delete) operations.

Summary of Changes

DTO Layer

Introduced AuthorInput and BookInput to ensure structured and secure data handling for mutations.

GraphQL Schema

Added Mutation type to support create, update, and delete operations for Books and Authors.

Extended the Query type by adding getBookById for precise book retrieval.

Controller Enhancements

Implemented @MutationMapping methods for:

addBook

updateBook

deleteBook

addAuthor

deleteAuthor

Repository Updates

Added findBookById and verified existing findAuthorById to enable accurate entity lookup and management.

Closes keploy/keploy#3838

Type of change

  • 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 commands against a running instance of the application.

Test Configuration:

Runtime: Spring Boot 3.x
Database: PostgreSQL
Tool: curl
Reproduction Steps:

Add Author:
bash
curl -X POST http://localhost:8081/graphql -H "Content-Type: application/json" -d '{"query": "mutation { addAuthor(author: {firstName: "John", lastName: "Doe"}) { id firstName lastName } }"}'
Add Book:
bash
curl -X POST http://localhost:8081/graphql -H "Content-Type: application/json" -d '{"query": "mutation { addBook(book: {name: "GraphQL Guide", pageCount: 300, authorId: 1}) { id name pageCount } }"}'
Get Book by ID:
bash
curl -X POST http://localhost:8081/graphql -H "Content-Type: application/json" -d '{"query": "{ getBookById(id: 1) { id name author { firstName } } }"}'

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

The implementation follows standard Spring for GraphQL patterns, using input DTOs to separate the API layer from the JPA entities, ensuring better security and maintainability.
...

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>
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]:Library Demo Enhancement to add CRUD Operations

1 participant