diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index fb65724..e7874d9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,8 +4,6 @@
-
-
@@ -75,6 +73,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -83,8 +104,8 @@
-
-
+
+
@@ -93,19 +114,34 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -116,8 +152,8 @@
-
-
+
+
@@ -125,26 +161,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
@@ -154,15 +175,19 @@
asc
+ Object
+
+ T
+
@@ -186,13 +211,14 @@
-
-
-
+
+
+
+
@@ -233,7 +259,6 @@
-
@@ -286,6 +311,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -306,6 +349,7 @@
+
@@ -391,7 +435,8 @@
1547322958782
-
+
+
1548121370553
@@ -456,11 +501,39 @@
1548177602799
-
+
+ 1548180172910
+
+
+
+ 1548180172910
+
+
+ 1548184896657
+
+
+
+ 1548184896657
+
+
+ 1548238865354
+
+
+
+ 1548238865354
+
+
+ 1548276405635
+
+
+
+ 1548276405635
+
+
-
+
@@ -475,7 +548,7 @@
-
+
@@ -484,18 +557,18 @@
-
+
-
+
-
+
@@ -503,7 +576,7 @@
-
+
@@ -564,11 +637,27 @@
-
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/dino/scrum/sysmag/service/ProductServiceImpl.java
+ 90
+
+
+
+
+
+
@@ -638,16 +727,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -679,13 +758,6 @@
-
-
-
-
-
-
-
@@ -703,10 +775,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -715,18 +828,25 @@
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -735,24 +855,14 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index f1382a1..90b6cec 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ Content-Type: application/json
}
```
-Response `200` with ``JSON``:
+Response `200` with `JSON`:
```json
{
@@ -74,7 +74,8 @@ Page start numbering on `page=0`. Default list is sorted by `id`.
GET /api/get-all?page=0&size=1&sort=id
Content-Type: application/json
```
-Response ``200`` with ``JSON`` :
+Response `200` with `JSON`:
+
```json
{
@@ -127,7 +128,7 @@ The service will handle `GET` request on `/api/get-price-of-all` returing `Float
GET /api/get-price-of-all
Content-Type: application/json
```
-Response `200` with ``JSON``:
+Response `200` with `JSON`:
```json
{
@@ -180,11 +181,9 @@ Content-Type: application/json
}
```
-```json
-Response: 200
+Response `200`:
-```
* * *
### Get product with `id`
diff --git a/src/main/java/com/dino/scrum/sysmag/model/Product.java b/src/main/java/com/dino/scrum/sysmag/model/Product.java
index ba9b301..813f2d5 100644
--- a/src/main/java/com/dino/scrum/sysmag/model/Product.java
+++ b/src/main/java/com/dino/scrum/sysmag/model/Product.java
@@ -40,12 +40,12 @@ public class Product {
@NotNull(message = "quantity cannot be null")
@Min(value = 0, message = "quantity cannot be under 0")
@Column(name = "quantity")
- private long quantity;
+ private Long quantity;
@NotNull(message = "quantityMax cannot be null")
@Min(value = 1, message = "quantityMax cannot be under 1")
@Column(name = "quantityMax")
- private long quantityMax;
+ private Long quantityMax;
@NotNull(message = "image_link cannot be null")
@Column(name = "image_link")
diff --git a/src/main/java/com/dino/scrum/sysmag/service/ProductServiceImpl.java b/src/main/java/com/dino/scrum/sysmag/service/ProductServiceImpl.java
index 37fa85f..a14bb99 100644
--- a/src/main/java/com/dino/scrum/sysmag/service/ProductServiceImpl.java
+++ b/src/main/java/com/dino/scrum/sysmag/service/ProductServiceImpl.java
@@ -93,16 +93,16 @@ public class ProductServiceImpl implements ProductService {
if (productReceived.getName() != null)
productToChange.setName(productReceived.getName());
- if (productReceived.getName() != null)
+ if (productReceived.getPrice() != null)
productToChange.setPrice(productReceived.getPrice());
- if (productReceived.getName() != null)
+ if (productReceived.getQuantity() != null)
productToChange.setQuantity(productReceived.getQuantity());
- if (productReceived.getName() != null)
+ if (productReceived.getQuantityMax() != null)
productToChange.setQuantityMax(productReceived.getQuantityMax());
- if (productReceived.getName() != null)
+ if (productReceived.getImageLink() != null)
productToChange.setImageLink(productReceived.getImageLink());
productRepository.save(productToChange);
@@ -110,6 +110,7 @@ public class ProductServiceImpl implements ProductService {
return productRepository.findById(productToChange.getId().longValue());
}
+
@Override
public long count() {
return productRepository.count();