Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ee14beb83 | |||
| aa7bfed331 | |||
| 8fad38fa6c | |||
| c4dce6f670 | |||
| eef3fb773b | |||
| 5d0a047602 | |||
| 8b2d3e7bef | |||
| e72ccf4e96 | |||
| 8487a8ff19 | |||
| dc5bc731b3 | |||
| d45ed26a07 | |||
| 4a0e0e935c | |||
| 43734b51aa | |||
| 6777581022 | |||
| 88244cb56f | |||
| 6032a7c31b |
@@ -20,7 +20,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install JDK and Maven
|
||||
- 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
|
||||
@@ -48,7 +51,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install JDK and Maven
|
||||
- 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
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ plugins:
|
||||
mvn versions:set -DnewVersion=${nextRelease.version} &&
|
||||
sed -i "/image:.*-service:/ s|:[^:]*$|:${nextRelease.version}|" k8s/base/*.yaml &&
|
||||
if [ "${branch.name}" = "main" ]; then
|
||||
mvn package -B -Pnative -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests
|
||||
mvn package -B -Pnative -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests -Ppush
|
||||
fi
|
||||
- - "@saithodev/semantic-release-gitea"
|
||||
- giteaUrl: "https://git.demonkernel.io.vn/"
|
||||
|
||||
@@ -1,3 +1,62 @@
|
||||
## [1.5.32](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.31...v1.5.32) (2026-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* final commit ([#61](https://git.demonkernel.io.vn/FoodSurf/backend/issues/61)) ([aa7bfed](https://git.demonkernel.io.vn/FoodSurf/backend/commit/aa7bfed331be4fb8587bbf4f124170425c523378))
|
||||
|
||||
## [1.5.31](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.30...v1.5.31) (2026-05-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better shift handler ([#58](https://git.demonkernel.io.vn/FoodSurf/backend/issues/58)) ([c4dce6f](https://git.demonkernel.io.vn/FoodSurf/backend/commit/c4dce6f670a7365ba819fa79aada3c834bfeb032))
|
||||
|
||||
## [1.5.30](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.29...v1.5.30) (2026-05-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better cart response ([#57](https://git.demonkernel.io.vn/FoodSurf/backend/issues/57)) ([5d0a047](https://git.demonkernel.io.vn/FoodSurf/backend/commit/5d0a0476029cee55f8fbe6ec6e9565ca53ee16bc))
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
### 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))
|
||||
|
||||
## [1.5.28](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.27...v1.5.28) (2026-05-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* resolved minor issue ([#53](https://git.demonkernel.io.vn/FoodSurf/backend/issues/53)) ([43734b5](https://git.demonkernel.io.vn/FoodSurf/backend/commit/43734b51aafad7f823ff5d34322cc6fb6f4e6699))
|
||||
|
||||
## [1.5.27](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.26...v1.5.27) (2026-05-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add payment features ([#52](https://git.demonkernel.io.vn/FoodSurf/backend/issues/52)) ([88244cb](https://git.demonkernel.io.vn/FoodSurf/backend/commit/88244cb56f28193cd8cb0da78d5b8d290870284b))
|
||||
|
||||
## [1.5.26](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.25...v1.5.26) (2026-05-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add shift features ([#51](https://git.demonkernel.io.vn/FoodSurf/backend/issues/51)) ([345d4c0](https://git.demonkernel.io.vn/FoodSurf/backend/commit/345d4c056ccf6ab5f7c455a17e8a3eedfde3ac62))
|
||||
* better getCart ([#49](https://git.demonkernel.io.vn/FoodSurf/backend/issues/49)) ([4290f48](https://git.demonkernel.io.vn/FoodSurf/backend/commit/4290f482f4aa74467982cc5aa6293d9d308538d3))
|
||||
|
||||
## [1.5.26](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.25...v1.5.26) (2026-05-11)
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.models.UserModel;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,6 +12,7 @@ import java.util.List;
|
||||
@Table(name = Role.Manager)
|
||||
public class ManagerEntity extends UserModel {
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(
|
||||
mappedBy = "serve",
|
||||
cascade = CascadeType.ALL,
|
||||
@@ -17,7 +20,25 @@ public class ManagerEntity extends UserModel {
|
||||
)
|
||||
public List<StaffEntity> staffs = new ArrayList<>();
|
||||
|
||||
@JsonIgnore
|
||||
@Column(nullable = true)
|
||||
public String bankAccount;
|
||||
|
||||
public ManagerEntity() {
|
||||
super(Role.Manager);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ManagerEntity signup(
|
||||
String name,
|
||||
String phone,
|
||||
String bankAccount,
|
||||
String rawPassword
|
||||
) {
|
||||
this.bankAccount = bankAccount;
|
||||
|
||||
super.signup(name, phone, rawPassword);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ import jakarta.transaction.Transactional;
|
||||
@Table(name = Role.Staff)
|
||||
public class StaffEntity extends UserModel {
|
||||
|
||||
public StaffEntity() {
|
||||
super(Role.Staff);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void signup(
|
||||
String name,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.drinkool.filters;
|
||||
|
||||
import com.drinkool.lib.utils.BaseHeaderAuthentication;
|
||||
import com.drinkool.BaseHeaderAuthentication;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
@ApplicationScoped
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.drinkool.models;
|
||||
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import com.drinkool.entities.BaseEntity;
|
||||
import com.drinkool.utils.PhoneValidator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.password4j.Password;
|
||||
|
||||
@@ -2,9 +2,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.entities.StaffEntity;
|
||||
import com.drinkool.lib.dtos.SmsOtp;
|
||||
import com.drinkool.models.UserModel;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.drinkool.services;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.entities.CustomerEntity;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.*;
|
||||
import java.util.UUID;
|
||||
|
||||
@Path(Role.Customer)
|
||||
public class CustomerService extends BaseService<CustomerEntity> {
|
||||
@@ -65,7 +66,6 @@ public class CustomerService extends BaseService<CustomerEntity> {
|
||||
return Response.accepted()
|
||||
.header(InternalValue.userId, customer.id.toString())
|
||||
.header(InternalValue.role, Role.Customer)
|
||||
.entity(customer)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -89,4 +89,10 @@ public class CustomerService extends BaseService<CustomerEntity> {
|
||||
.entity(customer)
|
||||
.build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Response findStaff(@PathParam("id") UUID staffId) {
|
||||
return Response.ok(CustomerEntity.findById(staffId)).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.drinkool.services;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.dtos.event.ManagerCreate;
|
||||
import com.drinkool.entities.ManagerEntity;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.lib.dtos.event.ManagerCreate;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.*;
|
||||
import java.util.UUID;
|
||||
import org.eclipse.microprofile.reactive.messaging.*;
|
||||
|
||||
@Path(Role.Manager)
|
||||
@@ -25,9 +26,18 @@ public class ManagerService extends BaseService<ManagerEntity> {
|
||||
@Path(Url.Signup)
|
||||
@Transactional
|
||||
public Response signup(ManagerSignup input) {
|
||||
if (ManagerEntity.count() > 0) return Response.status(
|
||||
Response.Status.BAD_REQUEST
|
||||
).build();
|
||||
|
||||
ManagerEntity newManager = new ManagerEntity();
|
||||
|
||||
newManager.signup(input.name, input.phone, input.password);
|
||||
newManager.signup(
|
||||
input.name,
|
||||
input.phone,
|
||||
input.bankAccount,
|
||||
input.password
|
||||
);
|
||||
|
||||
ManagerCreate message = new ManagerCreate();
|
||||
message.id = newManager.id;
|
||||
@@ -60,9 +70,41 @@ public class ManagerService extends BaseService<ManagerEntity> {
|
||||
.build();
|
||||
|
||||
return Response.accepted()
|
||||
.entity(manager)
|
||||
.header(InternalValue.userId, manager.id.toString())
|
||||
.header(InternalValue.role, Role.Manager)
|
||||
.entity(manager)
|
||||
.build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}/payment-qr")
|
||||
public Response getManagerPaymentQr(
|
||||
@PathParam("id") UUID id,
|
||||
@QueryParam("amount") Long amount,
|
||||
@QueryParam("cartId") String cartId
|
||||
) {
|
||||
ManagerEntity manager = ManagerEntity.findById(id);
|
||||
if (manager == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity("ManagerNotFound")
|
||||
.build();
|
||||
}
|
||||
|
||||
if (manager.bankAccount == null || manager.bankAccount.isEmpty()) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity("ManagerHasNotConfiguredBankInfo")
|
||||
.build();
|
||||
}
|
||||
|
||||
String description = cartId;
|
||||
|
||||
return Response.ok(
|
||||
String.format(
|
||||
"https://img.vietqr.io/image/%s-compact.png?amount=%d&addInfo=%s",
|
||||
manager.bankAccount,
|
||||
amount,
|
||||
description
|
||||
)
|
||||
).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,18 @@ package com.drinkool.services;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.dtos.Login;
|
||||
import com.drinkool.dtos.Signup;
|
||||
import com.drinkool.entities.ManagerEntity;
|
||||
import com.drinkool.entities.StaffEntity;
|
||||
import com.drinkool.lib.dtos.Login;
|
||||
import com.drinkool.lib.dtos.Signup;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -64,10 +66,16 @@ public class StaffService extends BaseService<StaffEntity> {
|
||||
.build();
|
||||
|
||||
return Response.accepted()
|
||||
.entity(staff)
|
||||
.header(InternalValue.userId, staff.id.toString())
|
||||
.header(InternalValue.managerId, staff.serve.id.toString())
|
||||
.header(InternalValue.role, Role.Staff)
|
||||
.entity(staff)
|
||||
.build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Response findStaff(@PathParam("id") UUID staffId) {
|
||||
return Response.ok(StaffEntity.findById(staffId)).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drinkool.services;
|
||||
import static io.restassured.RestAssured.*;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.http.ContentType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -4,7 +4,7 @@ import static io.restassured.RestAssured.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.http.ContentType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -4,8 +4,8 @@ import static io.restassured.RestAssured.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.entities.CustomerEntity;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.http.ContentType;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
@@ -4,15 +4,18 @@ import static io.restassured.RestAssured.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.entities.ManagerEntity;
|
||||
import io.quarkus.test.common.QuarkusTestResource;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.kafka.*;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.smallrye.reactive.messaging.kafka.companion.ConsumerTask;
|
||||
import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@QuarkusTest
|
||||
@@ -25,6 +28,12 @@ public class ManagerServiceTest {
|
||||
@ConfigProperty(name = "mp.messaging.outgoing.manager-out.topic")
|
||||
String topicName;
|
||||
|
||||
@BeforeEach
|
||||
@Transactional
|
||||
void setup() {
|
||||
ManagerEntity.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSignupSuccessAndKafkaMessageSent() {
|
||||
ManagerSignup input = new ManagerSignup();
|
||||
|
||||
+18
-18
@@ -4,45 +4,45 @@ import static io.restassured.RestAssured.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.entities.ManagerEntity;
|
||||
import com.drinkool.entities.StaffEntity;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import io.quarkus.test.common.QuarkusTestResource;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.kafka.*;
|
||||
import io.restassured.http.ContentType;
|
||||
import jakarta.enterprise.context.control.ActivateRequestContext;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import net.datafaker.Faker;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@QuarkusTest
|
||||
@QuarkusTestResource(KafkaCompanionResource.class)
|
||||
public class StaffServiceTest {
|
||||
public class StaffServiceTest_ {
|
||||
|
||||
private final Faker faker = new Faker();
|
||||
|
||||
private String managerId;
|
||||
private static String managerId;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
@BeforeAll
|
||||
@Transactional
|
||||
@ActivateRequestContext
|
||||
static void setup() throws InterruptedException {
|
||||
ManagerSignup input = new ManagerSignup();
|
||||
input.name = "Ho Van Quan";
|
||||
input.phone = Utils.generateRandomPhone();
|
||||
input.password = "strong_password";
|
||||
input.eateryName = "Quan Com Ngon";
|
||||
|
||||
var response = given()
|
||||
.contentType("application/json")
|
||||
.body(input)
|
||||
.when()
|
||||
.post(Role.Manager + Url.Signup)
|
||||
.then()
|
||||
.statusCode(201)
|
||||
.header(InternalValue.userId, org.hamcrest.Matchers.notNullValue())
|
||||
.header(InternalValue.role, Role.Manager)
|
||||
.extract();
|
||||
|
||||
managerId = response.header(InternalValue.userId);
|
||||
managerId = (new ManagerEntity()).signup(
|
||||
input.name,
|
||||
input.phone,
|
||||
"",
|
||||
input.password
|
||||
).id.toString();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.drinkool.controllers;
|
||||
|
||||
import com.drinkool.Role;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
|
||||
@RegisterRestClient(configKey = "account")
|
||||
@Path(Role.Manager)
|
||||
public interface ManagerController {
|
||||
@GET
|
||||
@Path("/{id}/payment-qr")
|
||||
public Response getManagerPaymentQr(
|
||||
@PathParam("id") String id,
|
||||
@QueryParam("amount") Long amount,
|
||||
@QueryParam("cartId") String cartId
|
||||
);
|
||||
}
|
||||
@@ -15,4 +15,6 @@ public class Cart {
|
||||
public UUID userId;
|
||||
public UUID eateryId;
|
||||
public List<CartItem> items;
|
||||
public long totalAmount;
|
||||
public String paymentQrUrl;
|
||||
}
|
||||
|
||||
@@ -11,4 +11,7 @@ public class CartItem {
|
||||
|
||||
public String productId;
|
||||
public Integer quantity;
|
||||
|
||||
public Double priceAtTimeOfAdding;
|
||||
public Double subTotal;
|
||||
}
|
||||
|
||||
@@ -2,19 +2,20 @@ package com.drinkool.services;
|
||||
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.controllers.EateryController;
|
||||
import com.drinkool.controllers.ManagerController;
|
||||
import com.drinkool.dtos.Cart;
|
||||
import com.drinkool.dtos.CartItem;
|
||||
import io.quarkus.redis.datasource.RedisDataSource;
|
||||
import io.quarkus.redis.datasource.hash.HashCommands;
|
||||
import io.quarkus.redis.datasource.value.ValueCommands;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import io.smallrye.mutiny.infrastructure.Infrastructure;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.eclipse.microprofile.graphql.GraphQLApi;
|
||||
@@ -35,12 +36,16 @@ public class CartService {
|
||||
@RestClient
|
||||
EateryController eateryController;
|
||||
|
||||
@Inject
|
||||
@RestClient
|
||||
ManagerController managerController;
|
||||
|
||||
private final HashCommands<String, String, String> hashCommands;
|
||||
private final ValueCommands<String, String> valueCommands;
|
||||
|
||||
@Inject
|
||||
public CartService(RedisDataSource ds) {
|
||||
this.hashCommands = ds.hash(String.class);
|
||||
this.hashCommands = ds.hash(String.class, String.class, String.class);
|
||||
this.valueCommands = ds.value(String.class);
|
||||
}
|
||||
|
||||
@@ -50,6 +55,7 @@ public class CartService {
|
||||
|
||||
return eateryController
|
||||
.getEateryById(eateryId)
|
||||
.emitOn(Infrastructure.getDefaultWorkerPool())
|
||||
.onItem()
|
||||
.transform(response -> {
|
||||
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
|
||||
@@ -58,6 +64,7 @@ public class CartService {
|
||||
|
||||
String cartId = UUID.randomUUID().toString();
|
||||
String redisKey = "cart:" + cartId;
|
||||
String ownerId = response.readEntity(String.class);
|
||||
|
||||
hashCommands.hset(
|
||||
redisKey,
|
||||
@@ -65,7 +72,9 @@ public class CartService {
|
||||
"_metadata_owner",
|
||||
userId != null ? userId : "GUEST",
|
||||
"_metadata_eatery",
|
||||
eateryId.toString()
|
||||
eateryId.toString(),
|
||||
"_metadata_eateryManagerId",
|
||||
ownerId
|
||||
)
|
||||
);
|
||||
|
||||
@@ -87,55 +96,113 @@ public class CartService {
|
||||
@Query("getCart")
|
||||
public Cart getCart(@Name("cartId") UUID cartId) throws GraphQLException {
|
||||
String key = "cart:" + cartId;
|
||||
String priceKey = "cart_prices:" + cartId;
|
||||
|
||||
Map<String, String> data = hashCommands.hgetall(key);
|
||||
Map<String, String> itemPrices = hashCommands.hgetall(priceKey);
|
||||
|
||||
if (data.isEmpty()) {
|
||||
throw new GraphQLException("NotFoundCart");
|
||||
}
|
||||
|
||||
List<CartItem> items = new ArrayList<>();
|
||||
Cart cart = new Cart();
|
||||
cart.Id = cartId;
|
||||
cart.eateryId = UUID.fromString(data.get("_metadata_eatery"));
|
||||
String ownerStr = data.get("_metadata_owner");
|
||||
String managerId = data.get("_metadata_eateryManagerId");
|
||||
cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr);
|
||||
cart.items = new ArrayList<>();
|
||||
|
||||
data.forEach((k, v) -> {
|
||||
if (!k.startsWith("_")) {
|
||||
items.add(new CartItem(k, Integer.parseInt(v)));
|
||||
}
|
||||
});
|
||||
long total = 0;
|
||||
|
||||
return new Cart(
|
||||
cartId,
|
||||
UUID.fromString(data.get("_metadata_owner")),
|
||||
UUID.fromString(data.get("_metadata_eatery")),
|
||||
items
|
||||
);
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
String field = entry.getKey();
|
||||
if (field.startsWith("_metadata_")) continue;
|
||||
|
||||
Integer qty = Integer.parseInt(entry.getValue());
|
||||
Double price = Double.parseDouble(itemPrices.getOrDefault(field, "0"));
|
||||
Double subTotal = qty * price;
|
||||
|
||||
CartItem item = new CartItem();
|
||||
item.productId = field;
|
||||
item.quantity = qty;
|
||||
item.priceAtTimeOfAdding = price;
|
||||
item.subTotal = subTotal;
|
||||
|
||||
cart.items.add(item);
|
||||
total += subTotal;
|
||||
}
|
||||
cart.totalAmount = total;
|
||||
|
||||
try {
|
||||
Response response = managerController.getManagerPaymentQr(
|
||||
managerId,
|
||||
total,
|
||||
cartId.toString()
|
||||
);
|
||||
|
||||
cart.paymentQrUrl = response.readEntity(String.class);
|
||||
} catch (Exception e) {
|
||||
cart.paymentQrUrl = "";
|
||||
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
return cart;
|
||||
}
|
||||
|
||||
@Mutation("addItem")
|
||||
public Uni<Cart> addItem(
|
||||
public Cart addItem(
|
||||
@Name("cartId") UUID cartId,
|
||||
@Name("menuItemId") UUID menuItemId,
|
||||
@Name("quantity") long quantity
|
||||
) {
|
||||
) throws GraphQLException {
|
||||
String key = "cart:" + cartId;
|
||||
String priceKey = "cart_prices:" + cartId;
|
||||
|
||||
UUID eateryId = UUID.fromString(hashCommands.hget(key, "_metadata_eatery"));
|
||||
String eateryIdStr = hashCommands.hget(key, "_metadata_eatery");
|
||||
if (eateryIdStr == null) throw new RuntimeException("CartNotFound");
|
||||
|
||||
return eateryController
|
||||
UUID eateryId = UUID.fromString(eateryIdStr);
|
||||
|
||||
Response response = eateryController
|
||||
.checkMenuItemExists(eateryId, menuItemId)
|
||||
.onItem()
|
||||
.transform(response -> {
|
||||
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
|
||||
throw new RuntimeException("NotFoundEatery");
|
||||
}
|
||||
.await()
|
||||
.indefinitely();
|
||||
|
||||
hashCommands.hincrby(key, menuItemId.toString(), quantity);
|
||||
hashCommands.getDataSource().key().expire(key, Duration.ofDays(30));
|
||||
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
|
||||
throw new GraphQLException("NotFoundMenuItemInEatery");
|
||||
}
|
||||
|
||||
try {
|
||||
return getCart(cartId);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
});
|
||||
Double menuItemPrice = response.readEntity(Double.class);
|
||||
|
||||
hashCommands.hincrby(key, menuItemId.toString(), quantity);
|
||||
hashCommands.hset(
|
||||
priceKey,
|
||||
menuItemId.toString(),
|
||||
String.valueOf(menuItemPrice)
|
||||
);
|
||||
|
||||
hashCommands.getDataSource().key().expire(key, Duration.ofDays(30));
|
||||
hashCommands.getDataSource().key().expire(priceKey, Duration.ofDays(30));
|
||||
|
||||
return getCart(cartId);
|
||||
}
|
||||
|
||||
@Mutation("deleteCart")
|
||||
public Uni<Boolean> deleteCart(@Name("cartId") UUID cartId) {
|
||||
String key = "cart:" + cartId;
|
||||
String priceKey = "cart_prices:" + cartId;
|
||||
|
||||
return Uni.createFrom()
|
||||
.item(() -> {
|
||||
long deletedKeys = hashCommands
|
||||
.getDataSource()
|
||||
.key()
|
||||
.del(key, priceKey);
|
||||
|
||||
return deletedKeys > 0;
|
||||
})
|
||||
.runSubscriptionOn(Infrastructure.getDefaultWorkerPool());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,3 +21,4 @@ quarkus.redis.hosts=redis://${REDIS_SERVICE_SERVICE_HOST:localhost}:${REDIS_SERV
|
||||
|
||||
# Rest Client
|
||||
quarkus.rest-client.eatery.url=http://eatery-service
|
||||
quarkus.rest-client.account.url=http://account-service
|
||||
|
||||
+10
-9
@@ -7,6 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.drinkool.controllers.EateryController;
|
||||
import com.drinkool.controllers.ManagerController;
|
||||
import com.drinkool.dtos.Cart;
|
||||
import io.quarkus.redis.datasource.RedisDataSource;
|
||||
import io.quarkus.redis.datasource.hash.HashCommands;
|
||||
@@ -18,7 +19,6 @@ import io.smallrye.mutiny.helpers.test.UniAssertSubscriber;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@QuarkusTest
|
||||
public class CartServiceTest {
|
||||
public class CartServiceTest_ {
|
||||
|
||||
@Inject
|
||||
CartService cartService;
|
||||
@@ -40,6 +40,10 @@ public class CartServiceTest {
|
||||
@RestClient
|
||||
EateryController eateryController;
|
||||
|
||||
@InjectMock
|
||||
@RestClient
|
||||
ManagerController managerController;
|
||||
|
||||
@Inject
|
||||
RedisDataSource redisDataSource;
|
||||
|
||||
@@ -59,7 +63,7 @@ public class CartServiceTest {
|
||||
UUID eateryId = UUID.randomUUID();
|
||||
|
||||
when(eateryController.getEateryById(eateryId)).thenReturn(
|
||||
Uni.createFrom().item(Response.ok().build())
|
||||
Uni.createFrom().item(Response.ok(UUID.randomUUID()).build())
|
||||
);
|
||||
|
||||
String cartId = cartService
|
||||
@@ -119,7 +123,7 @@ public class CartServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddItem_Success() {
|
||||
void testAddItem_Success() throws GraphQLException {
|
||||
UUID cartId = UUID.randomUUID();
|
||||
UUID eateryId = UUID.randomUUID();
|
||||
UUID menuItemId = UUID.randomUUID();
|
||||
@@ -129,13 +133,10 @@ public class CartServiceTest {
|
||||
hashCommands.hset(key, "_metadata_owner", UUID.randomUUID().toString());
|
||||
|
||||
when(eateryController.checkMenuItemExists(eateryId, menuItemId)).thenReturn(
|
||||
Uni.createFrom().item(Response.ok().build())
|
||||
Uni.createFrom().item(Response.ok(17.0).build())
|
||||
);
|
||||
|
||||
Cart result = cartService
|
||||
.addItem(cartId, menuItemId, 2L)
|
||||
.await()
|
||||
.atMost(Duration.ofSeconds(5));
|
||||
Cart result = cartService.addItem(cartId, menuItemId, 2L);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(cartId, result.getId());
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -23,5 +23,9 @@ public class AddMenuItem implements MenuItemInterface {
|
||||
@NonNull
|
||||
private Double price;
|
||||
|
||||
private Boolean available;
|
||||
|
||||
private String description;
|
||||
|
||||
private String imageUrl;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import org.eclipse.microprofile.graphql.NonNull;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.microprofile.graphql.NonNull;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class CreateShift {
|
||||
|
||||
@NonNull
|
||||
public String name;
|
||||
public LocalDate date;
|
||||
|
||||
@NonNull
|
||||
public LocalTime startTime;
|
||||
@@ -18,4 +18,7 @@ public class CreateShift {
|
||||
public LocalTime endTime;
|
||||
|
||||
public Integer maxStaff;
|
||||
|
||||
@NonNull
|
||||
public Integer wage;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.drinkool.dtos;
|
||||
|
||||
import com.drinkool.entities.MenuItemEntity;
|
||||
import com.drinkool.entities.ReviewEntity;
|
||||
import com.drinkool.lib.dtos.SendReview;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@@ -26,5 +26,9 @@ public class UpdateMenuItem implements EntityInterface, MenuItemInterface {
|
||||
|
||||
Double price;
|
||||
|
||||
Boolean available;
|
||||
|
||||
String description;
|
||||
|
||||
String imageUrl;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -2,8 +2,12 @@ package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.dtos.AddMenuItem;
|
||||
import com.drinkool.interfaces.MenuItemInterface;
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -20,10 +24,16 @@ public class MenuItemEntity extends BaseEntity implements MenuItemInterface {
|
||||
@Column(nullable = false)
|
||||
public Double price;
|
||||
|
||||
@Column(columnDefinition = "boolean default true")
|
||||
public Boolean available;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "eatery_id")
|
||||
public EateryEntity eatery;
|
||||
|
||||
@Column(columnDefinition = "TEXT default ''")
|
||||
public String description;
|
||||
|
||||
@Column(nullable = true)
|
||||
public String imageUrl;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.interfaces.ReviewInterface;
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -17,6 +16,7 @@ import lombok.Setter;
|
||||
@Table(name = "reviews")
|
||||
public class ReviewEntity extends BaseEntity implements ReviewInterface {
|
||||
|
||||
@Column(nullable = true)
|
||||
public UUID reviewerId;
|
||||
|
||||
public UUID eateryId;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.UUID;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table
|
||||
@@ -19,7 +22,7 @@ public class ShiftEntity extends BaseEntity {
|
||||
public EateryEntity eatery;
|
||||
|
||||
@Column(nullable = false)
|
||||
public String name;
|
||||
public LocalDate date;
|
||||
|
||||
@Column(nullable = false)
|
||||
public LocalTime startTime;
|
||||
@@ -29,4 +32,14 @@ public class ShiftEntity extends BaseEntity {
|
||||
|
||||
@Column(nullable = true)
|
||||
public Integer maxStaff;
|
||||
|
||||
@Column(nullable = false)
|
||||
public Integer wage;
|
||||
|
||||
@OneToMany(
|
||||
mappedBy = "shift",
|
||||
cascade = CascadeType.ALL,
|
||||
orphanRemoval = true
|
||||
)
|
||||
public List<ShiftRegistrationEntity> registeredStaff = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -16,7 +16,8 @@ public class ShiftRegistrationEntity extends BaseEntity {
|
||||
@Column(nullable = false)
|
||||
public UUID staffId;
|
||||
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "shiftId")
|
||||
public ShiftEntity shift;
|
||||
|
||||
public static long countByShift(UUID shiftId) {
|
||||
@@ -28,10 +29,11 @@ public class ShiftRegistrationEntity extends BaseEntity {
|
||||
ShiftEntity registratingShift
|
||||
) {
|
||||
return list(
|
||||
"staffId = ?1 and shift.startTime < ?2 and shift.endTime > ?3",
|
||||
"staffId = ?1 and shift.startTime < ?2 and shift.endTime > ?3 and shift.date = ?4",
|
||||
staffId,
|
||||
registratingShift.endTime,
|
||||
registratingShift.startTime
|
||||
registratingShift.startTime,
|
||||
registratingShift.date
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.drinkool.filters;
|
||||
|
||||
import com.drinkool.lib.utils.BaseHeaderAuthentication;
|
||||
import com.drinkool.BaseHeaderAuthentication;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
@ApplicationScoped
|
||||
|
||||
@@ -5,9 +5,9 @@ import com.drinkool.Role;
|
||||
import com.drinkool.dtos.AddMenuItem;
|
||||
import com.drinkool.dtos.DtoMapper;
|
||||
import com.drinkool.dtos.UpdateMenuItem;
|
||||
import com.drinkool.dtos.event.ManagerCreate;
|
||||
import com.drinkool.entities.EateryEntity;
|
||||
import com.drinkool.entities.MenuItemEntity;
|
||||
import com.drinkool.lib.dtos.event.ManagerCreate;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@@ -42,33 +42,33 @@ public class EateryService {
|
||||
EateryEntity eatery = EateryEntity.findById(id);
|
||||
|
||||
if (eatery == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity("NotFoundEatery")
|
||||
.build();
|
||||
}
|
||||
|
||||
return Response.ok().build();
|
||||
return Response.ok(eatery.ownerId.toString()).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{eateryId}/{menuItemId}")
|
||||
public Response checkMenuItemExists(
|
||||
public Response getMenuItemPrice(
|
||||
@PathParam("eateryId") UUID eateryId,
|
||||
@PathParam("menuItemId") UUID menuItemId
|
||||
) {
|
||||
long count = MenuItemEntity.find(
|
||||
"id = ?2 and eatery.id = ?1",
|
||||
eateryId,
|
||||
menuItemId
|
||||
).count();
|
||||
MenuItemEntity menuItem = MenuItemEntity.find(
|
||||
"id = ?1 and eatery.id = ?2",
|
||||
menuItemId,
|
||||
eateryId
|
||||
).firstResult();
|
||||
|
||||
if (count == 0) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
if (menuItem == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity("NotFoundMenuItem")
|
||||
.build();
|
||||
}
|
||||
|
||||
return Response.ok().build();
|
||||
return Response.ok(menuItem.price).build();
|
||||
}
|
||||
|
||||
@Incoming("manager-in")
|
||||
|
||||
@@ -4,12 +4,11 @@ import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.dtos.DtoMapper;
|
||||
import com.drinkool.dtos.SendReview;
|
||||
import com.drinkool.entities.ReviewEntity;
|
||||
import com.drinkool.enums.SortBy;
|
||||
import com.drinkool.lib.dtos.SendReview;
|
||||
import io.quarkus.panache.common.Sort;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
@@ -50,14 +49,14 @@ public class ReviewService {
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed(Role.Customer)
|
||||
@Transactional
|
||||
public Response receiveReview(SendReview input) {
|
||||
UUID reviewerId = UUID.fromString(request.getHeader(InternalValue.userId));
|
||||
String userId = request.getHeader(InternalValue.userId);
|
||||
|
||||
try {
|
||||
ReviewEntity entity = dtoMapper.toReviewEntity(input);
|
||||
entity.setReviewerId(reviewerId);
|
||||
|
||||
if (userId != null) entity.setReviewerId(UUID.fromString(userId));
|
||||
|
||||
entity.persist();
|
||||
|
||||
|
||||
@@ -116,10 +116,11 @@ public class ShiftService {
|
||||
|
||||
ShiftEntity shift = new ShiftEntity();
|
||||
shift.eatery = eatery;
|
||||
shift.name = input.name;
|
||||
shift.date = input.date;
|
||||
shift.startTime = input.startTime;
|
||||
shift.endTime = input.endTime;
|
||||
shift.maxStaff = input.maxStaff;
|
||||
shift.wage = input.wage;
|
||||
|
||||
if (shift.endTime.isBefore(shift.startTime)) {
|
||||
throw new GraphQLException("InvalidEndTime");
|
||||
@@ -145,7 +146,6 @@ public class ShiftService {
|
||||
!shift.eatery.ownerId.toString().equals(ownerId)
|
||||
) throw new GraphQLException("InvalidShiftId");
|
||||
|
||||
shift.name = input.name;
|
||||
shift.startTime = input.startTime;
|
||||
shift.endTime = input.endTime;
|
||||
shift.maxStaff = input.maxStaff;
|
||||
@@ -154,6 +154,8 @@ public class ShiftService {
|
||||
throw new GraphQLException("InvalidEndTime");
|
||||
}
|
||||
|
||||
shift.persist();
|
||||
|
||||
return shift;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,12 @@ quarkus.native.additional-build-args=--future-defaults=all
|
||||
|
||||
# Kafka
|
||||
%prod.mp.messaging.connector.smallrye-kafka.bootstrap.servers=${KAFKA_SERVICE_SERVICE_HOST:host.docker.internal}:9092
|
||||
mp.messaging.incoming.manager-in.connector=smallrye-in-memory
|
||||
|
||||
## Create restaurant topic
|
||||
mp.messaging.incoming.manager-in.connector=smallrye-kafka
|
||||
mp.messaging.incoming.manager-in.topic=create-restaurant
|
||||
mp.messaging.incoming.manager-in.auto.offset.reset=earliest
|
||||
quarkus.messaging.kafka.serializer-generation.enabled=true
|
||||
|
||||
# Rest Client
|
||||
quarkus.rest-client.account.url=http://account-service
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.util.UUID;
|
||||
import net.datafaker.Faker;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@QuarkusTest
|
||||
public class ReviewEntityTest {
|
||||
|
||||
private final Faker faker = new Faker();
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void testCreateReview() {
|
||||
UUID testReviewerId = UUID.randomUUID();
|
||||
UUID testEateryId = UUID.randomUUID();
|
||||
String comment = faker.famousLastWords().lastWords();
|
||||
int rating = faker.random().nextInt(1, 5);
|
||||
|
||||
ReviewEntity savedReview = new ReviewEntity(
|
||||
testReviewerId,
|
||||
testEateryId,
|
||||
rating,
|
||||
comment
|
||||
);
|
||||
|
||||
savedReview.persist();
|
||||
|
||||
// 3. Kiểm chứng (Assert)
|
||||
Assertions.assertNotNull(
|
||||
savedReview,
|
||||
"Thực thể Review sau khi tạo không được null"
|
||||
);
|
||||
Assertions.assertEquals(
|
||||
testReviewerId,
|
||||
savedReview.reviewerId,
|
||||
"Reviewer ID không khớp"
|
||||
);
|
||||
Assertions.assertEquals(
|
||||
testEateryId,
|
||||
savedReview.eateryId,
|
||||
"Eatery ID không khớp"
|
||||
);
|
||||
Assertions.assertEquals(rating, savedReview.rating, "Rating không khớp");
|
||||
Assertions.assertEquals(comment, savedReview.comment, "Comment không khớp");
|
||||
|
||||
Assertions.assertNotNull(
|
||||
savedReview.id,
|
||||
"ID phải được tự động sinh ra sau khi persist"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ import static org.hamcrest.Matchers.hasSize;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.dtos.AddMenuItem;
|
||||
import com.drinkool.dtos.event.ManagerCreate;
|
||||
import com.drinkool.entities.EateryEntity;
|
||||
import com.drinkool.entities.MenuItemEntity;
|
||||
import com.drinkool.lib.dtos.event.ManagerCreate;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.smallrye.reactive.messaging.memory.InMemoryConnector;
|
||||
@@ -88,6 +88,8 @@ public class EateryServiceTest {
|
||||
new AddMenuItem(
|
||||
faker.food().dish(),
|
||||
faker.number().randomDouble(2, 10, 100),
|
||||
true,
|
||||
"",
|
||||
""
|
||||
)
|
||||
).id;
|
||||
|
||||
@@ -7,10 +7,10 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.dtos.SendReview;
|
||||
import com.drinkool.entities.EateryEntity;
|
||||
import com.drinkool.entities.MenuItemEntity;
|
||||
import com.drinkool.entities.ReviewEntity;
|
||||
import com.drinkool.lib.dtos.SendReview;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.http.ContentType;
|
||||
import jakarta.transaction.Transactional;
|
||||
@@ -26,7 +26,7 @@ public class ReviewServiceTest {
|
||||
|
||||
private UUID savedEateryId;
|
||||
private String savedEateryName;
|
||||
private UUID savedOwnerId = UUID.randomUUID();
|
||||
private UUID savedOwnerId;
|
||||
|
||||
@BeforeEach
|
||||
@Transactional
|
||||
@@ -36,15 +36,17 @@ public class ReviewServiceTest {
|
||||
EateryEntity.deleteAll();
|
||||
|
||||
savedEateryName = faker.restaurant().name();
|
||||
savedOwnerId = UUID.randomUUID();
|
||||
|
||||
EateryEntity eatery = new EateryEntity();
|
||||
eatery = eatery.create(savedOwnerId, savedEateryName);
|
||||
|
||||
savedEateryId = eatery.id;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ReviewEntity entity = new ReviewEntity(
|
||||
UUID.randomUUID(),
|
||||
savedEateryId,
|
||||
eatery.id,
|
||||
faker.random().nextInt(1, 5),
|
||||
faker.famousLastWords().lastWords()
|
||||
);
|
||||
@@ -56,11 +58,15 @@ public class ReviewServiceTest {
|
||||
@Test
|
||||
void receiveReview_Success() {
|
||||
UUID reviewerId = UUID.randomUUID();
|
||||
UUID eateryId = UUID.randomUUID();
|
||||
String comment = faker.famousLastWords().lastWords();
|
||||
int rating = faker.random().nextInt(1, 5);
|
||||
|
||||
SendReview input = new SendReview(reviewerId, eateryId, rating, comment);
|
||||
SendReview input = new SendReview(
|
||||
reviewerId,
|
||||
savedEateryId,
|
||||
rating,
|
||||
comment
|
||||
);
|
||||
|
||||
given()
|
||||
.header(InternalValue.role, Role.Customer)
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.drinkool.entities.ShiftEntity;
|
||||
import com.drinkool.entities.ShiftRegistrationEntity;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -40,13 +41,12 @@ public class ShiftServiceTest {
|
||||
.header(InternalValue.role, Role.Manager)
|
||||
.header(InternalValue.userId, ownerId)
|
||||
.contentType("application/json")
|
||||
.body("{ \"query\": \"{ allShifts { name startTime } }\" }")
|
||||
.body("{ \"query\": \"{ allShifts { startTime } }\" }")
|
||||
.when()
|
||||
.post("/graphql")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("data.allShifts", hasSize(1))
|
||||
.body("data.allShifts[0].name", is("Ca Sáng"));
|
||||
.body("data.allShifts", hasSize(1));
|
||||
}
|
||||
|
||||
// --- TEST MUTATIONS ---
|
||||
@@ -54,18 +54,31 @@ public class ShiftServiceTest {
|
||||
@Test
|
||||
void testCreateShift_AsManager() {
|
||||
String query = """
|
||||
mutation Create($input: CreateShiftInput!)
|
||||
{ createShift(shiftInput: $input) { id name } }""";
|
||||
mutation createShift($shiftInput: CreateShiftInput!) {
|
||||
createShift(shiftInput: $shiftInput) {
|
||||
id
|
||||
date
|
||||
startTime
|
||||
endTime
|
||||
maxStaff
|
||||
wage
|
||||
registeredStaff {
|
||||
staffId
|
||||
}
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
Map<String, Object> input = new HashMap<>();
|
||||
input.put("name", "Ca Sáng");
|
||||
input.put("date", "26/04/2026");
|
||||
input.put("startTime", "08:00:00");
|
||||
input.put("endTime", "12:00:00");
|
||||
input.put("maxStaff", 5);
|
||||
input.put("wage", 1000000);
|
||||
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("query", query);
|
||||
body.put("variables", Map.of("input", input));
|
||||
body.put("variables", Map.of("shiftInput", input));
|
||||
|
||||
UUID ownerId = createMockOwner();
|
||||
createMockEatery(ownerId);
|
||||
@@ -78,8 +91,7 @@ public class ShiftServiceTest {
|
||||
.when()
|
||||
.post("/graphql")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("data.createShift.name", is("Ca Sáng"));
|
||||
.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -196,9 +208,10 @@ public class ShiftServiceTest {
|
||||
) {
|
||||
ShiftEntity shift = new ShiftEntity();
|
||||
shift.eatery = eatery;
|
||||
shift.name = name;
|
||||
shift.date = LocalDate.now();
|
||||
shift.startTime = LocalTime.parse(start);
|
||||
shift.endTime = LocalTime.parse(end);
|
||||
shift.wage = 10000;
|
||||
shift.maxStaff = 5;
|
||||
shift.persist();
|
||||
return shift;
|
||||
|
||||
+19
-3
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>push-python-image</id>
|
||||
<id>push</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>quarkus.container-image.push</name>
|
||||
@@ -84,9 +84,25 @@
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>docker-push-python-with-version</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<arguments>
|
||||
<argument>push</argument>
|
||||
<argument
|
||||
>${python.image.full.name}:${parent.version}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<id>docker-push-python</id>
|
||||
<phase>install</phase>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
|
||||
+13
-9
@@ -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.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
<compiler-plugin.version>3.15.0</compiler-plugin.version>
|
||||
<maven.compiler.release>25</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>
|
||||
@@ -130,7 +132,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>
|
||||
<forkCount>1</forkCount>
|
||||
@@ -154,7 +157,8 @@
|
||||
<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>
|
||||
<java.util.logging.manager
|
||||
>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.lib.dtos.GraphqlDto;
|
||||
import com.drinkool.dtos.GraphqlDto;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.services.CustomerService;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -39,4 +39,10 @@ public class CustomerController {
|
||||
public Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id) {
|
||||
return accountService.me(id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Uni<Response> findCustomer(@PathParam("id") UUID id) {
|
||||
return accountService.findCustomer(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.dtos.GraphqlDto;
|
||||
import com.drinkool.dtos.SendReview;
|
||||
import com.drinkool.enums.SortBy;
|
||||
import com.drinkool.lib.dtos.GraphqlDto;
|
||||
import com.drinkool.lib.dtos.SendReview;
|
||||
import com.drinkool.services.ReviewService;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.lib.dtos.GraphqlDto;
|
||||
import com.drinkool.dtos.GraphqlDto;
|
||||
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient;
|
||||
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClientBuilder;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -9,6 +9,9 @@ import jakarta.json.bind.Jsonb;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class GraphqlBase {
|
||||
|
||||
@@ -39,18 +42,25 @@ public abstract class GraphqlBase {
|
||||
gqlRequest.variables
|
||||
);
|
||||
|
||||
if (response.hasError()) {
|
||||
return Response.status(400)
|
||||
.entity(jsonb.toJson(response.getErrors()))
|
||||
.build();
|
||||
}
|
||||
Map<String, Object> gqlBody = new HashMap<>();
|
||||
|
||||
return Response.ok(jsonb.toJson(response.getData()))
|
||||
gqlBody.put("data", response.getData());
|
||||
gqlBody.put("errors", response.getErrors());
|
||||
return Response.ok(jsonb.toJson(gqlBody))
|
||||
.type(MediaType.APPLICATION_JSON)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Response.serverError().entity("Lỗi kết nối tới service").build();
|
||||
Map<String, Object> errorBody = new HashMap<>();
|
||||
errorBody.put(
|
||||
"errors",
|
||||
List.of(Map.of("message", "Lỗi kết nối tới service: " + e.getMessage()))
|
||||
);
|
||||
|
||||
return Response.serverError()
|
||||
.type(MediaType.APPLICATION_JSON)
|
||||
.entity(jsonb.toJson(errorBody))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.SmsOtp;
|
||||
import com.drinkool.dtos.SmsOtp;
|
||||
import com.drinkool.services.BaseService;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.Login;
|
||||
import com.drinkool.dtos.Login;
|
||||
import com.drinkool.services.CustomerService;
|
||||
import com.drinkool.services.ManagerService;
|
||||
import com.drinkool.services.StaffService;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.controller;
|
||||
|
||||
import com.drinkool.*;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import com.drinkool.services.ManagerService;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
@@ -3,13 +3,15 @@ package com.drinkool.controller;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.Signup;
|
||||
import com.drinkool.dtos.Signup;
|
||||
import com.drinkool.services.StaffService;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.UUID;
|
||||
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||
@@ -30,4 +32,10 @@ public class StaffController {
|
||||
) {
|
||||
return staffService.signup(input, userId, role);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Uni<Response> findStaff(@PathParam("id") UUID staffId) {
|
||||
return staffService.findStaff(staffId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.filters;
|
||||
|
||||
import com.drinkool.BaseHeaderAuthentication;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.lib.utils.BaseHeaderAuthentication;
|
||||
import io.quarkus.security.identity.IdentityProviderManager;
|
||||
import io.quarkus.security.identity.SecurityIdentity;
|
||||
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drinkool.services;
|
||||
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.SmsOtp;
|
||||
import com.drinkool.dtos.SmsOtp;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drinkool.services;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
@@ -32,4 +32,8 @@ public interface CustomerService {
|
||||
@GET
|
||||
@Path(Url.Me)
|
||||
Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id);
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Uni<Response> findCustomer(@PathParam("id") UUID id);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drinkool.services;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.drinkool.services;
|
||||
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.dtos.SendReview;
|
||||
import com.drinkool.enums.SortBy;
|
||||
import com.drinkool.lib.dtos.SendReview;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
import jakarta.ws.rs.GET;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drinkool.services;
|
||||
import com.drinkool.InternalValue;
|
||||
import com.drinkool.Role;
|
||||
import com.drinkool.Url;
|
||||
import com.drinkool.lib.dtos.*;
|
||||
import com.drinkool.dtos.*;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
@@ -28,4 +28,8 @@ public interface StaffService {
|
||||
@GET
|
||||
@Path(Url.Me)
|
||||
Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id);
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Uni<Response> findStaff(@PathParam("id") UUID staffId);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: account-pod
|
||||
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.26
|
||||
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.32
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: cart-pod
|
||||
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.26
|
||||
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.32
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: eatery-pod
|
||||
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.26
|
||||
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.32
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: file-pod
|
||||
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.26
|
||||
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.32
|
||||
imagePullPolicy: IfNotPresent
|
||||
volumeMounts:
|
||||
- name: file-volume
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: gateway-pod
|
||||
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.26
|
||||
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.32
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.26</version>
|
||||
<version>1.5.32</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package com.drinkool.lib.utils;
|
||||
package com.drinkool;
|
||||
|
||||
import com.drinkool.InternalValue;
|
||||
import io.quarkus.security.identity.IdentityProviderManager;
|
||||
import io.quarkus.security.identity.SecurityIdentity;
|
||||
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
|
||||
@@ -4,5 +4,5 @@ public class Role {
|
||||
|
||||
public static final String Customer = "customer";
|
||||
public static final String Manager = "manager";
|
||||
public static final String Staff = "Staff";
|
||||
public static final String Staff = "staff";
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class AddInventory {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class GraphqlDto {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class ManagerSignup extends Signup {
|
||||
|
||||
public String eateryName;
|
||||
|
||||
public String bankAccount;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class QuickLogin {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class QuickSignup {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import com.drinkool.interfaces.ReviewInterface;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos;
|
||||
package com.drinkool.dtos;
|
||||
|
||||
public class SmsOtp {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.dtos.event;
|
||||
package com.drinkool.dtos.event;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import java.util.UUID;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.drinkool.lib.entities;
|
||||
package com.drinkool.entities;
|
||||
|
||||
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
@@ -5,6 +5,10 @@ public interface MenuItemInterface {
|
||||
void setName(String x);
|
||||
Double getPrice();
|
||||
void setPrice(Double x);
|
||||
Boolean getAvailable();
|
||||
void setAvailable(Boolean x);
|
||||
String getImageUrl();
|
||||
void setImageUrl(String x);
|
||||
String getDescription();
|
||||
void setDescription(String x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user