fixed fields names
added swagger definition for new endpoints
This commit is contained in:
@@ -9,12 +9,12 @@ public class Address {
|
|||||||
private String street2;
|
private String street2;
|
||||||
private String city;
|
private String city;
|
||||||
private String state;
|
private String state;
|
||||||
private int zipCode;
|
private String zipCode;
|
||||||
|
|
||||||
public Address() {
|
public Address() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address(String street1, String street2, String city, String state, int zipCode) {
|
public Address(String street1, String street2, String city, String state, String zipCode) {
|
||||||
this.street1 = street1;
|
this.street1 = street1;
|
||||||
this.street2 = street2;
|
this.street2 = street2;
|
||||||
this.city = city;
|
this.city = city;
|
||||||
@@ -54,11 +54,11 @@ public class Address {
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZipCode() {
|
public String getZipCode() {
|
||||||
return zipCode;
|
return zipCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZipCode(int zipCode) {
|
public void setZipCode(String zipCode) {
|
||||||
this.zipCode = zipCode;
|
this.zipCode = zipCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,33 +7,33 @@ import net.chrisrichardson.eventstore.Event;
|
|||||||
*/
|
*/
|
||||||
public class CustomerCreatedEvent implements Event {
|
public class CustomerCreatedEvent implements Event {
|
||||||
|
|
||||||
private String socialSecurityNum;
|
private String ssn;
|
||||||
private String phoneNum;
|
private String phoneNumber;
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
public CustomerCreatedEvent() {
|
public CustomerCreatedEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomerCreatedEvent(String socialSecurityNum, String phoneNum, Address address) {
|
public CustomerCreatedEvent(String ssn, String phoneNumber, Address address) {
|
||||||
this.socialSecurityNum = socialSecurityNum;
|
this.ssn = ssn;
|
||||||
this.phoneNum = phoneNum;
|
this.phoneNumber = phoneNumber;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSocialSecurityNum() {
|
public String getSsn() {
|
||||||
return socialSecurityNum;
|
return ssn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSocialSecurityNum(String socialSecurityNum) {
|
public void setSsn(String ssn) {
|
||||||
this.socialSecurityNum = socialSecurityNum;
|
this.ssn = ssn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPhoneNum() {
|
public String getPhoneNumber() {
|
||||||
return phoneNum;
|
return phoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhoneNum(String phoneNum) {
|
public void setPhoneNumber(String phoneNumber) {
|
||||||
this.phoneNum = phoneNum;
|
this.phoneNumber = phoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
|
|||||||
@@ -7,22 +7,22 @@ import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.custom
|
|||||||
*/
|
*/
|
||||||
public class CreateCustomerCommand implements CustomerCommand {
|
public class CreateCustomerCommand implements CustomerCommand {
|
||||||
|
|
||||||
private String socialSecurityNum;
|
private String ssn;
|
||||||
private String phoneNum;
|
private String phoneNumber;
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
public CreateCustomerCommand(String socialSecurityNum, String phoneNum, Address address) {
|
public CreateCustomerCommand(String socialSecurityNum, String phoneNumber, Address address) {
|
||||||
this.socialSecurityNum = socialSecurityNum;
|
this.ssn = ssn;
|
||||||
this.phoneNum = phoneNum;
|
this.phoneNumber = phoneNumber;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSocialSecurityNum() {
|
public String getSsn() {
|
||||||
return socialSecurityNum;
|
return ssn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPhoneNum() {
|
public String getPhoneNumber() {
|
||||||
return phoneNum;
|
return phoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
|
|||||||
@@ -12,18 +12,18 @@ import java.util.List;
|
|||||||
* Created by popikyardo on 02.02.16.
|
* Created by popikyardo on 02.02.16.
|
||||||
*/
|
*/
|
||||||
public class Customer extends ReflectiveMutableCommandProcessingAggregate<Customer, CustomerCommand> {
|
public class Customer extends ReflectiveMutableCommandProcessingAggregate<Customer, CustomerCommand> {
|
||||||
private String socialSecurityNum;
|
private String ssn;
|
||||||
private String phoneNum;
|
private String phoneNumber;
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
public List<Event> process(CreateCustomerCommand cmd) {
|
public List<Event> process(CreateCustomerCommand cmd) {
|
||||||
return EventUtil.events(new CustomerCreatedEvent(cmd.getSocialSecurityNum(), cmd.getPhoneNum(), cmd.getAddress()));
|
return EventUtil.events(new CustomerCreatedEvent(cmd.getSsn(), cmd.getPhoneNumber(), cmd.getAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void apply(CustomerCreatedEvent event) {
|
public void apply(CustomerCreatedEvent event) {
|
||||||
socialSecurityNum = event.getSocialSecurityNum();
|
ssn = event.getSsn();
|
||||||
phoneNum = event.getPhoneNum();
|
phoneNumber = event.getPhoneNumber();
|
||||||
address = event.getAddress();
|
address = event.getAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
298
java-spring/schemas/java-mt-demo-extended-api.json
Normal file
298
java-spring/schemas/java-mt-demo-extended-api.json
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "Api Documentation",
|
||||||
|
"version": "1.0",
|
||||||
|
"title": "Api Documentation",
|
||||||
|
"termsOfService": "urn:tos",
|
||||||
|
"contact": {
|
||||||
|
"name": "Contact Email"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"host": "localhost:8080",
|
||||||
|
"basePath": "/",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"name": "customer-service-command-side-controller",
|
||||||
|
"description": "Customer Service Commandside Controller"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "customer-service-query-side-controller",
|
||||||
|
"description": "Customer Service Queryside Controller"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "account-query-side-controller",
|
||||||
|
"description": "Account Service Queryside Controller"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "auth-controller",
|
||||||
|
"description": "Authentication Controller"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/authenticate": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"auth-controller"
|
||||||
|
],
|
||||||
|
"summary": "doAuth",
|
||||||
|
"operationId": "doAuthUsingPOST",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "request",
|
||||||
|
"description": "request",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/AuthRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/AuthResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/accounts": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"account-query-side-controller"
|
||||||
|
],
|
||||||
|
"summary": "getAllAccountsByCustomer",
|
||||||
|
"operationId": "getAllAccountsByCustomerUsingGET",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "customerId",
|
||||||
|
"in": "query",
|
||||||
|
"description": "customer id",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/CustomersQueryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/customers": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"customer-service-query-side-controller"
|
||||||
|
],
|
||||||
|
"summary": "getAllCustomersByEmail",
|
||||||
|
"operationId": "getAllCustomersByEmailUsingGET",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "email",
|
||||||
|
"in": "query",
|
||||||
|
"description": "customer's email",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/CustomersQueryResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"customer-service-command-side-controller"
|
||||||
|
],
|
||||||
|
"summary": "saveCustomer",
|
||||||
|
"operationId": "saveCustomerUsingPOST",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "customer",
|
||||||
|
"description": "customer",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/CustomerInfo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/CustomerResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Validation error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/customers/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"customer-service-query-side-controller"
|
||||||
|
],
|
||||||
|
"summary": "getBoard",
|
||||||
|
"operationId": "getBoardUsingGET",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"description": "id",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/CustomerResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"AuthRequest": {
|
||||||
|
"required": [ "email" ],
|
||||||
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AuthResponse": {
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CustomerInfo": {
|
||||||
|
"required": [ "email", "ssn", "phoneNumber", "address" ],
|
||||||
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ssn": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"$ref": "#/definitions/Address"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CustomersQueryResponse": {
|
||||||
|
"properties": {
|
||||||
|
"customers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/CustomerResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CustomerResponse": {
|
||||||
|
"required": [ "id", "customerInfo" ],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerInfo": {
|
||||||
|
"$ref": "#/definitions/CustomerInfo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AccountsQueryResponse": {
|
||||||
|
"properties": {
|
||||||
|
"customers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/GetAccountResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"GetAccountResponse": {
|
||||||
|
"properties": {
|
||||||
|
"accountId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"balance": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Address": {
|
||||||
|
"properties": {
|
||||||
|
"street1": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"street2": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"city": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"state": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"zipCode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user