Skip to content

Commit 1fdae20

Browse files
committed
Improved swagger documentation.
1 parent 866cf5d commit 1fdae20

File tree

25 files changed

+74
-58
lines changed

25 files changed

+74
-58
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package net.chrisrichardson.ftgo.common;
2+
3+
public enum DeliveryActionType { PICKUP, DROPOFF
4+
}
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.common;
22

33
public enum DeliveryState {
44
CANCELLED, SCHEDULED, PENDING
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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
package net.chrisrichardson.ftgo.deliveryservice.api.web;
22

3+
import net.chrisrichardson.ftgo.common.DeliveryActionType;
4+
35
public class ActionInfo {
4-
private String type;
6+
private DeliveryActionType type;
57

68
public ActionInfo() {
79
}
810

9-
public ActionInfo(String type) {
11+
public ActionInfo(DeliveryActionType type) {
1012
this.type = type;
1113
}
1214

13-
public String getType() {
15+
public DeliveryActionType getType() {
1416
return type;
1517
}
1618

17-
public void setType(String type) {
19+
public void setType(DeliveryActionType type) {
1820
this.type = type;
1921
}
2022
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package net.chrisrichardson.ftgo.deliveryservice.api.web;
22

3+
import net.chrisrichardson.ftgo.common.DeliveryState;
4+
35
public class DeliveryInfo {
46

57
private long id;
6-
private String state;
8+
private DeliveryState state;
79

810
public DeliveryInfo() {
911
}
1012

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

1315
this.id = id;
1416
this.state = state;
@@ -22,11 +24,11 @@ public void setId(long id) {
2224
this.id = id;
2325
}
2426

25-
public String getState() {
27+
public DeliveryState getState() {
2628
return state;
2729
}
2830

29-
public void setState(String state) {
31+
public void setState(DeliveryState state) {
3032
this.state = state;
3133
}
3234
}

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.common.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.common.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)