Skip to content

Commit 4c8cc3d

Browse files
authored
fix: RA-43 fix getType for mapper, fix h2 start (#95)
1 parent 77e1033 commit 4c8cc3d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.env.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Use envfile plugin for IDEA
22
#https://plugins.jetbrains.com/plugin/7861-envfile
33

4-
API_SPRING_PROFILES_ACTIVE=devh2
4+
API_SPRING_PROFILES_ACTIVE=h2
55

66
NETWORK=devkit # devkit, mainnet, testnet, preprod
77
PROTOCOL_MAGIC=42

api/src/main/java/org/cardanofoundation/rosetta/api/block/mapper/BlockToBlockResponse.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.ArrayList;
44
import java.util.List;
5+
import java.util.Optional;
56

67
import lombok.AllArgsConstructor;
78

@@ -34,8 +35,9 @@ public class BlockToBlockResponse {
3435
*/
3536
public BlockResponse toDto(Block model) {
3637

37-
return modelMapper
38-
.createTypeMap(Block.class, BlockResponse.class)
38+
return Optional
39+
.ofNullable(modelMapper.getTypeMap(Block.class, BlockResponse.class))
40+
.orElseGet(() -> modelMapper.createTypeMap(Block.class, BlockResponse.class))
3941
.addMappings(mapper -> {
4042
mapper.<String>map(Block::getHash, (dest, v) -> currentId(dest).setHash(v));
4143
mapper.<Long>map(Block::getNumber, (dest, v) -> currentId(dest).setIndex(v));

api/src/main/resources/config/application-devh2.yaml renamed to api/src/main/resources/config/application-h2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spring:
2020
driver-class-name: org.h2.Driver
2121
username: ${DB_ADMIN_USER_NAME:rosetta_db_admin}
2222
password: ${DB_ADMIN_USER_SECRET:weakpwd#123_d}
23-
url: jdbc:h2:tcp://localhost:9090/mem:rosetta-java-preprod
23+
url: jdbc:h2:tcp://localhost:9090/mem:${DB_NAME:rosetta-java-preprod}
2424
jpa:
2525
properties:
2626
hibernate:

0 commit comments

Comments
 (0)