File tree Expand file tree Collapse file tree 4 files changed +4
-52
lines changed
src/main/java/com/ivanfranchin/bitcoinapi Expand file tree Collapse file tree 4 files changed +4
-52
lines changed Original file line number Diff line number Diff line change 14
14
<description >Demo project for Spring Boot</description >
15
15
16
16
<properties >
17
- <org .mapstruct.version>1.5.3.Final</org .mapstruct.version>
18
- <lombok-mapstruct-binding .version>0.2.0</lombok-mapstruct-binding .version>
19
17
<springdoc-openapi .version>2.0.4</springdoc-openapi .version>
20
18
</properties >
21
19
57
55
<artifactId >spring-kafka</artifactId >
58
56
</dependency >
59
57
60
- <!-- MapStruct -->
61
- <dependency >
62
- <groupId >org.mapstruct</groupId >
63
- <artifactId >mapstruct</artifactId >
64
- <version >${org.mapstruct.version} </version >
65
- </dependency >
66
-
67
58
<!-- SpringDoc OpenApi -->
68
59
<dependency >
69
60
<groupId >org.springdoc</groupId >
112
103
</excludes >
113
104
</configuration >
114
105
</plugin >
115
- <plugin >
116
- <groupId >org.apache.maven.plugins</groupId >
117
- <artifactId >maven-compiler-plugin</artifactId >
118
- <configuration >
119
- <annotationProcessorPaths >
120
- <path >
121
- <groupId >org.projectlombok</groupId >
122
- <artifactId >lombok</artifactId >
123
- <version >${lombok.version} </version >
124
- </path >
125
- <path >
126
- <groupId >org.projectlombok</groupId >
127
- <artifactId >lombok-mapstruct-binding</artifactId >
128
- <version >${lombok-mapstruct-binding.version} </version >
129
- </path >
130
- <path >
131
- <groupId >org.mapstruct</groupId >
132
- <artifactId >mapstruct-processor</artifactId >
133
- <version >${org.mapstruct.version} </version >
134
- </path >
135
- </annotationProcessorPaths >
136
- </configuration >
137
- </plugin >
138
106
</plugins >
139
107
</build >
140
108
Original file line number Diff line number Diff line change 1
1
package com .ivanfranchin .bitcoinapi .kafka ;
2
2
3
3
import com .ivanfranchin .bitcoinapi .model .Price ;
4
- import com .ivanfranchin .bitcoinapi .mapper .PriceMapper ;
5
4
import lombok .RequiredArgsConstructor ;
6
5
import lombok .extern .slf4j .Slf4j ;
7
6
import org .springframework .cloud .stream .function .StreamBridge ;
12
11
@ Component
13
12
public class PriceStreamer {
14
13
15
- private final PriceMapper priceMapper ;
16
14
private final StreamBridge streamBridge ;
17
15
18
16
public void send (Price price ) {
19
- PriceMessage priceMessage = priceMapper . toPriceMessage ( price );
17
+ PriceMessage priceMessage = new PriceMessage ( price . getId (), price . getValue (), price . getTimestamp () );
20
18
streamBridge .send ("prices-out-0" , priceMessage );
21
19
log .info ("{} sent to bus." , priceMessage );
22
20
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
package com .ivanfranchin .bitcoinapi .rest ;
2
2
3
- import com .ivanfranchin .bitcoinapi .mapper . PriceMapper ;
3
+ import com .ivanfranchin .bitcoinapi .model . Price ;
4
4
import com .ivanfranchin .bitcoinapi .rest .dto .PriceResponse ;
5
5
import com .ivanfranchin .bitcoinapi .service .PriceService ;
6
6
import io .swagger .v3 .oas .annotations .Operation ;
15
15
public class PriceController {
16
16
17
17
private final PriceService priceService ;
18
- private final PriceMapper priceMapper ;
19
18
20
19
@ Operation (summary = "Get last price" )
21
20
@ GetMapping ("/last" )
22
21
public PriceResponse getLastPrice () {
23
- return priceMapper .toPriceResponse (priceService .getLastPrice ());
22
+ Price price = priceService .getLastPrice ();
23
+ return new PriceResponse (price .getValue (), price .getTimestamp ());
24
24
}
25
25
}
You can’t perform that action at this time.
0 commit comments