Compare commits

...

10 Commits

Author SHA1 Message Date
TakahashiNguyen 4811934b84 fix: add logout, quick signup and quick login (#29)
Release package / release (push) Successful in 12m31s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #29
2026-04-19 09:16:26 +00:00
gitea-actions d94117576b chore: release [ci skip] 2026-04-19 02:20:48 +00:00
TakahashiNguyen 24df313c0f fix: response exceptions from sub services (#28)
Release package / release (push) Successful in 13m41s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #28
2026-04-19 02:06:19 +00:00
gitea-actions 74acb68bbf chore: release [ci skip] 2026-04-18 10:38:36 +00:00
TakahashiNguyen 96171d3ec2 fix: missing required parameters (#27)
Release package / release (push) Successful in 16m8s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #27
2026-04-18 10:22:18 +00:00
gitea-actions bb8a9c5691 chore: release [ci skip] 2026-04-17 12:12:43 +00:00
TakahashiNguyen e07ee318a7 fix: connect gateway to customer service (#26)
Release package / release (push) Successful in 9m5s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #26
2026-04-17 12:03:19 +00:00
gitea-actions d91b20357a chore: release [ci skip] 2026-04-17 06:14:34 +00:00
TakahashiNguyen f1ffc63a5f fix: better ci script (#25)
Release package / release (push) Successful in 15m33s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #25
2026-04-17 05:59:35 +00:00
TakahashiNguyen a97e9ade6e fix: Resolve runtime issue with native build (#24)
Release package / release (push) Has been cancelled
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #24
2026-04-17 05:39:21 +00:00
37 changed files with 333 additions and 186 deletions
+24 -22
View File
@@ -1,36 +1,38 @@
FROM ubuntu:26.04
FROM jbangdev/jbang-action:latest AS jbang-provider
FROM node:current-trixie AS base
COPY --from=jbang-provider /jbang /jbang
ENV PATH="/jbang/bin:${PATH}"
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install --global pnpm@latest
# Tránh các câu hỏi tương tác trong quá trình cài đặt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y ca-certificates && apt-get clean
RUN sed -i 's|http://archive.ubuntu.com|https://apt.demonkernel.io.vn|g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's|http://security.ubuntu.com|https://apt.demonkernel.io.vn|g' /etc/apt/sources.list.d/ubuntu.sources
# 1. Cài đặt các công cụ cơ bản
RUN apt-get update --fix-missing && apt-get install --no-install-recommends --no-install-suggests -y \
curl \
bash \
git \
docker-buildx \
locales \
docker-cli \
docker.io \
nodejs \
kubectl \
openjdk-25-jdk-headless \
redis-server \
maven
# 5. Cấu hình Git
RUN git config --global --add safe.directory '*'
# 2. Cài đặt Node.js & PNPM (thay thế cho apk pnpm)
RUN curl -fsSL https://get.pnpm.io/install.sh | bash -
RUN jbang trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN jbang app install --fresh --force quarkus@quarkusio
# 3. Cài đặt Kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -m 0755 kubectl /usr/local/bin/kubectl
# 6. Cài đặt JBang & Quarkus CLI
ENV JBANG_DIR="/root/.jbang"
ENV PATH="${JBANG_DIR}/bin:${PATH}"
RUN curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
# Fix Locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
+14 -6
View File
@@ -1,14 +1,19 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"dockerComposeFile": "docker-compose.main.yaml",
"build": {
"dockerfile": "Dockerfile",
"args": {
"http_proxy": "http://host.docker.internal:3142"
},
"options": ["--add-host=host.docker.internal:host-gateway"]
},
"runArgs": ["--add-host=host.docker.internal:host-gateway"],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=${localEnv:USERPROFILE}/.kube,target=/root/.kube,type=bind"
"source=${localEnv:USERPROFILE}/.kube,target=/root/.kube,type=bind",
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"remoteUser": "root",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"customizations": {
"vscode": {
"extensions": [
@@ -24,7 +29,10 @@
},
"containerEnv": {
"TESTCONTAINERS_RYUK_DISABLED": "true",
"QUARKUS_DEBUG_HOST": "0.0.0.0"
"QUARKUS_DEBUG_HOST": "0.0.0.0",
"http_proxy": "http://host.docker.internal:3142"
},
"postStartCommand": "redis-server --daemonize yes",
"postCreateCommand": "git config --global --add safe.directory '*'",
"forwardPorts": [5005, 8080]
}
-29
View File
@@ -1,29 +0,0 @@
services:
kafka:
image: apache/kafka:latest
restart: unless-stopped
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
kafdrop:
image: obsidiandynamics/kafdrop:latest
restart: unless-stopped
depends_on:
- kafka
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
command: sh -c "sleep 5 && exec ./start-app"
environment:
KAFKA_BROKERCONNECT: "localhost:9092"
-14
View File
@@ -1,14 +0,0 @@
include:
- ./docker-compose.redis.yaml
services:
devcontainer:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
command: sleep infinity
@@ -1,13 +0,0 @@
services:
postgres:
image: postgres:alpine
environment:
- POSTGRES_PASSWORD=password
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
-11
View File
@@ -1,11 +0,0 @@
services:
redis:
image: redis:alpine
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- redis_data:/data
volumes:
redis_data:
+11 -4
View File
@@ -11,9 +11,16 @@ jobs:
permissions:
contents: write
steps:
- uses: gerlero/apt-install@v1
with:
packages: openjdk-25-jdk-headless docker.io
- name: Install dependencies with Proxy
env:
http_proxy: "http://host.docker.internal:3142"
https_proxy: "http://host.docker.internal:3142"
run: |
# Kiểm tra proxy có hoạt động không
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests \
openjdk-25-jdk-headless docker-cli docker-buildx
- name: Setup SSH Key
run: |
@@ -39,7 +46,7 @@ jobs:
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.demonkernel.io.vn
registry: vps.demonkernel.io.vn
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
+11 -4
View File
@@ -35,14 +35,21 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- uses: gerlero/apt-install@v1
with:
packages: openjdk-25-jdk-headless docker.io
- name: Install dependencies with Proxy
env:
http_proxy: "http://host.docker.internal:3142"
https_proxy: "http://host.docker.internal:3142"
run: |
# Kiểm tra proxy có hoạt động không
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests \
openjdk-25-jdk-headless docker-cli docker-buildx
- name: Build and Test all modules
run: |
./mvnw -B install \
-Dquarkus.container-image.push=false
-Dquarkus.container-image.push=false -Pnative
- name: Publish Test Report
uses: dorny/test-reporter@v3
+1
View File
@@ -24,6 +24,7 @@ nb-configuration.xml
# Visual Studio Code
.vscode
.factorypath
*.rdb
# OSX
.DS_Store
+1 -1
View File
@@ -13,7 +13,7 @@ plugins:
./mvnw versions:set -DnewVersion=${nextRelease.version} &&
sed -i "/-service:/ s|:[^:]*$|:${nextRelease.version}|" k8s.yaml &&
if [ "${branch.name}" = "main" ]; then
./mvnw package -B -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests
./mvnw package -B -Pnative -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests
fi
- - "@saithodev/semantic-release-gitea"
- giteaUrl: "https://git.demonkernel.io.vn/"
+29
View File
@@ -1,3 +1,32 @@
## [1.5.6](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.5...v1.5.6) (2026-04-19)
### Bug Fixes
* response exceptions from sub services ([#28](https://git.demonkernel.io.vn/FoodSurf/backend/issues/28)) ([24df313](https://git.demonkernel.io.vn/FoodSurf/backend/commit/24df313c0f7effeacd89e537896d7ac9452ec526))
## [1.5.5](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.4...v1.5.5) (2026-04-18)
### Bug Fixes
* missing required parameters ([#27](https://git.demonkernel.io.vn/FoodSurf/backend/issues/27)) ([96171d3](https://git.demonkernel.io.vn/FoodSurf/backend/commit/96171d3ec254f35d4cf8d11ccab53f8922c94412))
## [1.5.4](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.3...v1.5.4) (2026-04-17)
### Bug Fixes
* connect gateway to customer service ([#26](https://git.demonkernel.io.vn/FoodSurf/backend/issues/26)) ([e07ee31](https://git.demonkernel.io.vn/FoodSurf/backend/commit/e07ee318a7985d79689f3dc32fea97bb1051e22a))
## [1.5.3](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.2...v1.5.3) (2026-04-17)
### Bug Fixes
* better ci script ([#25](https://git.demonkernel.io.vn/FoodSurf/backend/issues/25)) ([f1ffc63](https://git.demonkernel.io.vn/FoodSurf/backend/commit/f1ffc63a5fe3f04b7de622f4df1406ddd977e8aa))
* Resolve runtime issue with native build ([#24](https://git.demonkernel.io.vn/FoodSurf/backend/issues/24)) ([a97e9ad](https://git.demonkernel.io.vn/FoodSurf/backend/commit/a97e9ade6e20458eb53bdb7ab9d083cef51408fc))
## [1.5.2](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.1...v1.5.2) (2026-04-13)
+18 -4
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.2</version>
<version>1.5.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -17,9 +17,7 @@
<packaging>quarkus</packaging>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
<compiler-plugin.version>3.15.0</compiler-plugin.version>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -164,4 +162,20 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>
@@ -0,0 +1,16 @@
package com.drinkool.mapper;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.BadRequestException;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
public class ExceptionHandlersMapper {
@ServerExceptionMapper
public Response mapBadRequestException(BadRequestException x) {
return Response.status(Response.Status.BAD_REQUEST)
.entity(x.getMessage())
.type("text/plain")
.build();
}
}
@@ -3,21 +3,21 @@ package com.drinkool.services;
import com.drinkool.InternalValue;
import com.drinkool.Url;
import com.drinkool.models.UserModel;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.UUID;
public abstract class BaseService {
public abstract class BaseService<T extends UserModel> {
private UserModel model;
private final PanacheRepositoryBase<T, UUID> repository;
public BaseService(UserModel model) {
this.model = model;
protected BaseService(Class<T> entityClass) {
this.repository = new PanacheRepositoryBase<T, UUID>() {};
}
@SuppressWarnings("static-access")
@POST
@GET
@Path(Url.Me)
@Transactional
public Response me(@HeaderParam(InternalValue.userId) UUID id) {
@@ -25,6 +25,6 @@ public abstract class BaseService {
.entity("InvalidUserId")
.build();
return Response.ok(model.find("id", id).firstResult()).build();
return Response.ok(repository.findById(id)).build();
}
}
@@ -9,13 +9,13 @@ import jakarta.ws.rs.*;
import jakarta.ws.rs.core.*;
@Path(Role.Customer)
public class CustomerService extends BaseService {
public class CustomerService extends BaseService<CustomerEntity> {
@Inject
OtpService otpService;
public CustomerService() {
super(new CustomerEntity());
super(CustomerEntity.class);
}
@POST
@@ -29,6 +29,7 @@ public class CustomerService extends BaseService {
return Response.status(Response.Status.CREATED)
.header(InternalValue.userId, newCustomer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(newCustomer)
.build();
}
@@ -41,8 +42,6 @@ public class CustomerService extends BaseService {
newCustomer.signup(input.phone);
return Response.status(Response.Status.CREATED)
.header(InternalValue.userId, newCustomer.id.toString())
.header(InternalValue.role, Role.Customer)
.build();
}
@@ -67,6 +66,7 @@ public class CustomerService extends BaseService {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(customer)
.build();
}
@@ -87,6 +87,7 @@ public class CustomerService extends BaseService {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(customer)
.build();
}
}
@@ -7,7 +7,7 @@ quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres
quarkus.hibernate-orm.database.generation=update
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=account-service
quarkus.container-image.push=true
@@ -27,4 +27,4 @@ quarkus.index-dependency.lib.artifact-id=lib
quarkus.native.container-build=true
quarkus.native.remote-container-build=true
quarkus.native.additional-build-args=--initialize-at-run-time=com.password4j.AlgorithmFinder,--future-defaults=all
quarkus.native.resources.includes=com/google/i18n/phonenumbers/data/.*
quarkus.native.resources.includes=com/google/i18n/phonenumbers/data/**/*
@@ -15,14 +15,16 @@ public class BaseServiceTest {
@Test
public void testMeEndpointWithHeader() {
String phone = Utils.generateRandomPhone();
QuickSignup input = new QuickSignup();
Signup input = new Signup();
input.name = "Test User";
input.phone = phone;
input.password = "password123";
String testUserId = given()
.contentType(ContentType.JSON)
.body(input)
.when()
.post(Role.Customer + Url.QuickSignup)
.post(Role.Customer + Url.Signup)
.then()
.extract()
.header(InternalValue.userId);
@@ -31,7 +33,7 @@ public class BaseServiceTest {
.header(InternalValue.userId, testUserId)
.contentType(ContentType.JSON)
.when()
.post(Role.Customer + Url.Me)
.get(Role.Customer + Url.Me)
.then()
.statusCode(200)
.body("id", is(testUserId));
@@ -39,6 +41,6 @@ public class BaseServiceTest {
@Test
public void testMeEndpointWithoutHeader() {
given().when().post(Role.Customer + Url.Me).then().statusCode(400);
given().when().get(Role.Customer + Url.Me).then().statusCode(400);
}
}
@@ -50,8 +50,6 @@ public class CustomerServiceTest {
.when()
.post(Role.Customer + Url.QuickSignup)
.then()
.header(InternalValue.userId, notNullValue())
.header(InternalValue.role, is(Role.Customer))
.statusCode(201);
assertEquals(1, CustomerEntity.find("phone", phone).count());
+17 -4
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.2</version>
<version>1.5.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -17,9 +17,6 @@
<packaging>quarkus</packaging>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
<compiler-plugin.version>3.15.0</compiler-plugin.version>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -150,4 +147,20 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>
@@ -9,7 +9,7 @@ quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/eatery
quarkus.hibernate-orm.database.generation=update
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=eatery-service
quarkus.container-image.push=true
+16 -4
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.2</version>
<version>1.5.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -17,9 +17,6 @@
<packaging>quarkus</packaging>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
<compiler-plugin.version>3.15.0</compiler-plugin.version>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -142,4 +139,19 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>
@@ -1,34 +0,0 @@
package com.drinkool;
import com.drinkool.dtos.*;
import com.drinkool.services.AccountService;
import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api/" + Role.Customer)
class CustomerGatewayResource {
@Inject
@RestClient
AccountService accountService;
@POST
@Path(Url.Signup)
public Uni<Response> proxySignup(Signup input) {
return accountService.signup(input);
}
@POST
@Path(Url.Login)
public Uni<Response> proxyLogin(Login input) {
return accountService.login(input);
}
@GET
public Uni<Response> me() {
return accountService.me();
}
}
@@ -0,0 +1,26 @@
package com.drinkool.controller;
import com.drinkool.InternalValue;
import com.drinkool.Url;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.NewCookie;
import org.jboss.resteasy.reactive.RestResponse;
public abstract class BaseController {
@POST
@Path(Url.Logout)
public RestResponse<Void> logout() {
NewCookie cookie = new NewCookie.Builder(InternalValue.cookieName)
.secure(true)
.maxAge(0)
.path("/")
.httpOnly(true)
.build();
return RestResponse.ResponseBuilder.<Void>noContent()
.cookie(cookie)
.build();
}
}
@@ -0,0 +1,48 @@
package com.drinkool.controller;
import com.drinkool.*;
import com.drinkool.dtos.*;
import com.drinkool.services.CustomerService;
import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.*;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api/" + Role.Customer)
public class CustomerController extends BaseController {
@Inject
@RestClient
CustomerService accountService;
@POST
@Path(Url.Signup)
public Uni<Response> proxySignup(Signup input) {
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) {
return accountService.quickSignup(input);
}
@POST()
@Path(Url.QuickLogin)
public Uni<Response> proxyQuickLogin(QuickLogin input) {
return accountService.quickLogin(input);
}
@GET
public Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id) {
return accountService.me(id);
}
}
@@ -0,0 +1,21 @@
package com.drinkool.mappers;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
import org.jboss.resteasy.reactive.ClientWebApplicationException;
@Provider
public class RestClientExceptionMapper
implements ExceptionMapper<ClientWebApplicationException>
{
@Override
public Response toResponse(ClientWebApplicationException exception) {
Response originalResponse = exception.getResponse();
return Response.status(originalResponse.getStatus())
.entity(originalResponse.readEntity(String.class))
.build();
}
}
@@ -1,16 +1,16 @@
package com.drinkool.services;
import com.drinkool.Role;
import com.drinkool.Url;
import com.drinkool.*;
import com.drinkool.dtos.*;
import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.*;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "account")
@Path(Role.Customer)
public interface AccountService {
public interface CustomerService {
@POST
@Path(Url.Signup)
Uni<Response> signup(Signup input);
@@ -25,12 +25,9 @@ public interface AccountService {
@POST
@Path(Url.QuickLogin)
Uni<Response> quickLogin(QuickSignup input);
@POST
@Path(Url.SmsOtp)
Uni<Response> smsOtp(SmsOtp input);
Uni<Response> quickLogin(QuickLogin input);
@GET
Uni<Response> me();
@Path(Url.Me)
Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id);
}
@@ -1,5 +1,5 @@
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=gateway-service
quarkus.container-image.push=true
@@ -0,0 +1,24 @@
package com.drinkool.controller;
import static io.restassured.RestAssured.*;
import static org.hamcrest.CoreMatchers.*;
import com.drinkool.*;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
@QuarkusTest
public class BaseControllerTest {
@Test
public void testLogoutShouldClearCookie() {
given()
.when()
.post("/api/" + Role.Customer + Url.Logout)
.then()
.statusCode(204)
.header("Set-Cookie", containsString(InternalValue.cookieName))
.header("Set-Cookie", containsString("Max-Age=0"))
.header("Set-Cookie", containsString("HttpOnly"));
}
}
@@ -2,4 +2,7 @@
quarkus.http.host=0.0.0.0
# JWT
gateway.jwt.secret=1uZk07Hqu1316z9YqrcSGPTTJDhMWU1ZhFSLBrDQvmU=
gateway.jwt.secret=1uZk07Hqu1316z9YqrcSGPTTJDhMWU1ZhFSLBrDQvmU=
# App configuration
quarkus.rest-client.account.url=http://account-service:8080
+3 -3
View File
@@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: account-pod
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.2
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
@@ -73,7 +73,7 @@ spec:
spec:
containers:
- name: eatery-pod
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.2
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
@@ -129,7 +129,7 @@ spec:
spec:
containers:
- name: gateway-pod
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.2
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.2</version>
<version>1.5.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
+1
View File
@@ -8,4 +8,5 @@ public class Url {
public static final String QuickLogin = "/quick_login";
public static final String SmsOtp = "/sms_otp";
public static final String Me = "/me";
public static final String Logout = "/logout";
}
+1 -1
View File
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.2</version>
<version>1.5.6</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>25</maven.compiler.source>
+3
View File
@@ -0,0 +1,3 @@
mvn clean package -DskipTests -Pnative \
-Dquarkus.container-image.push=false \
-Dquarkus.container-image.registry=git.demonkernel.io.vn
+3
View File
@@ -0,0 +1,3 @@
mvn clean install -DskipTests \
-Dquarkus.container-image.build=false \
-Dquarkus.container-image.push=false
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
CURRENT_DIR=$(pwd)
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
cd "$SCRIPT_DIR/.."
kubectl delete all --all -n drinkool-backend
kubectl apply -f k8s.yaml -n drinkool-backend
cd "$CURRENT_DIR"
+1
View File
@@ -0,0 +1 @@
mvn clean package -Dquarkus.container-image.push=false -Dquarkus.container-image.build=false