Compare commits

...

2 Commits

Author SHA1 Message Date
TakahashiNguyen 5d0a047602 fix: better cart response (#57)
Release package / release (push) Successful in 24m23s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #57
2026-05-13 09:24:19 +00:00
gitea-actions 8b2d3e7bef chore: release [ci skip] 2026-05-13 07:50:55 +00:00
16 changed files with 41 additions and 44 deletions
+9
View File
@@ -1,3 +1,12 @@
## [1.5.29](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.28...v1.5.29) (2026-05-13)
### Bug Fixes
* add menu item fields ([#55](https://git.demonkernel.io.vn/FoodSurf/backend/issues/55)) ([dc5bc73](https://git.demonkernel.io.vn/FoodSurf/backend/commit/dc5bc731b3345663d2640a500ecfb77e81929ab2))
* better graphql response ([#54](https://git.demonkernel.io.vn/FoodSurf/backend/issues/54)) ([d45ed26](https://git.demonkernel.io.vn/FoodSurf/backend/commit/d45ed26a07ca5af39ea63e82a9e6453e4aedf0c4))
* trigger release version ([#56](https://git.demonkernel.io.vn/FoodSurf/backend/issues/56)) ([e72ccf4](https://git.demonkernel.io.vn/FoodSurf/backend/commit/e72ccf4e960b1623b604c85cbeef54ab8c8d97b3))
## [1.5.30](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.29...v1.5.30) (2026-05-13) ## [1.5.30](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.29...v1.5.30) (2026-05-13)
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -3,7 +3,6 @@ package com.drinkool.entities;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.models.UserModel; import com.drinkool.models.UserModel;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -150,11 +150,11 @@ public class CartService {
} }
@Mutation("addItem") @Mutation("addItem")
public Uni<Cart> addItem( public Cart addItem(
@Name("cartId") UUID cartId, @Name("cartId") UUID cartId,
@Name("menuItemId") UUID menuItemId, @Name("menuItemId") UUID menuItemId,
@Name("quantity") long quantity @Name("quantity") long quantity
) { ) throws GraphQLException {
String key = "cart:" + cartId; String key = "cart:" + cartId;
String priceKey = "cart_prices:" + cartId; String priceKey = "cart_prices:" + cartId;
@@ -163,35 +163,27 @@ public class CartService {
UUID eateryId = UUID.fromString(eateryIdStr); UUID eateryId = UUID.fromString(eateryIdStr);
return eateryController Response response = eateryController
.checkMenuItemExists(eateryId, menuItemId) .checkMenuItemExists(eateryId, menuItemId)
.onItem() .await()
.transform(response -> { .indefinitely();
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
throw new RuntimeException("NotFoundMenuItemInEatery");
}
Double menuItemPrice = response.readEntity(Double.class); if (response.getStatus() != Response.Status.OK.getStatusCode()) {
throw new GraphQLException("NotFoundMenuItemInEatery");
}
hashCommands.hincrby(key, menuItemId.toString(), quantity); Double menuItemPrice = response.readEntity(Double.class);
hashCommands.hset( hashCommands.hincrby(key, menuItemId.toString(), quantity);
priceKey, hashCommands.hset(
menuItemId.toString(), priceKey,
String.valueOf(menuItemPrice) menuItemId.toString(),
); String.valueOf(menuItemPrice)
);
hashCommands.getDataSource().key().expire(key, Duration.ofDays(30)); hashCommands.getDataSource().key().expire(key, Duration.ofDays(30));
hashCommands hashCommands.getDataSource().key().expire(priceKey, Duration.ofDays(30));
.getDataSource()
.key()
.expire(priceKey, Duration.ofDays(30));
try { return getCart(cartId);
return getCart(cartId);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
});
} }
} }
@@ -124,7 +124,7 @@ public class CartServiceTest {
} }
@Test @Test
void testAddItem_Success() { void testAddItem_Success() throws GraphQLException {
UUID cartId = UUID.randomUUID(); UUID cartId = UUID.randomUUID();
UUID eateryId = UUID.randomUUID(); UUID eateryId = UUID.randomUUID();
UUID menuItemId = UUID.randomUUID(); UUID menuItemId = UUID.randomUUID();
@@ -137,10 +137,7 @@ public class CartServiceTest {
Uni.createFrom().item(Response.ok(17.0).build()) Uni.createFrom().item(Response.ok(17.0).build())
); );
Cart result = cartService Cart result = cartService.addItem(cartId, menuItemId, 2L);
.addItem(cartId, menuItemId, 2L)
.await()
.atMost(Duration.ofSeconds(5));
assertNotNull(result); assertNotNull(result);
assertEquals(cartId, result.getId()); assertEquals(cartId, result.getId());
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: account-pod - name: account-pod
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.30 image: git.demonkernel.io.vn/foodsurf/account-service:1.5.29
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: cart-pod - name: cart-pod
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.30 image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.29
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: eatery-pod - name: eatery-pod
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.30 image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.29
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: file-pod - name: file-pod
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.30 image: git.demonkernel.io.vn/foodsurf/file-service:1.5.29
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
volumeMounts: volumeMounts:
- name: file-volume - name: file-volume
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: gateway-pod - name: gateway-pod
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.30 image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.29
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
+1 -1
View File
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.30</version> <version>1.5.29</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<maven.compiler.source>25</maven.compiler.source> <maven.compiler.source>25</maven.compiler.source>