Compare commits

...

2 Commits

Author SHA1 Message Date
TakahashiNg 617257b601 chore: update
Java CI with Maven / test (pull_request) Has been cancelled
Java CI with Maven / build (pull_request) Has been cancelled
2026-05-15 13:04:27 +00:00
TakahashiNg a1637c4889 chore: update 2026-05-15 11:43:25 +00:00
3 changed files with 14 additions and 9 deletions
@@ -1,9 +1,9 @@
package com.drinkool.services;
import com.drinkool.*;
import com.drinkool.entities.ManagerEntity;
import com.drinkool.dtos.*;
import com.drinkool.dtos.event.ManagerCreate;
import com.drinkool.entities.ManagerEntity;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.*;
@@ -26,6 +26,10 @@ 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(
@@ -6,16 +6,15 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "eatery")
@RegisterRestClient(configKey = "account")
@Path(Role.Manager)
public interface ManagerController {
@GET
@Path(Role.Manager + "/{id}/payment-qr")
@Path("/{id}/payment-qr")
public Response getManagerPaymentQr(
@PathParam("id") UUID id,
@PathParam("id") String id,
@QueryParam("amount") Long amount,
@QueryParam("cartId") String cartId
);
@@ -45,7 +45,7 @@ public class CartService {
@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);
}
@@ -64,7 +64,7 @@ public class CartService {
String cartId = UUID.randomUUID().toString();
String redisKey = "cart:" + cartId;
String ownerId = response.getEntity().toString();
String ownerId = response.readEntity(String.class);
hashCommands.hset(
redisKey,
@@ -100,7 +100,6 @@ public class CartService {
Map<String, String> data = hashCommands.hgetall(key);
Map<String, String> itemPrices = hashCommands.hgetall(priceKey);
String managerId = hashCommands.hget(key, "_metadata_eateryManagerId");
if (data.isEmpty()) {
throw new GraphQLException("NotFoundCart");
@@ -110,6 +109,7 @@ public class CartService {
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<>();
@@ -136,7 +136,7 @@ public class CartService {
try {
Response response = managerController.getManagerPaymentQr(
UUID.fromString(managerId),
managerId,
total,
cartId.toString()
);
@@ -144,6 +144,8 @@ public class CartService {
cart.paymentQrUrl = response.readEntity(String.class);
} catch (Exception e) {
cart.paymentQrUrl = "";
System.out.println(e.getMessage());
}
return cart;