Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions spring-boot-postgres-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ To test the app, start Keploy in test mode. In the root directory, run:
```bash
keploy test -c "mvn spring-boot:run" --delay 15
```
### Note on Mutations

Currently, this GraphQL API supports only query operations for reading data. Mutations for adding or updating books/authors are not yet implemented in the codebase.

Contributors are welcome to add mutation support in future updates.
### Example Mutation

You can use the following mutation to add a new book:

```graphql
mutation {
addBook(name: "New Book", pageCount: 250, authorId: 1) {
id
name
}
}

This will run the tests and generate the report in the `Keploy/reports` directory in the current working directory.

5 changes: 4 additions & 1 deletion spring-boot-postgres-graphql/postgres_demo_docker/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_database WHERE datname = 'library_demo') THEN
CREATE DATABASE library_demo;
RAISE NOTICE 'Creating database: library_demo';
CREATE DATABASE library_demo;
ELSE
RAISE NOTICE 'Database library_demo already exists, skipping creation';
END IF;
END $$;

11 changes: 10 additions & 1 deletion user-manager/src/main/java/com/example/user/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import jakarta.validation.constraints.*;

@NotBlank
private String name;

@Min(0)
@Max(150)
private Integer age;


@Data
@ToString
Expand All @@ -16,4 +25,4 @@ public class User {
private Integer age;
private String birthday;

}
}