Compare commits

..

6 Commits

Author SHA1 Message Date
TakahashiNguyen 89c4967863 fix: better graphql handler (#40)
Release package / release (push) Successful in 16m42s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #40
2026-04-28 16:48:39 +00:00
gitea-actions 26448bb66b chore: release [ci skip] 2026-04-28 07:40:08 +00:00
TakahashiNguyen 5434445a4c fix: better manager response (#39)
Release package / release (push) Successful in 16m46s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #39
2026-04-28 07:23:30 +00:00
gitea-actions dd2e53e24d chore: release [ci skip] 2026-04-26 16:59:12 +00:00
TakahashiNguyen e60c0b89b9 fix: merge customer and manager login (#38)
Release package / release (push) Successful in 13m32s
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #38
2026-04-26 16:45:42 +00:00
gitea-actions 08e7242382 chore: release [ci skip] 2026-04-26 09:44:30 +00:00
17 changed files with 95 additions and 34 deletions
+21
View File
@@ -1,3 +1,24 @@
## [1.5.16](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.15...v1.5.16) (2026-04-28)
### Bug Fixes
* better manager response ([#39](https://git.demonkernel.io.vn/FoodSurf/backend/issues/39)) ([5434445](https://git.demonkernel.io.vn/FoodSurf/backend/commit/5434445a4c8be08c990e84d4162479ffacd34147))
## [1.5.15](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.14...v1.5.15) (2026-04-26)
### Bug Fixes
* merge customer and manager login ([#38](https://git.demonkernel.io.vn/FoodSurf/backend/issues/38)) ([e60c0b8](https://git.demonkernel.io.vn/FoodSurf/backend/commit/e60c0b89b924c913d1827ebdcfae536cd9e1cde9))
## [1.5.14](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.13...v1.5.14) (2026-04-26)
### Bug Fixes
* add menu creation and query ([#37](https://git.demonkernel.io.vn/FoodSurf/backend/issues/37)) ([c9d6439](https://git.demonkernel.io.vn/FoodSurf/backend/commit/c9d6439cf8839bd20190d4ae3f410763052781e9))
## [1.5.13](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.12...v1.5.13) (2026-04-23)
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.13</version>
<version>1.5.16</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -1,7 +1,9 @@
package com.drinkool.services;
import com.drinkool.Role;
import com.drinkool.Url;
import com.drinkool.dtos.SmsOtp;
import com.drinkool.entities.ManagerEntity;
import com.drinkool.models.UserModel;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
@@ -22,11 +24,14 @@ public class AccountService {
.entity("InvalidPhoneNumber")
.build();
if (
ManagerEntity.find("phone", input.phone).firstResult() != null
) return Response.accepted().entity(Role.Manager).build();
String otp = otpService.generateAndSaveOtp(input.phone);
// Ở đây bạn sẽ gọi Kafka để gửi SMS thực tế
System.out.println("OTP cho " + input.phone + " là: " + otp);
return Response.accepted().build();
return Response.accepted().entity(Role.Customer).build();
}
}
@@ -62,6 +62,7 @@ public class ManagerService extends BaseService<ManagerEntity> {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Manager)
.entity(customer)
.build();
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.13</version>
<version>1.5.16</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -22,7 +22,11 @@ public class MenuItemEntity extends BaseEntity {
* Phương thức tiện ích để tạo nhanh Menu Item từ tên
*/
@Transactional
public static MenuItemEntity create(EateryEntity eatery, String name, double price) {
public static MenuItemEntity create(
EateryEntity eatery,
String name,
double price
) {
MenuItemEntity menuItem = new MenuItemEntity();
menuItem.name = name;
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.13</version>
<version>1.5.16</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -11,7 +11,7 @@ import java.util.*;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api/" + Role.Customer)
public class CustomerController extends BaseController {
public class CustomerController {
@Inject
@RestClient
@@ -23,12 +23,6 @@ public class CustomerController extends BaseController {
return accountService.signup(input);
}
@POST
@Path(Url.Login)
public Uni<Response> proxyLogin(Login input) {
return accountService.login(input);
}
@POST
@Path(Url.QuickSignup)
public Uni<Response> proxyQuickSignup(QuickSignup input) {
@@ -2,11 +2,14 @@ package com.drinkool.controller;
import com.drinkool.dtos.GraphqlDto;
import io.smallrye.graphql.client.GraphQLClient;
import io.smallrye.graphql.client.GraphQLError;
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
@Path("/api/eatery")
public class EateryController {
@@ -24,9 +27,13 @@ public class EateryController {
);
if (response.hasError()) {
return jakarta.ws.rs.core.Response.status(500)
.entity(response.getErrors())
.build();
List<String> errorMessages = response
.getErrors()
.stream()
.map(GraphQLError::getMessage)
.collect(Collectors.toList());
return Response.status(400).entity(errorMessages).build();
}
return jakarta.ws.rs.core.Response.ok(
@@ -0,0 +1,35 @@
package com.drinkool.controller;
import com.drinkool.Url;
import com.drinkool.dtos.Login;
import com.drinkool.services.CustomerService;
import com.drinkool.services.ManagerService;
import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api")
public class MainController extends BaseController {
@Inject
@RestClient
ManagerService managerService;
@Inject
@RestClient
CustomerService customerService;
@POST
@Path(Url.Login)
public Uni<Response> proxyLogin(Login input) {
return managerService
.login(input)
.onFailure()
.recoverWithUni(() -> {
return customerService.login(input);
});
}
}
@@ -11,7 +11,7 @@ import java.util.*;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api/" + Role.Manager)
public class ManagerController extends BaseController {
public class ManagerController {
@Inject
@RestClient
@@ -23,12 +23,6 @@ public class ManagerController extends BaseController {
return managerService.signup(input);
}
@POST
@Path(Url.Login)
public Uni<Response> proxyLogin(Login input) {
return managerService.login(input);
}
@GET
public Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id) {
return managerService.me(id);
@@ -16,7 +16,7 @@ public class BaseControllerTest {
public void testLogoutShouldClearCookie() {
given()
.when()
.post("/api/" + Role.Customer + Url.Logout)
.post("/api" + Url.Logout)
.then()
.statusCode(204)
.header("Set-Cookie", containsString(InternalValue.cookieName))
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: account-pod
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.13
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.16
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: eatery-pod
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.13
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.16
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: gateway-pod
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.13
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.16
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
+6 -6
View File
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.13</version>
<version>1.5.16</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -60,4 +60,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
+1 -1
View File
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.13</version>
<version>1.5.16</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>25</maven.compiler.source>