Skip to content

Commit

Permalink
Sync Done
Browse files Browse the repository at this point in the history
  • Loading branch information
haroun08 committed Dec 28, 2024
1 parent eecddfc commit 2cc8095
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion order/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ public ResponseEntity<?> processPaymentAndInitiateDelivery(
}*/

@GetMapping("/addresses")
public ResponseEntity<List<AddressDTO>> GetAddresses(){
List<AddressDTO> addresses = deliveryService.getUserAddresses();
public ResponseEntity<List<Address>> GetAddresses(){
List<Address> addresses = deliveryService.getUserAddresses();
return ResponseEntity.ok(addresses);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Getter
@Setter
@NoArgsConstructor
public class AddressDTO {
public class Address {

private UUID addressId;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,11 +25,11 @@ public DeliveryService(WebClient.Builder webClientBuilder) {
*
* @return List of AddressDTO
*/
public List<AddressDTO> getUserAddresses() {
public List<Address> getUserAddresses() {
return webClient.get()
.uri(shippingServiceUrl)
.retrieve()
.bodyToFlux(AddressDTO.class)
.bodyToFlux(Address.class)
.collectList()
.block();
}
Expand Down
2 changes: 1 addition & 1 deletion order/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions order/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion shipping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>17</source><target>17</target></configuration></plugin>
</plugins>
</build>

Expand Down
4 changes: 3 additions & 1 deletion shipping/src/main/java/org/shipping/model/Shipment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions shipping/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2cc8095

Please sign in to comment.