feat:Added CRUD Operations for book and author#117
Open
hindochahitarth wants to merge 1 commit intokeploy:mainfrom
Open
feat:Added CRUD Operations for book and author#117hindochahitarth wants to merge 1 commit intokeploy:mainfrom
hindochahitarth wants to merge 1 commit intokeploy:mainfrom
Conversation
99394ea to
fb38f6c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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:
GDG CHARUSAT TEAM ID <Team 137>