Compare commits

...

5 Commits

Author SHA1 Message Date
gitea-actions 6ee14beb83 chore: release [ci skip] 2026-05-16 03:29:12 +00:00
TakahashiNguyen aa7bfed331 fix: final commit (#61)
Release package / release (push) Successful in 22m28s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #61
2026-05-15 14:22:35 +00:00
gitea-actions 8fad38fa6c chore: release [ci skip] 2026-05-14 04:22:55 +00:00
TakahashiNguyen c4dce6f670 fix: better shift handler (#58)
Release package / release (push) Successful in 19m19s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #58
2026-05-14 03:45:23 +00:00
gitea-actions eef3fb773b chore: release [ci skip] 2026-05-13 09:48:14 +00:00
72 changed files with 273 additions and 176 deletions
+21
View File
@@ -1,3 +1,24 @@
## [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) ## [1.5.29](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.28...v1.5.29) (2026-05-13)
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -29,7 +29,7 @@ public class ManagerEntity extends UserModel {
} }
@Transactional @Transactional
public void signup( public ManagerEntity signup(
String name, String name,
String phone, String phone,
String bankAccount, String bankAccount,
@@ -38,5 +38,7 @@ public class ManagerEntity extends UserModel {
this.bankAccount = bankAccount; this.bankAccount = bankAccount;
super.signup(name, phone, rawPassword); super.signup(name, phone, rawPassword);
return this;
} }
} }
@@ -13,6 +13,10 @@ import jakarta.transaction.Transactional;
@Table(name = Role.Staff) @Table(name = Role.Staff)
public class StaffEntity extends UserModel { public class StaffEntity extends UserModel {
public StaffEntity() {
super(Role.Staff);
}
@Transactional @Transactional
public void signup( public void signup(
String name, String name,
@@ -1,6 +1,6 @@
package com.drinkool.filters; package com.drinkool.filters;
import com.drinkool.lib.utils.BaseHeaderAuthentication; import com.drinkool.BaseHeaderAuthentication;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped @ApplicationScoped
@@ -1,6 +1,6 @@
package com.drinkool.models; package com.drinkool.models;
import com.drinkool.lib.entities.BaseEntity; import com.drinkool.entities.BaseEntity;
import com.drinkool.utils.PhoneValidator; import com.drinkool.utils.PhoneValidator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.password4j.Password; import com.password4j.Password;
@@ -2,9 +2,9 @@ package com.drinkool.services;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.SmsOtp;
import com.drinkool.entities.ManagerEntity; import com.drinkool.entities.ManagerEntity;
import com.drinkool.entities.StaffEntity; import com.drinkool.entities.StaffEntity;
import com.drinkool.lib.dtos.SmsOtp;
import com.drinkool.models.UserModel; import com.drinkool.models.UserModel;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
@@ -1,12 +1,13 @@
package com.drinkool.services; package com.drinkool.services;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.dtos.*;
import com.drinkool.entities.CustomerEntity; import com.drinkool.entities.CustomerEntity;
import com.drinkool.lib.dtos.*;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
import jakarta.ws.rs.core.*; import jakarta.ws.rs.core.*;
import java.util.UUID;
@Path(Role.Customer) @Path(Role.Customer)
public class CustomerService extends BaseService<CustomerEntity> { public class CustomerService extends BaseService<CustomerEntity> {
@@ -88,4 +89,10 @@ public class CustomerService extends BaseService<CustomerEntity> {
.entity(customer) .entity(customer)
.build(); .build();
} }
@GET
@Path("/{id}")
public Response findStaff(@PathParam("id") UUID staffId) {
return Response.ok(CustomerEntity.findById(staffId)).build();
}
} }
@@ -1,9 +1,9 @@
package com.drinkool.services; package com.drinkool.services;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.dtos.*;
import com.drinkool.dtos.event.ManagerCreate;
import com.drinkool.entities.ManagerEntity; import com.drinkool.entities.ManagerEntity;
import com.drinkool.lib.dtos.*;
import com.drinkool.lib.dtos.event.ManagerCreate;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
@@ -26,6 +26,10 @@ public class ManagerService extends BaseService<ManagerEntity> {
@Path(Url.Signup) @Path(Url.Signup)
@Transactional @Transactional
public Response signup(ManagerSignup input) { public Response signup(ManagerSignup input) {
if (ManagerEntity.count() > 0) return Response.status(
Response.Status.BAD_REQUEST
).build();
ManagerEntity newManager = new ManagerEntity(); ManagerEntity newManager = new ManagerEntity();
newManager.signup( newManager.signup(
@@ -3,16 +3,18 @@ package com.drinkool.services;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.Login;
import com.drinkool.dtos.Signup;
import com.drinkool.entities.ManagerEntity; import com.drinkool.entities.ManagerEntity;
import com.drinkool.entities.StaffEntity; import com.drinkool.entities.StaffEntity;
import com.drinkool.lib.dtos.Login;
import com.drinkool.lib.dtos.Signup;
import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerRequest;
import jakarta.annotation.security.RolesAllowed; import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.util.UUID; import java.util.UUID;
@@ -64,9 +66,16 @@ public class StaffService extends BaseService<StaffEntity> {
.build(); .build();
return Response.accepted() return Response.accepted()
.entity(staff)
.header(InternalValue.userId, staff.id.toString()) .header(InternalValue.userId, staff.id.toString())
.header(InternalValue.managerId, staff.serve.id.toString()) .header(InternalValue.managerId, staff.serve.id.toString())
.header(InternalValue.role, Role.Staff) .header(InternalValue.role, Role.Staff)
.build(); .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 static io.restassured.RestAssured.*;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@@ -4,7 +4,7 @@ import static io.restassured.RestAssured.*;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@@ -4,8 +4,8 @@ import static io.restassured.RestAssured.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.dtos.*;
import com.drinkool.entities.CustomerEntity; import com.drinkool.entities.CustomerEntity;
import com.drinkool.lib.dtos.*;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -4,15 +4,18 @@ import static io.restassured.RestAssured.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import com.drinkool.*; 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.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.kafka.*; import io.quarkus.test.kafka.*;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import io.smallrye.reactive.messaging.kafka.companion.ConsumerTask; import io.smallrye.reactive.messaging.kafka.companion.ConsumerTask;
import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion;
import jakarta.transaction.Transactional;
import java.time.Duration; import java.time.Duration;
import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@QuarkusTest @QuarkusTest
@@ -25,6 +28,12 @@ public class ManagerServiceTest {
@ConfigProperty(name = "mp.messaging.outgoing.manager-out.topic") @ConfigProperty(name = "mp.messaging.outgoing.manager-out.topic")
String topicName; String topicName;
@BeforeEach
@Transactional
void setup() {
ManagerEntity.deleteAll();
}
@Test @Test
void testSignupSuccessAndKafkaMessageSent() { void testSignupSuccessAndKafkaMessageSent() {
ManagerSignup input = new ManagerSignup(); ManagerSignup input = new ManagerSignup();
@@ -4,45 +4,45 @@ import static io.restassured.RestAssured.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.dtos.*;
import com.drinkool.entities.ManagerEntity;
import com.drinkool.entities.StaffEntity; import com.drinkool.entities.StaffEntity;
import com.drinkool.lib.dtos.*;
import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.kafka.*; import io.quarkus.test.kafka.*;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import jakarta.enterprise.context.control.ActivateRequestContext;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.util.concurrent.TimeUnit;
import net.datafaker.Faker; import net.datafaker.Faker;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@QuarkusTest @QuarkusTest
@QuarkusTestResource(KafkaCompanionResource.class) @QuarkusTestResource(KafkaCompanionResource.class)
public class StaffServiceTest { public class StaffServiceTest_ {
private final Faker faker = new Faker(); private final Faker faker = new Faker();
private String managerId; private static String managerId;
@BeforeEach @BeforeAll
void setup() { @Transactional
@ActivateRequestContext
static void setup() throws InterruptedException {
ManagerSignup input = new ManagerSignup(); ManagerSignup input = new ManagerSignup();
input.name = "Ho Van Quan"; input.name = "Ho Van Quan";
input.phone = Utils.generateRandomPhone(); input.phone = Utils.generateRandomPhone();
input.password = "strong_password"; input.password = "strong_password";
input.eateryName = "Quan Com Ngon"; input.eateryName = "Quan Com Ngon";
var response = given() managerId = (new ManagerEntity()).signup(
.contentType("application/json") input.name,
.body(input) input.phone,
.when() "",
.post(Role.Manager + Url.Signup) input.password
.then() ).id.toString();
.statusCode(201)
.header(InternalValue.userId, org.hamcrest.Matchers.notNullValue())
.header(InternalValue.role, Role.Manager)
.extract();
managerId = response.header(InternalValue.userId);
} }
@Test @Test
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -6,16 +6,15 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "eatery") @RegisterRestClient(configKey = "account")
@Path(Role.Manager) @Path(Role.Manager)
public interface ManagerController { public interface ManagerController {
@GET @GET
@Path(Role.Manager + "/{id}/payment-qr") @Path("/{id}/payment-qr")
public Response getManagerPaymentQr( public Response getManagerPaymentQr(
@PathParam("id") UUID id, @PathParam("id") String id,
@QueryParam("amount") Long amount, @QueryParam("amount") Long amount,
@QueryParam("cartId") String cartId @QueryParam("cartId") String cartId
); );
@@ -45,7 +45,7 @@ public class CartService {
@Inject @Inject
public CartService(RedisDataSource ds) { 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); this.valueCommands = ds.value(String.class);
} }
@@ -64,7 +64,7 @@ public class CartService {
String cartId = UUID.randomUUID().toString(); String cartId = UUID.randomUUID().toString();
String redisKey = "cart:" + cartId; String redisKey = "cart:" + cartId;
String ownerId = response.getEntity().toString(); String ownerId = response.readEntity(String.class);
hashCommands.hset( hashCommands.hset(
redisKey, redisKey,
@@ -100,7 +100,6 @@ public class CartService {
Map<String, String> data = hashCommands.hgetall(key); Map<String, String> data = hashCommands.hgetall(key);
Map<String, String> itemPrices = hashCommands.hgetall(priceKey); Map<String, String> itemPrices = hashCommands.hgetall(priceKey);
String managerId = hashCommands.hget(key, "_metadata_eateryManagerId");
if (data.isEmpty()) { if (data.isEmpty()) {
throw new GraphQLException("NotFoundCart"); throw new GraphQLException("NotFoundCart");
@@ -110,6 +109,7 @@ public class CartService {
cart.Id = cartId; cart.Id = cartId;
cart.eateryId = UUID.fromString(data.get("_metadata_eatery")); cart.eateryId = UUID.fromString(data.get("_metadata_eatery"));
String ownerStr = data.get("_metadata_owner"); String ownerStr = data.get("_metadata_owner");
String managerId = data.get("_metadata_eateryManagerId");
cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr); cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr);
cart.items = new ArrayList<>(); cart.items = new ArrayList<>();
@@ -136,7 +136,7 @@ public class CartService {
try { try {
Response response = managerController.getManagerPaymentQr( Response response = managerController.getManagerPaymentQr(
UUID.fromString(managerId), managerId,
total, total,
cartId.toString() cartId.toString()
); );
@@ -144,6 +144,8 @@ public class CartService {
cart.paymentQrUrl = response.readEntity(String.class); cart.paymentQrUrl = response.readEntity(String.class);
} catch (Exception e) { } catch (Exception e) {
cart.paymentQrUrl = ""; cart.paymentQrUrl = "";
System.out.println(e.getMessage());
} }
return cart; return cart;
@@ -186,4 +188,21 @@ public class CartService {
return getCart(cartId); 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());
}
} }
@@ -19,7 +19,6 @@ import io.smallrye.mutiny.helpers.test.UniAssertSubscriber;
import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerRequest;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.time.Duration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@@ -29,7 +28,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@QuarkusTest @QuarkusTest
public class CartServiceTest { public class CartServiceTest_ {
@Inject @Inject
CartService cartService; CartService cartService;
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -1,5 +1,6 @@
package com.drinkool.dtos; package com.drinkool.dtos;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.eclipse.microprofile.graphql.NonNull; import org.eclipse.microprofile.graphql.NonNull;
@@ -8,7 +9,7 @@ import org.eclipse.microprofile.graphql.NonNull;
public class CreateShift { public class CreateShift {
@NonNull @NonNull
public String name; public LocalDate date;
@NonNull @NonNull
public LocalTime startTime; public LocalTime startTime;
@@ -17,4 +18,7 @@ public class CreateShift {
public LocalTime endTime; public LocalTime endTime;
public Integer maxStaff; public Integer maxStaff;
@NonNull
public Integer wage;
} }
@@ -2,7 +2,6 @@ package com.drinkool.dtos;
import com.drinkool.entities.MenuItemEntity; import com.drinkool.entities.MenuItemEntity;
import com.drinkool.entities.ReviewEntity; import com.drinkool.entities.ReviewEntity;
import com.drinkool.lib.dtos.SendReview;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import org.mapstruct.BeanMapping; import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@@ -1,6 +1,5 @@
package com.drinkool.entities; package com.drinkool.entities;
import com.drinkool.lib.entities.BaseEntity;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
@@ -2,8 +2,12 @@ package com.drinkool.entities;
import com.drinkool.dtos.AddMenuItem; import com.drinkool.dtos.AddMenuItem;
import com.drinkool.interfaces.MenuItemInterface; import com.drinkool.interfaces.MenuItemInterface;
import com.drinkool.lib.entities.BaseEntity; import jakarta.persistence.Column;
import jakarta.persistence.*; 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 jakarta.transaction.Transactional;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -1,7 +1,6 @@
package com.drinkool.entities; package com.drinkool.entities;
import com.drinkool.interfaces.ReviewInterface; import com.drinkool.interfaces.ReviewInterface;
import com.drinkool.lib.entities.BaseEntity;
import jakarta.persistence.*; import jakarta.persistence.*;
import java.util.UUID; import java.util.UUID;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -17,6 +16,7 @@ import lombok.Setter;
@Table(name = "reviews") @Table(name = "reviews")
public class ReviewEntity extends BaseEntity implements ReviewInterface { public class ReviewEntity extends BaseEntity implements ReviewInterface {
@Column(nullable = true)
public UUID reviewerId; public UUID reviewerId;
public UUID eateryId; public UUID eateryId;
@@ -1,14 +1,17 @@
package com.drinkool.entities; package com.drinkool.entities;
import com.drinkool.lib.entities.BaseEntity; import jakarta.persistence.CascadeType;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.UUID; import java.util.ArrayList;
import java.util.List;
@Entity @Entity
@Table @Table
@@ -19,7 +22,7 @@ public class ShiftEntity extends BaseEntity {
public EateryEntity eatery; public EateryEntity eatery;
@Column(nullable = false) @Column(nullable = false)
public String name; public LocalDate date;
@Column(nullable = false) @Column(nullable = false)
public LocalTime startTime; public LocalTime startTime;
@@ -29,4 +32,14 @@ public class ShiftEntity extends BaseEntity {
@Column(nullable = true) @Column(nullable = true)
public Integer maxStaff; public Integer maxStaff;
@Column(nullable = false)
public Integer wage;
@OneToMany(
mappedBy = "shift",
cascade = CascadeType.ALL,
orphanRemoval = true
)
public List<ShiftRegistrationEntity> registeredStaff = new ArrayList<>();
} }
@@ -1,8 +1,9 @@
package com.drinkool.entities; package com.drinkool.entities;
import com.drinkool.lib.entities.BaseEntity;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import java.util.List; import java.util.List;
@@ -15,7 +16,8 @@ public class ShiftRegistrationEntity extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
public UUID staffId; public UUID staffId;
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "shiftId")
public ShiftEntity shift; public ShiftEntity shift;
public static long countByShift(UUID shiftId) { public static long countByShift(UUID shiftId) {
@@ -27,10 +29,11 @@ public class ShiftRegistrationEntity extends BaseEntity {
ShiftEntity registratingShift ShiftEntity registratingShift
) { ) {
return list( 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, staffId,
registratingShift.endTime, registratingShift.endTime,
registratingShift.startTime registratingShift.startTime,
registratingShift.date
); );
} }
} }
@@ -1,6 +1,6 @@
package com.drinkool.filters; package com.drinkool.filters;
import com.drinkool.lib.utils.BaseHeaderAuthentication; import com.drinkool.BaseHeaderAuthentication;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped @ApplicationScoped
@@ -5,9 +5,9 @@ import com.drinkool.Role;
import com.drinkool.dtos.AddMenuItem; import com.drinkool.dtos.AddMenuItem;
import com.drinkool.dtos.DtoMapper; import com.drinkool.dtos.DtoMapper;
import com.drinkool.dtos.UpdateMenuItem; import com.drinkool.dtos.UpdateMenuItem;
import com.drinkool.dtos.event.ManagerCreate;
import com.drinkool.entities.EateryEntity; import com.drinkool.entities.EateryEntity;
import com.drinkool.entities.MenuItemEntity; import com.drinkool.entities.MenuItemEntity;
import com.drinkool.lib.dtos.event.ManagerCreate;
import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerRequest;
import jakarta.annotation.security.RolesAllowed; import jakarta.annotation.security.RolesAllowed;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
@@ -4,12 +4,11 @@ import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.DtoMapper; import com.drinkool.dtos.DtoMapper;
import com.drinkool.dtos.SendReview;
import com.drinkool.entities.ReviewEntity; import com.drinkool.entities.ReviewEntity;
import com.drinkool.enums.SortBy; import com.drinkool.enums.SortBy;
import com.drinkool.lib.dtos.SendReview;
import io.quarkus.panache.common.Sort; import io.quarkus.panache.common.Sort;
import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerRequest;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.DefaultValue;
@@ -50,14 +49,14 @@ public class ReviewService {
} }
@POST @POST
@RolesAllowed(Role.Customer)
@Transactional @Transactional
public Response receiveReview(SendReview input) { public Response receiveReview(SendReview input) {
UUID reviewerId = UUID.fromString(request.getHeader(InternalValue.userId)); String userId = request.getHeader(InternalValue.userId);
try { try {
ReviewEntity entity = dtoMapper.toReviewEntity(input); ReviewEntity entity = dtoMapper.toReviewEntity(input);
entity.setReviewerId(reviewerId);
if (userId != null) entity.setReviewerId(UUID.fromString(userId));
entity.persist(); entity.persist();
@@ -116,10 +116,11 @@ public class ShiftService {
ShiftEntity shift = new ShiftEntity(); ShiftEntity shift = new ShiftEntity();
shift.eatery = eatery; shift.eatery = eatery;
shift.name = input.name; shift.date = input.date;
shift.startTime = input.startTime; shift.startTime = input.startTime;
shift.endTime = input.endTime; shift.endTime = input.endTime;
shift.maxStaff = input.maxStaff; shift.maxStaff = input.maxStaff;
shift.wage = input.wage;
if (shift.endTime.isBefore(shift.startTime)) { if (shift.endTime.isBefore(shift.startTime)) {
throw new GraphQLException("InvalidEndTime"); throw new GraphQLException("InvalidEndTime");
@@ -145,7 +146,6 @@ public class ShiftService {
!shift.eatery.ownerId.toString().equals(ownerId) !shift.eatery.ownerId.toString().equals(ownerId)
) throw new GraphQLException("InvalidShiftId"); ) throw new GraphQLException("InvalidShiftId");
shift.name = input.name;
shift.startTime = input.startTime; shift.startTime = input.startTime;
shift.endTime = input.endTime; shift.endTime = input.endTime;
shift.maxStaff = input.maxStaff; shift.maxStaff = input.maxStaff;
@@ -154,6 +154,8 @@ public class ShiftService {
throw new GraphQLException("InvalidEndTime"); throw new GraphQLException("InvalidEndTime");
} }
shift.persist();
return shift; return shift;
} }
@@ -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.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.dtos.AddMenuItem; import com.drinkool.dtos.AddMenuItem;
import com.drinkool.dtos.event.ManagerCreate;
import com.drinkool.entities.EateryEntity; import com.drinkool.entities.EateryEntity;
import com.drinkool.entities.MenuItemEntity; import com.drinkool.entities.MenuItemEntity;
import com.drinkool.lib.dtos.event.ManagerCreate;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import io.smallrye.reactive.messaging.memory.InMemoryConnector; import io.smallrye.reactive.messaging.memory.InMemoryConnector;
@@ -7,10 +7,10 @@ import static org.junit.jupiter.api.Assertions.*;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.SendReview;
import com.drinkool.entities.EateryEntity; import com.drinkool.entities.EateryEntity;
import com.drinkool.entities.MenuItemEntity; import com.drinkool.entities.MenuItemEntity;
import com.drinkool.entities.ReviewEntity; import com.drinkool.entities.ReviewEntity;
import com.drinkool.lib.dtos.SendReview;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
@@ -26,7 +26,7 @@ public class ReviewServiceTest {
private UUID savedEateryId; private UUID savedEateryId;
private String savedEateryName; private String savedEateryName;
private UUID savedOwnerId = UUID.randomUUID(); private UUID savedOwnerId;
@BeforeEach @BeforeEach
@Transactional @Transactional
@@ -36,15 +36,17 @@ public class ReviewServiceTest {
EateryEntity.deleteAll(); EateryEntity.deleteAll();
savedEateryName = faker.restaurant().name(); savedEateryName = faker.restaurant().name();
savedOwnerId = UUID.randomUUID();
EateryEntity eatery = new EateryEntity(); EateryEntity eatery = new EateryEntity();
eatery = eatery.create(savedOwnerId, savedEateryName); eatery = eatery.create(savedOwnerId, savedEateryName);
savedEateryId = eatery.id; savedEateryId = eatery.id;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
ReviewEntity entity = new ReviewEntity( ReviewEntity entity = new ReviewEntity(
UUID.randomUUID(), UUID.randomUUID(),
savedEateryId, eatery.id,
faker.random().nextInt(1, 5), faker.random().nextInt(1, 5),
faker.famousLastWords().lastWords() faker.famousLastWords().lastWords()
); );
@@ -56,11 +58,15 @@ public class ReviewServiceTest {
@Test @Test
void receiveReview_Success() { void receiveReview_Success() {
UUID reviewerId = UUID.randomUUID(); UUID reviewerId = UUID.randomUUID();
UUID eateryId = UUID.randomUUID();
String comment = faker.famousLastWords().lastWords(); String comment = faker.famousLastWords().lastWords();
int rating = faker.random().nextInt(1, 5); int rating = faker.random().nextInt(1, 5);
SendReview input = new SendReview(reviewerId, eateryId, rating, comment); SendReview input = new SendReview(
reviewerId,
savedEateryId,
rating,
comment
);
given() given()
.header(InternalValue.role, Role.Customer) .header(InternalValue.role, Role.Customer)
@@ -10,6 +10,7 @@ import com.drinkool.entities.ShiftEntity;
import com.drinkool.entities.ShiftRegistrationEntity; import com.drinkool.entities.ShiftRegistrationEntity;
import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTest;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -40,13 +41,12 @@ public class ShiftServiceTest {
.header(InternalValue.role, Role.Manager) .header(InternalValue.role, Role.Manager)
.header(InternalValue.userId, ownerId) .header(InternalValue.userId, ownerId)
.contentType("application/json") .contentType("application/json")
.body("{ \"query\": \"{ allShifts { name startTime } }\" }") .body("{ \"query\": \"{ allShifts { startTime } }\" }")
.when() .when()
.post("/graphql") .post("/graphql")
.then() .then()
.statusCode(200) .statusCode(200)
.body("data.allShifts", hasSize(1)) .body("data.allShifts", hasSize(1));
.body("data.allShifts[0].name", is("Ca Sáng"));
} }
// --- TEST MUTATIONS --- // --- TEST MUTATIONS ---
@@ -54,18 +54,31 @@ public class ShiftServiceTest {
@Test @Test
void testCreateShift_AsManager() { void testCreateShift_AsManager() {
String query = """ String query = """
mutation Create($input: CreateShiftInput!) mutation createShift($shiftInput: CreateShiftInput!) {
{ createShift(shiftInput: $input) { id name } }"""; createShift(shiftInput: $shiftInput) {
id
date
startTime
endTime
maxStaff
wage
registeredStaff {
staffId
}
}
}
""";
Map<String, Object> input = new HashMap<>(); 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("startTime", "08:00:00");
input.put("endTime", "12:00:00"); input.put("endTime", "12:00:00");
input.put("maxStaff", 5); input.put("maxStaff", 5);
input.put("wage", 1000000);
Map<String, Object> body = new HashMap<>(); Map<String, Object> body = new HashMap<>();
body.put("query", query); body.put("query", query);
body.put("variables", Map.of("input", input)); body.put("variables", Map.of("shiftInput", input));
UUID ownerId = createMockOwner(); UUID ownerId = createMockOwner();
createMockEatery(ownerId); createMockEatery(ownerId);
@@ -78,8 +91,7 @@ public class ShiftServiceTest {
.when() .when()
.post("/graphql") .post("/graphql")
.then() .then()
.statusCode(200) .statusCode(200);
.body("data.createShift.name", is("Ca Sáng"));
} }
@Test @Test
@@ -196,9 +208,10 @@ public class ShiftServiceTest {
) { ) {
ShiftEntity shift = new ShiftEntity(); ShiftEntity shift = new ShiftEntity();
shift.eatery = eatery; shift.eatery = eatery;
shift.name = name; shift.date = LocalDate.now();
shift.startTime = LocalTime.parse(start); shift.startTime = LocalTime.parse(start);
shift.endTime = LocalTime.parse(end); shift.endTime = LocalTime.parse(end);
shift.wage = 10000;
shift.maxStaff = 5; shift.maxStaff = 5;
shift.persist(); shift.persist();
return shift; return shift;
+17 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -84,6 +84,22 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<executions> <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> <execution>
<id>docker-push-python</id> <id>docker-push-python</id>
<phase>package</phase> <phase>package</phase>
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -1,6 +1,6 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.lib.dtos.GraphqlDto; import com.drinkool.dtos.GraphqlDto;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.Context;
@@ -1,7 +1,7 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import com.drinkool.services.CustomerService; import com.drinkool.services.CustomerService;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -39,4 +39,10 @@ public class CustomerController {
public Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id) { public Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id) {
return accountService.me(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.InternalValue;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.GraphqlDto;
import com.drinkool.dtos.SendReview;
import com.drinkool.enums.SortBy; import com.drinkool.enums.SortBy;
import com.drinkool.lib.dtos.GraphqlDto;
import com.drinkool.lib.dtos.SendReview;
import com.drinkool.services.ReviewService; import com.drinkool.services.ReviewService;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -1,7 +1,7 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.InternalValue; 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.DynamicGraphQLClient;
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClientBuilder; import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClientBuilder;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -1,7 +1,7 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.SmsOtp; import com.drinkool.dtos.SmsOtp;
import com.drinkool.services.BaseService; import com.drinkool.services.BaseService;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -1,7 +1,7 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.Login; import com.drinkool.dtos.Login;
import com.drinkool.services.CustomerService; import com.drinkool.services.CustomerService;
import com.drinkool.services.ManagerService; import com.drinkool.services.ManagerService;
import com.drinkool.services.StaffService; import com.drinkool.services.StaffService;
@@ -1,7 +1,7 @@
package com.drinkool.controller; package com.drinkool.controller;
import com.drinkool.*; import com.drinkool.*;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import com.drinkool.services.ManagerService; import com.drinkool.services.ManagerService;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@@ -3,13 +3,15 @@ package com.drinkool.controller;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.Signup; import com.drinkool.dtos.Signup;
import com.drinkool.services.StaffService; import com.drinkool.services.StaffService;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam; import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.util.UUID; import java.util.UUID;
import org.eclipse.microprofile.rest.client.inject.RestClient; import org.eclipse.microprofile.rest.client.inject.RestClient;
@@ -30,4 +32,10 @@ public class StaffController {
) { ) {
return staffService.signup(input, userId, role); 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; package com.drinkool.filters;
import com.drinkool.BaseHeaderAuthentication;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.lib.utils.BaseHeaderAuthentication;
import io.quarkus.security.identity.IdentityProviderManager; import io.quarkus.security.identity.IdentityProviderManager;
import io.quarkus.security.identity.SecurityIdentity; import io.quarkus.security.identity.SecurityIdentity;
import io.quarkus.security.runtime.QuarkusSecurityIdentity; import io.quarkus.security.runtime.QuarkusSecurityIdentity;
@@ -1,7 +1,7 @@
package com.drinkool.services; package com.drinkool.services;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.SmsOtp; import com.drinkool.dtos.SmsOtp;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
@@ -3,7 +3,7 @@ package com.drinkool.services;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
@@ -32,4 +32,8 @@ public interface CustomerService {
@GET @GET
@Path(Url.Me) @Path(Url.Me)
Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id); 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.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
@@ -2,8 +2,8 @@ package com.drinkool.services;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.dtos.SendReview;
import com.drinkool.enums.SortBy; import com.drinkool.enums.SortBy;
import com.drinkool.lib.dtos.SendReview;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
@@ -3,7 +3,7 @@ package com.drinkool.services;
import com.drinkool.InternalValue; import com.drinkool.InternalValue;
import com.drinkool.Role; import com.drinkool.Role;
import com.drinkool.Url; import com.drinkool.Url;
import com.drinkool.lib.dtos.*; import com.drinkool.dtos.*;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*; import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
@@ -28,4 +28,8 @@ public interface StaffService {
@GET @GET
@Path(Url.Me) @Path(Url.Me)
Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id); Uni<Response> me(@HeaderParam(InternalValue.userId) UUID id);
@GET
@Path("/{id}")
public Uni<Response> findStaff(@PathParam("id") UUID staffId);
} }
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: account-pod - name: account-pod
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.29 image: git.demonkernel.io.vn/foodsurf/account-service:1.5.32
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: cart-pod - name: cart-pod
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.29 image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.32
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: eatery-pod - name: eatery-pod
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.29 image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.32
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: file-pod - name: file-pod
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.29 image: git.demonkernel.io.vn/foodsurf/file-service:1.5.32
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
volumeMounts: volumeMounts:
- name: file-volume - name: file-volume
+1 -1
View File
@@ -14,7 +14,7 @@ spec:
spec: spec:
containers: containers:
- name: gateway-pod - name: gateway-pod
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.29 image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.32
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
+1 -1
View File
@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -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.IdentityProviderManager;
import io.quarkus.security.identity.SecurityIdentity; import io.quarkus.security.identity.SecurityIdentity;
import io.quarkus.security.runtime.QuarkusSecurityIdentity; import io.quarkus.security.runtime.QuarkusSecurityIdentity;
+1 -1
View File
@@ -4,5 +4,5 @@ public class Role {
public static final String Customer = "customer"; public static final String Customer = "customer";
public static final String Manager = "manager"; public static final String Manager = "manager";
public static final String Staff = "Staff"; public static final String Staff = "staff";
} }
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class AddInventory { public class AddInventory {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
import java.util.UUID; import java.util.UUID;
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class GraphqlDto { public class GraphqlDto {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class ManagerSignup extends Signup { public class ManagerSignup extends Signup {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class QuickLogin { public class QuickLogin {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class QuickSignup { public class QuickSignup {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
import com.drinkool.interfaces.ReviewInterface; import com.drinkool.interfaces.ReviewInterface;
import io.quarkus.runtime.annotations.RegisterForReflection; import io.quarkus.runtime.annotations.RegisterForReflection;
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos; package com.drinkool.dtos;
public class SmsOtp { public class SmsOtp {
@@ -1,4 +1,4 @@
package com.drinkool.lib.dtos.event; package com.drinkool.dtos.event;
import io.quarkus.runtime.annotations.RegisterForReflection; import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.UUID; import java.util.UUID;
@@ -1,4 +1,4 @@
package com.drinkool.lib.entities; package com.drinkool.entities;
import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
+1 -1
View File
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.drinkool</groupId> <groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId> <artifactId>drinkool</artifactId>
<version>1.5.29</version> <version>1.5.32</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<maven.compiler.source>25</maven.compiler.source> <maven.compiler.source>25</maven.compiler.source>