Skip to content

Commit a3d3d9a

Browse files
Add JSON configuration for categories and update Book model with JsonIgnore annotation
1 parent c8e4e73 commit a3d3d9a

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

examples/demo-zk-books/src/main/java/mybookstore/domain/Book.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package mybookstore.domain;
1919

20+
import com.fasterxml.jackson.annotation.JsonIgnore;
2021
import jakarta.persistence.*;
2122
import jakarta.validation.constraints.NotEmpty;
2223
import jakarta.validation.constraints.NotNull;
@@ -72,6 +73,7 @@ public class Book extends BaseEntity {
7273
private double discount;//percent
7374

7475
@Transient
76+
@JsonIgnore
7577
private boolean selected;
7678

7779

examples/demo-zk-books/src/main/resources/META-INF/descriptors/CategoryJson.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ fields:
66
name:
77
description:
88
subcategories:
9+
parent.id:
10+
911

1012
params:
1113
conditions:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@baseUrl=http://localhost:8484/api/library/categories
2+
3+
### List categories
4+
GET {{baseUrl}}
5+
6+
### Create category
7+
POST {{baseUrl}}
8+
content-type: application/json
9+
10+
{
11+
"name": "{{$random.book.genre}}",
12+
"parent": {
13+
"id": 1
14+
}
15+
}
16+
17+
### Get category by id
18+
GET {{baseUrl}}/1
19+
20+
21+
### Get category by id not found
22+
GET {{baseUrl}}/133333333
23+
24+
25+
### List categories metadata
26+
GET {{baseUrl}}?_metadata
27+
28+
29+
### Filter categories by name
30+
GET {{baseUrl}}?name=Programmin

0 commit comments

Comments
 (0)