chore: update
This commit is contained in:
@@ -3,6 +3,7 @@ package com.drinkool.entities;
|
|||||||
import com.drinkool.Role;
|
import com.drinkool.Role;
|
||||||
import com.drinkool.models.UserModel;
|
import com.drinkool.models.UserModel;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,7 +18,22 @@ public class ManagerEntity extends UserModel {
|
|||||||
)
|
)
|
||||||
public List<StaffEntity> staffs = new ArrayList<>();
|
public List<StaffEntity> staffs = new ArrayList<>();
|
||||||
|
|
||||||
|
@Column(nullable = true)
|
||||||
|
String bankAccount;
|
||||||
|
|
||||||
public ManagerEntity() {
|
public ManagerEntity() {
|
||||||
super(Role.Manager);
|
super(Role.Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void signup(
|
||||||
|
String name,
|
||||||
|
String phone,
|
||||||
|
String bankAccount,
|
||||||
|
String rawPassword
|
||||||
|
) {
|
||||||
|
this.bankAccount = bankAccount;
|
||||||
|
|
||||||
|
super.signup(name, phone, rawPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ManagerService extends BaseService<ManagerEntity> {
|
|||||||
public Response signup(ManagerSignup input) {
|
public Response signup(ManagerSignup input) {
|
||||||
ManagerEntity newManager = new ManagerEntity();
|
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();
|
ManagerCreate message = new ManagerCreate();
|
||||||
message.id = newManager.id;
|
message.id = newManager.id;
|
||||||
|
|||||||
@@ -129,6 +129,10 @@
|
|||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-rest-jackson</artifactId>
|
<artifactId>quarkus-rest-jackson</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest-client-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-container-image-docker</artifactId>
|
<artifactId>quarkus-container-image-docker</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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.core.Response;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||||
|
|
||||||
|
@RegisterRestClient(configKey = "account")
|
||||||
|
@Path(Role.Manager)
|
||||||
|
public interface AccountController {
|
||||||
|
@GET
|
||||||
|
@Path("/{id}")
|
||||||
|
public Response getManagerById(@PathParam("id") UUID id);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.drinkool.services;
|
|||||||
|
|
||||||
import com.drinkool.InternalValue;
|
import com.drinkool.InternalValue;
|
||||||
import com.drinkool.Role;
|
import com.drinkool.Role;
|
||||||
|
import com.drinkool.controllers.AccountController;
|
||||||
import com.drinkool.dtos.AddMenuItem;
|
import com.drinkool.dtos.AddMenuItem;
|
||||||
import com.drinkool.dtos.DtoMapper;
|
import com.drinkool.dtos.DtoMapper;
|
||||||
import com.drinkool.dtos.OrderBill;
|
import com.drinkool.dtos.OrderBill;
|
||||||
@@ -22,12 +23,14 @@ import jakarta.ws.rs.PathParam;
|
|||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.eclipse.microprofile.graphql.GraphQLApi;
|
import org.eclipse.microprofile.graphql.GraphQLApi;
|
||||||
import org.eclipse.microprofile.graphql.Mutation;
|
import org.eclipse.microprofile.graphql.Mutation;
|
||||||
import org.eclipse.microprofile.graphql.Name;
|
import org.eclipse.microprofile.graphql.Name;
|
||||||
import org.eclipse.microprofile.graphql.Query;
|
import org.eclipse.microprofile.graphql.Query;
|
||||||
import org.eclipse.microprofile.reactive.messaging.Incoming;
|
import org.eclipse.microprofile.reactive.messaging.Incoming;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@GraphQLApi
|
@GraphQLApi
|
||||||
@@ -40,6 +43,10 @@ public class EateryService {
|
|||||||
@Inject
|
@Inject
|
||||||
HttpServerRequest request;
|
HttpServerRequest request;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@RestClient
|
||||||
|
AccountController accountController;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
public Response checkEateryExists(@PathParam("id") UUID id) {
|
public Response checkEateryExists(@PathParam("id") UUID id) {
|
||||||
@@ -187,6 +194,17 @@ public class EateryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.ok(new OrderBill(details, grandTotal, "")).build();
|
EateryEntity eatery = EateryEntity.findById(eateryId);
|
||||||
|
|
||||||
|
try (Response response = accountController.getManagerById(eatery.ownerId)) {
|
||||||
|
if (response.getStatus() == 200) {
|
||||||
|
Map<String, Object> data = response.readEntity(Map.class);
|
||||||
|
String bankNo = (String) data.get("bankAccount");
|
||||||
|
|
||||||
|
return Response.ok(new OrderBill(details, grandTotal, bankNo)).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response.serverError().entity(response.getEntity()).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ quarkus.native.additional-build-args=--future-defaults=all
|
|||||||
|
|
||||||
# Kafka
|
# Kafka
|
||||||
%prod.mp.messaging.connector.smallrye-kafka.bootstrap.servers=${KAFKA_SERVICE_SERVICE_HOST:host.docker.internal}:9092
|
%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
|
## Create restaurant topic
|
||||||
mp.messaging.incoming.manager-in.connector=smallrye-kafka
|
mp.messaging.incoming.manager-in.connector=smallrye-kafka
|
||||||
mp.messaging.incoming.manager-in.topic=create-restaurant
|
mp.messaging.incoming.manager-in.topic=create-restaurant
|
||||||
mp.messaging.incoming.manager-in.auto.offset.reset=earliest
|
mp.messaging.incoming.manager-in.auto.offset.reset=earliest
|
||||||
quarkus.messaging.kafka.serializer-generation.enabled=true
|
quarkus.messaging.kafka.serializer-generation.enabled=true
|
||||||
|
|
||||||
|
# Rest Client
|
||||||
|
quarkus.rest-client.account.url=http://account-service
|
||||||
|
|||||||
Reference in New Issue
Block a user