diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index b6c1c2a5..2d8f96bf 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,7 +1,7 @@ - + postgresql true true diff --git a/order/docker-compose.yml b/order/docker-compose.yml index 70cf2c6f..9b2a400c 100644 --- a/order/docker-compose.yml +++ b/order/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: db_order environment: POSTGRES_USER: postgres - POSTGRES_PASSWORD: fadizoe1212 + POSTGRES_PASSWORD: SQL_2023test POSTGRES_DB: db_order PGDATA: /var/lib/postgresql/data ports: diff --git a/order/src/main/java/com/microservices/order_service/controller/OrderController.java b/order/src/main/java/com/microservices/order_service/controller/OrderController.java index 3038a6b3..2fc68d74 100644 --- a/order/src/main/java/com/microservices/order_service/controller/OrderController.java +++ b/order/src/main/java/com/microservices/order_service/controller/OrderController.java @@ -187,8 +187,8 @@ public ResponseEntity processPaymentAndInitiateDelivery( }*/ @GetMapping("/addresses") - public ResponseEntity> GetAddresses(){ - List addresses = deliveryService.getUserAddresses(); + public ResponseEntity> GetAddresses(){ + List
addresses = deliveryService.getUserAddresses(); return ResponseEntity.ok(addresses); } diff --git a/order/src/main/java/com/microservices/order_service/dto/AddressDTO.java b/order/src/main/java/com/microservices/order_service/dto/Address.java similarity index 95% rename from order/src/main/java/com/microservices/order_service/dto/AddressDTO.java rename to order/src/main/java/com/microservices/order_service/dto/Address.java index d07cdd17..47dad702 100644 --- a/order/src/main/java/com/microservices/order_service/dto/AddressDTO.java +++ b/order/src/main/java/com/microservices/order_service/dto/Address.java @@ -14,7 +14,7 @@ @Getter @Setter @NoArgsConstructor -public class AddressDTO { +public class Address { private UUID addressId; diff --git a/order/src/main/java/com/microservices/order_service/service/DeliveryService.java b/order/src/main/java/com/microservices/order_service/service/DeliveryService.java index de32ad82..819476eb 100644 --- a/order/src/main/java/com/microservices/order_service/service/DeliveryService.java +++ b/order/src/main/java/com/microservices/order_service/service/DeliveryService.java @@ -1,7 +1,7 @@ package com.microservices.order_service.service; -import com.microservices.order_service.dto.AddressDTO; -import com.microservices.order_service.dto.OrderDeliveryDTO; + +import com.microservices.order_service.dto.Address; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; @@ -25,11 +25,11 @@ public DeliveryService(WebClient.Builder webClientBuilder) { * * @return List of AddressDTO */ - public List getUserAddresses() { + public List
getUserAddresses() { return webClient.get() .uri(shippingServiceUrl) .retrieve() - .bodyToFlux(AddressDTO.class) + .bodyToFlux(Address.class) .collectList() .block(); } diff --git a/order/src/main/resources/application-dev.yml b/order/src/main/resources/application-dev.yml index 52a598d4..f8b76b8b 100644 --- a/order/src/main/resources/application-dev.yml +++ b/order/src/main/resources/application-dev.yml @@ -5,7 +5,7 @@ spring: url: jdbc:postgresql://localhost:5432/db_order username: postgres - password: azerty + password: SQL_2023test driver-class-name: org.postgresql.Driver jpa: hibernate: diff --git a/order/src/main/resources/application.properties b/order/src/main/resources/application.properties index 1e99094b..92799c51 100644 --- a/order/src/main/resources/application.properties +++ b/order/src/main/resources/application.properties @@ -9,8 +9,8 @@ spring.kafka.consumer.value-deserializer=com.microservices.order_service.deseria spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer spring.kafka.consumer.properties.spring.json.trusted.packages=* -delivery.service.url=http://localhost:8090 +delivery.service.url=http://localhost:8090/addresses shipping.service.url=http://localhost:8090/api/shipping -spring.kafka.topic.order-paid=** -spring.kafka.consumer.group-id=** +spring.kafka.topic.order-paid=order-paid +spring.kafka.consumer.group-id=groupId diff --git a/shipping/pom.xml b/shipping/pom.xml index ae90544c..5e76ef51 100755 --- a/shipping/pom.xml +++ b/shipping/pom.xml @@ -142,7 +142,7 @@ ${maven.home} - + org.apache.maven.pluginsmaven-compiler-plugin1717 diff --git a/shipping/src/main/java/org/shipping/model/Shipment.java b/shipping/src/main/java/org/shipping/model/Shipment.java index bb398994..f1b32acf 100755 --- a/shipping/src/main/java/org/shipping/model/Shipment.java +++ b/shipping/src/main/java/org/shipping/model/Shipment.java @@ -32,10 +32,12 @@ public class Shipment { private LocalDateTime deliveryDate; @ManyToOne - @JoinColumn(name = "addressId", referencedColumnName = "id") + @JoinColumn(name = "addressId", referencedColumnName = "addressId") private Address address; + @ManyToOne + @JoinColumn(name = "delivery_address_address_id") private Address deliveryAddress; // Ajouter addressId en tant que UUID pour utiliser explicitement la colonne diff --git a/shipping/src/main/resources/application.properties b/shipping/src/main/resources/application.properties index 0268094c..063511ae 100755 --- a/shipping/src/main/resources/application.properties +++ b/shipping/src/main/resources/application.properties @@ -5,8 +5,8 @@ quarkus.http.cors.origins=* quarkus.datasource.db-kind=postgresql quarkus.datasource.username=postgres -quarkus.datasource.password=azerty -quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5442/db_shipping +quarkus.datasource.password=SQL_2023test +quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/order_service # drop and create the database at startup (use `update` to only update the schema) quarkus.hibernate-orm.database.generation=create