Skip to content

Commit 8db1160

Browse files
authored
Merge pull request microservices-patterns#97 from dartartem/development
Improved swagger documentation.
2 parents f9809a6 + 999fe3e commit 8db1160

File tree

25 files changed

+77
-68
lines changed

25 files changed

+77
-68
lines changed

ftgo-accounting-service/src/main/java/net/chrisrichardson/ftgo/accountingservice/main/AccountingServiceMain.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.eventuate.local.java.spring.javaclient.driver.EventuateDriverConfiguration;
44
import io.eventuate.tram.spring.commands.producer.TramCommandProducerConfiguration;
55
import io.eventuate.tram.spring.jdbckafka.TramJdbcKafkaConfiguration;
6+
import net.chrisrichardson.eventstore.examples.customersandorders.commonswagger.CommonSwaggerConfiguration;
67
import net.chrisrichardson.ftgo.accountingservice.messaging.AccountingMessagingConfiguration;
78
import net.chrisrichardson.ftgo.accountingservice.web.AccountingWebConfiguration;
89
import org.springframework.boot.SpringApplication;
@@ -15,7 +16,8 @@
1516
@Import({AccountingMessagingConfiguration.class, AccountingWebConfiguration.class,
1617
TramCommandProducerConfiguration.class,
1718
EventuateDriverConfiguration.class,
18-
TramJdbcKafkaConfiguration.class})
19+
TramJdbcKafkaConfiguration.class,
20+
CommonSwaggerConfiguration.class})
1921
public class AccountingServiceMain {
2022

2123
public static void main(String[] args) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies {
2+
compile project(":ftgo-common")
3+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package net.chrisrichardson.ftgo.deliveryservice.api.web;
22

33
public class ActionInfo {
4-
private String type;
4+
private DeliveryActionType type;
55

66
public ActionInfo() {
77
}
88

9-
public ActionInfo(String type) {
9+
public ActionInfo(DeliveryActionType type) {
1010
this.type = type;
1111
}
1212

13-
public String getType() {
13+
public DeliveryActionType getType() {
1414
return type;
1515
}
1616

17-
public void setType(String type) {
17+
public void setType(DeliveryActionType type) {
1818
this.type = type;
1919
}
2020
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package net.chrisrichardson.ftgo.deliveryservice.api.web;
2+
3+
public enum DeliveryActionType { PICKUP, DROPOFF
4+
}

ftgo-delivery-service-api/src/main/java/net/chrisrichardson/ftgo/deliveryservice/api/web/DeliveryInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
public class DeliveryInfo {
44

55
private long id;
6-
private String state;
6+
private DeliveryState state;
77

88
public DeliveryInfo() {
99
}
1010

11-
public DeliveryInfo(long id, String state) {
11+
public DeliveryInfo(long id, DeliveryState state) {
1212

1313
this.id = id;
1414
this.state = state;
@@ -22,11 +22,11 @@ public void setId(long id) {
2222
this.id = id;
2323
}
2424

25-
public String getState() {
25+
public DeliveryState getState() {
2626
return state;
2727
}
2828

29-
public void setState(String state) {
29+
public void setState(DeliveryState state) {
3030
this.state = state;
3131
}
3232
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.chrisrichardson.ftgo.deliveryservice.domain;
1+
package net.chrisrichardson.ftgo.deliveryservice.api.web;
22

33
public enum DeliveryState {
44
CANCELLED, SCHEDULED, PENDING

ftgo-delivery-service/src/main/java/net/chrisrichardson/ftgo/deliveryservice/domain/Action.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package net.chrisrichardson.ftgo.deliveryservice.domain;
22

3+
import net.chrisrichardson.ftgo.deliveryservice.api.web.DeliveryActionType;
34
import net.chrisrichardson.ftgo.common.Address;
45

56
import javax.persistence.Embeddable;
67
import javax.persistence.EnumType;
78
import javax.persistence.Enumerated;
8-
import javax.persistence.ManyToOne;
99
import java.time.LocalDateTime;
1010

1111
@Embeddable
1212
public class Action {
1313

1414
@Enumerated(EnumType.STRING)
15-
private ActionType type;
15+
private DeliveryActionType type;
1616
private Address address;
1717
private LocalDateTime time;
1818

@@ -21,7 +21,7 @@ public class Action {
2121
private Action() {
2222
}
2323

24-
public Action(ActionType type, long deliveryId, Address address, LocalDateTime time) {
24+
public Action(DeliveryActionType type, long deliveryId, Address address, LocalDateTime time) {
2525
this.type = type;
2626
this.deliveryId = deliveryId;
2727
this.address = address;
@@ -33,15 +33,15 @@ public boolean actionFor(long deliveryId) {
3333
}
3434

3535
public static Action makePickup(long deliveryId, Address pickupAddress, LocalDateTime pickupTime) {
36-
return new Action(ActionType.PICKUP, deliveryId, pickupAddress, pickupTime);
36+
return new Action(DeliveryActionType.PICKUP, deliveryId, pickupAddress, pickupTime);
3737
}
3838

3939
public static Action makeDropoff(long deliveryId, Address deliveryAddress, LocalDateTime deliveryTime) {
40-
return new Action(ActionType.DROPOFF, deliveryId, deliveryAddress, deliveryTime);
40+
return new Action(DeliveryActionType.DROPOFF, deliveryId, deliveryAddress, deliveryTime);
4141
}
4242

4343

44-
public ActionType getType() {
44+
public DeliveryActionType getType() {
4545
return type;
4646
}
4747

ftgo-delivery-service/src/main/java/net/chrisrichardson/ftgo/deliveryservice/domain/ActionType.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

ftgo-delivery-service/src/main/java/net/chrisrichardson/ftgo/deliveryservice/domain/Delivery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.chrisrichardson.ftgo.deliveryservice.domain;
22

33
import net.chrisrichardson.ftgo.common.Address;
4+
import net.chrisrichardson.ftgo.deliveryservice.api.web.DeliveryState;
45

56
import javax.persistence.*;
67
import java.time.LocalDateTime;

ftgo-delivery-service/src/main/java/net/chrisrichardson/ftgo/deliveryservice/domain/DeliveryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ private DeliveryStatus makeDeliveryStatus(Delivery delivery, Long assignedCourie
113113
}
114114

115115
private DeliveryInfo makeDeliveryInfo(Delivery delivery) {
116-
return new DeliveryInfo(delivery.getId(), delivery.getState().name());
116+
return new DeliveryInfo(delivery.getId(), delivery.getState());
117117
}
118118

119119
private ActionInfo makeActionInfo(Action action) {
120-
return new ActionInfo(action.getType().name());
120+
return new ActionInfo(action.getType());
121121
}
122122
}

0 commit comments

Comments
 (0)