Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25cb59c56c | |||
| d49482b4ba | |||
| d1d81037a4 | |||
| ec25744942 | |||
| ffdd64a1da | |||
| a04e3353f8 | |||
| 1416c61da1 | |||
| 6b1368fc42 | |||
| 2b993bdef4 | |||
| 8da7877920 | |||
| 45e01a863b | |||
| d851a49fc3 | |||
| 5cd79b10a2 | |||
| 4f66008774 | |||
| db13397063 | |||
| 89107bb5a8 | |||
| ad77a3022c | |||
| 9d900f8fb3 | |||
| 2b6f8da6c2 | |||
| 9b2d90d290 | |||
| d40c586299 | |||
| 66df4488c0 | |||
| a3470a3b7a | |||
| a320b6cd16 | |||
| 392d395215 | |||
| 784e516eea |
@@ -4,7 +4,7 @@ services:
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
- "host.docker.internal:host-gateway"
|
||||
environment:
|
||||
KAFKA_NODE_ID: 1
|
||||
KAFKA_PROCESS_ROLES: broker,controller
|
||||
@@ -13,7 +13,7 @@ services:
|
||||
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_AUTO_CREATE_TOPICS_ENABLE: "true"
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
|
||||
kafdrop:
|
||||
@@ -23,7 +23,7 @@ services:
|
||||
- kafka
|
||||
network_mode: host
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
- "host.docker.internal:host-gateway"
|
||||
command: sh -c "sleep 5 && exec ./start-app"
|
||||
environment:
|
||||
KAFKA_BROKERCONNECT: 'localhost:9092'
|
||||
KAFKA_BROKERCONNECT: "localhost:9092"
|
||||
|
||||
@@ -11,5 +11,5 @@ services:
|
||||
- ../..:/workspaces:cached
|
||||
network_mode: host
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
- "host.docker.internal:host-gateway"
|
||||
command: sleep infinity
|
||||
@@ -5,7 +5,7 @@ services:
|
||||
- POSTGRES_PASSWORD=password
|
||||
network_mode: host
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
- "host.docker.internal:host-gateway"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ jobs:
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
distribution: "temurin"
|
||||
java-version: "25"
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
@@ -43,7 +43,15 @@ jobs:
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
@@ -53,6 +61,7 @@ jobs:
|
||||
|
||||
- name: Run Semantic Release
|
||||
env:
|
||||
GITEA_USER: ${{ github.actor }}
|
||||
GITEA_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
run: |
|
||||
pnpm i
|
||||
@@ -60,7 +69,6 @@ jobs:
|
||||
pnpm release
|
||||
|
||||
- name: Commit & Push Changes
|
||||
if: always()
|
||||
env:
|
||||
MY_PAT_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
run: |
|
||||
|
||||
@@ -46,3 +46,4 @@ nb-configuration.xml
|
||||
|
||||
# NodeJS
|
||||
/node_modules
|
||||
/.pnpm-store
|
||||
@@ -8,7 +8,7 @@
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "./mvnw versions:set -DnewVersion=${nextRelease.version}",
|
||||
"publishCmd": "./mvnw clean package -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests"
|
||||
"publishCmd": "./mvnw package -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests"
|
||||
}
|
||||
],
|
||||
["@saithodev/semantic-release-gitea", {
|
||||
@@ -0,0 +1,56 @@
|
||||
# [1.0.0-dev.16](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.15...v1.0.0-dev.16) (2026-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better build configuration ([ec25744](https://git.demonkernel.io.vn/FoodSurf/backend/commit/ec2574494239b5660b740f14947134aa4839f2da))
|
||||
|
||||
# [1.0.0-dev.12](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.11...v1.0.0-dev.12) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test ([8da7877](https://git.demonkernel.io.vn/FoodSurf/backend/commit/8da7877920b552e1e2f325bb40ccb4eb9a9c0907))
|
||||
|
||||
# [1.0.0-dev.11](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.10...v1.0.0-dev.11) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better act config ([d851a49](https://git.demonkernel.io.vn/FoodSurf/backend/commit/d851a49fc3d831048eae6482aab1b915fb39f6da))
|
||||
|
||||
# [1.0.0-dev.10](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.9...v1.0.0-dev.10) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test ([4f66008](https://git.demonkernel.io.vn/FoodSurf/backend/commit/4f66008774e1bd338bc94dd58f9500310490d3f2))
|
||||
* test ([db13397](https://git.demonkernel.io.vn/FoodSurf/backend/commit/db13397063c80ddf310510152bbdb397d98730b7))
|
||||
|
||||
# [1.0.0-dev.9](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.8...v1.0.0-dev.9) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test ([ad77a30](https://git.demonkernel.io.vn/FoodSurf/backend/commit/ad77a3022cd9f03749a764b91ee85942f9b696f9))
|
||||
|
||||
# [1.0.0-dev.8](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* removed ignore file ([9b2d90d](https://git.demonkernel.io.vn/FoodSurf/backend/commit/9b2d90d29003090954b104b54e7ba723c0bae1f7))
|
||||
|
||||
# [1.0.0-dev.7](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better image push ([66df448](https://git.demonkernel.io.vn/FoodSurf/backend/commit/66df4488c0fd9b9bda1df72877d7ab6c4a075d84))
|
||||
|
||||
# [1.0.0-dev.6](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2026-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test ([a320b6c](https://git.demonkernel.io.vn/FoodSurf/backend/commit/a320b6cd162be6f09381698ee1551e7575c33c1c))
|
||||
+15
-6
@@ -1,5 +1,9 @@
|
||||
<?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">
|
||||
<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"
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>account-service</artifactId>
|
||||
@@ -10,9 +14,11 @@
|
||||
<compiler-plugin.version>3.15.0</compiler-plugin.version>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<project.reporting.outputEncoding
|
||||
>UTF-8</project.reporting.outputEncoding>
|
||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.group-id
|
||||
>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.version>3.32.4</quarkus.platform.version>
|
||||
<skipITs>true</skipITs>
|
||||
<surefire-plugin.version>3.5.4</surefire-plugin.version>
|
||||
@@ -102,7 +108,8 @@
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<systemPropertyVariables>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<java.util.logging.manager
|
||||
>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
@@ -121,8 +128,10 @@
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<systemPropertyVariables>
|
||||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<native.image.path
|
||||
>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||
<java.util.logging.manager
|
||||
>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.drinkool;
|
||||
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.models.Customer;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.*;
|
||||
|
||||
@Path("/api")
|
||||
public class RestAPI {
|
||||
|
||||
@POST
|
||||
@Path("/signup")
|
||||
@Transactional
|
||||
@@ -36,11 +36,11 @@ public class RestAPI {
|
||||
public Response login(Login input) {
|
||||
Customer customer = Customer.find("phone", input.phone).firstResult();
|
||||
|
||||
if (customer == null)
|
||||
throw new BadRequestException("InvalidPhoneNumber");
|
||||
if (customer == null) throw new BadRequestException("InvalidPhoneNumber");
|
||||
|
||||
if (!customer.login(input.password))
|
||||
throw new BadRequestException("InvalidPassword");
|
||||
if (!customer.login(input.password)) throw new BadRequestException(
|
||||
"InvalidPassword"
|
||||
);
|
||||
|
||||
return Response.accepted().build();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class Login {
|
||||
|
||||
public String phone;
|
||||
public String password;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class QuickSignup {
|
||||
|
||||
public String phone;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class Signup {
|
||||
|
||||
public String name;
|
||||
public String phone;
|
||||
public String password;
|
||||
|
||||
@@ -4,6 +4,4 @@ import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "customer")
|
||||
public class Customer extends User {
|
||||
|
||||
}
|
||||
public class Customer extends User {}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package com.drinkool.models;
|
||||
|
||||
import com.drinkool.utils.PhoneValidator;
|
||||
import com.password4j.Password;
|
||||
import io.quarkus.hibernate.orm.panache.PanacheEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.transaction.*;
|
||||
import jakarta.ws.rs.BadRequestException;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.drinkool.utils.PhoneValidator;
|
||||
import com.password4j.Password;
|
||||
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
@Table(name = "users")
|
||||
public abstract class User extends PanacheEntity {
|
||||
|
||||
@Column(nullable = false)
|
||||
public String name;
|
||||
|
||||
@@ -48,8 +47,7 @@ public abstract class User extends PanacheEntity {
|
||||
}
|
||||
|
||||
public boolean login(String rawPassword) {
|
||||
if (this.hashedPassword == null)
|
||||
return false;
|
||||
if (this.hashedPassword == null) return false;
|
||||
|
||||
return Password.check(rawPassword, this.hashedPassword).withArgon2();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.google.i18n.phonenumbers.*;
|
||||
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
|
||||
|
||||
public class PhoneValidator {
|
||||
private static final PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
|
||||
|
||||
private static final PhoneNumberUtil phoneUtil =
|
||||
PhoneNumberUtil.getInstance();
|
||||
|
||||
public static boolean isValidInternationalPhone(String phone) {
|
||||
try {
|
||||
|
||||
@@ -9,8 +9,8 @@ quarkus.hibernate-orm.database.generation=update
|
||||
|
||||
# URL của Gitea Registry (thường là gitea.yourdomain.com)
|
||||
quarkus.container-image.registry=git.demonkernel.io.vn
|
||||
quarkus.container-image.group=foodsurf/backend
|
||||
quarkus.container-image.name=auth-service
|
||||
quarkus.container-image.group=foodsurf
|
||||
quarkus.container-image.name=account-service
|
||||
quarkus.container-image.push=true
|
||||
quarkus.container-image.build=true
|
||||
quarkus.container-image.builder=docker
|
||||
@@ -1,20 +1,21 @@
|
||||
package com.drinkool;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@QuarkusTest
|
||||
class GreetingResourceTest {
|
||||
|
||||
@Test
|
||||
void testHelloEndpoint() {
|
||||
given()
|
||||
.when().get("/hello")
|
||||
.when()
|
||||
.get("/hello")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(is("Hello from Quarkus REST"));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"release": "semantic-release",
|
||||
"format": "prettier --write \"./**/*.{java,yaml,json,xml}\""
|
||||
"format": "prettier --write \"./**/*.{java,yaml,json,xml}\" \"./**/.*rc\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "DemonKernel",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
<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">
|
||||
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>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.0-dev.16</version>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
||||
Reference in New Issue
Block a user