Browse Source

second commit

placidenduwayo 2 years ago
parent
commit
a3f16ffd73

+ 6
- 0
.idea/inspectionProfiles/Project_Default.xml View File

1
+<component name="InspectionProjectProfileManager">
2
+  <profile version="1.0">
3
+    <option name="myName" value="Project Default" />
4
+    <inspection_tool class="UnusedProperty" enabled="false" level="WARNING" enabled_by_default="false" />
5
+  </profile>
6
+</component>

+ 0
- 1
micro-service-account/src/main/java/com/natan/bootcamp/cleanarchitecture/account/infrastructure/ports/input/restmplate/CustomerGetter.java View File

11
 
11
 
12
     public static CustomerDto getCustomerFromOutside(String customerId) {
12
     public static CustomerDto getCustomerFromOutside(String customerId) {
13
         RestTemplate restTemplate = new RestTemplateBuilder()
13
         RestTemplate restTemplate = new RestTemplateBuilder()
14
-              //  .basicAuthentication("user","user")
15
                 .build();
14
                 .build();
16
         CustomerDto customerDto = restTemplate.getForObject(
15
         CustomerDto customerDto = restTemplate.getForObject(
17
                 CUSTOMERURL+"/"+customerId, CustomerDto.class);
16
                 CUSTOMERURL+"/"+customerId, CustomerDto.class);

+ 2
- 2
micro-service-account/src/main/resources/application.properties View File

1
 #for local use:localhost. For docker use: replace localhost by mysql
1
 #for local use:localhost. For docker use: replace localhost by mysql
2
 spring.application.name=micro-service-account
2
 spring.application.name=micro-service-account
3
-spring.datasource.url = jdbc:mysql://${MYSQL_HOST:localhost}${MYSQL_PORT:3306}/my_db_test?createDatabaseIfNotExist=true
3
+spring.datasource.url = jdbc:mysql://mysql:3306/account_db?createDatabaseIfNotExist=true
4
 spring.datasource.username =root
4
 spring.datasource.username =root
5
 spring.datasource.password = root
5
 spring.datasource.password = root
6
 spring.jpa.show-sql = true
6
 spring.jpa.show-sql = true
8
 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
8
 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
9
 server.port=8086
9
 server.port=8086
10
 server.servlet.context-path=/path
10
 server.servlet.context-path=/path
11
-server.error.include-message=always
11
+server.error.include-message=always

+ 4
- 0
micro-service-customer/src/main/java/com/natan/bootcamp/cleanarchitecture/customer/domain/entity/Customer.java View File

1
 package com.natan.bootcamp.cleanarchitecture.customer.domain.entity;
1
 package com.natan.bootcamp.cleanarchitecture.customer.domain.entity;
2
 
2
 
3
+import javax.persistence.EnumType;
4
+import javax.persistence.Enumerated;
5
+
3
 public class Customer {
6
 public class Customer {
4
 
7
 
5
     private String id;
8
     private String id;
7
     private String firstname;
10
     private String firstname;
8
     private String creationDate;
11
     private String creationDate;
9
     private Risk risk;
12
     private Risk risk;
13
+    @Enumerated(EnumType.STRING)
10
     private Status status;
14
     private Status status;
11
 
15
 
12
     public Customer() {
16
     public Customer() {

+ 2
- 2
micro-service-customer/src/main/resources/application.properties View File

1
 #for local use:localhost. For docker use: replace localhost by mysql
1
 #for local use:localhost. For docker use: replace localhost by mysql
2
 spring.application.name=micro-service-customer
2
 spring.application.name=micro-service-customer
3
-spring.datasource.url = jdbc:mysql://${MYSQL_HOST:localhost}${MYSQL_PORT:3306}/my_db_test?createDatabaseIfNotExist=true
3
+spring.datasource.url = jdbc:mysql://mysql:3306/customer_db?createDatabaseIfNotExist=true
4
 spring.datasource.username =root
4
 spring.datasource.username =root
5
 spring.datasource.password = root
5
 spring.datasource.password = root
6
 spring.jpa.show-sql = true
6
 spring.jpa.show-sql = true
8
 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
8
 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
9
 server.port=8085
9
 server.port=8085
10
 server.servlet.context-path=/path
10
 server.servlet.context-path=/path
11
-server.error.include-message=always
11
+server.error.include-message=always

+ 2
- 3
micro-service-movement/src/main/java/com/natan/bootcamp/cleanarchitecture/movement/infrastructure/ports/output/service/MovementService.java View File

2
 
2
 
3
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.Movement;
3
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.Movement;
4
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.MvtSens;
4
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.MvtSens;
5
-import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.Risk;
6
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.Status;
5
 import com.natan.bootcamp.cleanarchitecture.movement.domain.entity.Status;
7
 import com.natan.bootcamp.cleanarchitecture.movement.domain.exceptions.MovementManagementException;
6
 import com.natan.bootcamp.cleanarchitecture.movement.domain.exceptions.MovementManagementException;
8
 import com.natan.bootcamp.cleanarchitecture.movement.domain.ports.output.IMovementOutputPort;
7
 import com.natan.bootcamp.cleanarchitecture.movement.domain.ports.output.IMovementOutputPort;
9
-import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.resttemplate.AccountGetter;
10
-import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.resttemplate.CustomerGetter;
11
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.dto.AccountDto;
8
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.dto.AccountDto;
12
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.dto.CustomerDto;
9
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.dto.CustomerDto;
10
+import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.resttemplate.AccountGetter;
11
+import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.input.resttemplate.CustomerGetter;
13
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.mapping.MovementModelMapping;
12
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.mapping.MovementModelMapping;
14
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.model.MovementModel;
13
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.model.MovementModel;
15
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.repository.IMovementCrudRepository;
14
 import com.natan.bootcamp.cleanarchitecture.movement.infrastructure.ports.output.repository.IMovementCrudRepository;

+ 1
- 1
micro-service-movement/src/main/java/com/natan/bootcamp/cleanarchitecture/movement/infrastructure/ports/output/service/RisksManagement.java View File

21
             balance -= coverageAmount + coverageAmount *0.03;
21
             balance -= coverageAmount + coverageAmount *0.03;
22
         }
22
         }
23
         if(mvtAmount > balance){
23
         if(mvtAmount > balance){
24
-            throw new MovementManagementException("error: balance <"+ balance+ ">not enough for the mvt");
24
+            throw new MovementManagementException("error: balance not enough for the mvt");
25
         }
25
         }
26
     }
26
     }
27
 }
27
 }

+ 1
- 1
micro-service-movement/src/main/resources/application.properties View File

1
 #for local use:localhost. For docker use: replace localhost by mysql
1
 #for local use:localhost. For docker use: replace localhost by mysql
2
 spring.application.name=micro-service-movement
2
 spring.application.name=micro-service-movement
3
-spring.datasource.url = jdbc:mysql://${MYSQL_HOST:localhost}${MYSQL_PORT:3306}/my_db_test?createDatabaseIfNotExist=true
3
+spring.datasource.url = jdbc:mysql://mysql:3306/mvt_db?createDatabaseIfNotExist=true
4
 spring.datasource.username =root
4
 spring.datasource.username =root
5
 spring.datasource.password = root
5
 spring.datasource.password = root
6
 spring.jpa.show-sql = true
6
 spring.jpa.show-sql = true

Powered by TurnKey Linux.