This project is a REST API application using Java which provides the following functionality:
- Creating categories with attribute definitions
- Creating items in those categories
- Updating items
- Getting items of a category
This project uses Maven as its build tool. To build the project, run this maven command:
mvn clean package
After that, You can start the application with:
java -jar /target/labforward-challenge-0.0.1-SNAPSHOT.jar
Create a Category:
POST /categories
{
"name":"ingredient",
"attributes": [
{
"name": "weight"
},
{
"name": "name"
}
]
}
Create an Item:
POST /categories/{id}/items
{
"values": [
{
"attribute": {
"id": 2
},
"value": "5.2"
},
{
"attribute": {
"id": 3
},
"value": "cyanide"
}
]
}
Update and Item:
PUT /categories/{id}/items/{id}
{
"values": [
{
"attribute": {
"id": 2
},
"value": "5.7"
},
{
"attribute": {
"id": 3
},
"value": "lithium"
}
]
}
Get all items of a Category:
GET /categories/{id}/items
-
Add constraints for attributes (Required, Unique, ...)
-
More flat Data Access Objects(DTO)
-
Validate if attribute belongs to the category when creating an Item
-
More specific type for values
-
Add some tests