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
33 changes: 33 additions & 0 deletions 1-rookie/ZGoodiesShop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file not shown.
2 changes: 2 additions & 0 deletions 1-rookie/ZGoodiesShop/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
67 changes: 67 additions & 0 deletions 1-rookie/ZGoodiesShop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## Exercise

1. Design a small REST API with GET and POST for orders

2. Return a Customer fully populated with Orders → Items

Complete the TODOs in order (lowest number first).
You can use Lombok and Spring Boot 3 / Spring Data JPA.
No DB scripts needed (use H2).
Bonus points for validation & error handling.

## What we’re evaluating

[1–3] Entities & mappings: Correct One-to-Many with @JoinColumn, cascade, and orphan removal.

[4–5] Repositories: Knows Spring Data basics.

[6] Seeding: Can assemble nested aggregates and persist.

[7–8] REST basics: Proper GET and POST, DTO usage, 201 Created with Location.

[9] Nested fetch: Returns a Customer with Orders → Items (unidirectional makes JSON straightforward).

## Read H2 data

Open your browser at 👉 http://localhost:8080/h2-console

In the login form:

JDBC URL: `jdbc:h2:mem:testdb` (same as spring.datasource.url)

User Name: `sa`

Password: (empty)

Click Connect → you’ll see your tables (`ZCUSTOMER`, `ZORDER`, `ZITEM`) and can run SQL queries.

## Curl request

### find all orders

```
curl --request GET \
--url http://localhost:8080/api/v1/orders
```

### find customer 1

```
curl --request GET \
--url http://localhost:8080/api/v1/customers/1
```

### add order

```
curl --request POST \
--url http://localhost:8080/api/v1/orders \
--header 'content-type: application/json' \
--data '{
"name": "office pack",
"items": [
"Pen",
"Notebook"
]
}'
```
Loading