fixed fields names

added swagger  definition for new endpoints
This commit is contained in:
dartpopikyardo
2016-02-03 21:03:52 +03:00
parent 85f8826741
commit cbee50658e
5 changed files with 329 additions and 31 deletions

View File

@@ -9,12 +9,12 @@ public class Address {
private String street2;
private String city;
private String state;
private int zipCode;
private String zipCode;
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.street2 = street2;
this.city = city;
@@ -54,11 +54,11 @@ public class Address {
this.state = state;
}
public int getZipCode() {
public String getZipCode() {
return zipCode;
}
public void setZipCode(int zipCode) {
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
}

View File

@@ -7,33 +7,33 @@ import net.chrisrichardson.eventstore.Event;
*/
public class CustomerCreatedEvent implements Event {
private String socialSecurityNum;
private String phoneNum;
private String ssn;
private String phoneNumber;
private Address address;
public CustomerCreatedEvent() {
}
public CustomerCreatedEvent(String socialSecurityNum, String phoneNum, Address address) {
this.socialSecurityNum = socialSecurityNum;
this.phoneNum = phoneNum;
public CustomerCreatedEvent(String ssn, String phoneNumber, Address address) {
this.ssn = ssn;
this.phoneNumber = phoneNumber;
this.address = address;
}
public String getSocialSecurityNum() {
return socialSecurityNum;
public String getSsn() {
return ssn;
}
public void setSocialSecurityNum(String socialSecurityNum) {
this.socialSecurityNum = socialSecurityNum;
public void setSsn(String ssn) {
this.ssn = ssn;
}
public String getPhoneNum() {
return phoneNum;
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNum(String phoneNum) {
this.phoneNum = phoneNum;
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Address getAddress() {

View File

@@ -7,22 +7,22 @@ import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.custom
*/
public class CreateCustomerCommand implements CustomerCommand {
private String socialSecurityNum;
private String phoneNum;
private String ssn;
private String phoneNumber;
private Address address;
public CreateCustomerCommand(String socialSecurityNum, String phoneNum, Address address) {
this.socialSecurityNum = socialSecurityNum;
this.phoneNum = phoneNum;
public CreateCustomerCommand(String socialSecurityNum, String phoneNumber, Address address) {
this.ssn = ssn;
this.phoneNumber = phoneNumber;
this.address = address;
}
public String getSocialSecurityNum() {
return socialSecurityNum;
public String getSsn() {
return ssn;
}
public String getPhoneNum() {
return phoneNum;
public String getPhoneNumber() {
return phoneNumber;
}
public Address getAddress() {

View File

@@ -12,18 +12,18 @@ import java.util.List;
* Created by popikyardo on 02.02.16.
*/
public class Customer extends ReflectiveMutableCommandProcessingAggregate<Customer, CustomerCommand> {
private String socialSecurityNum;
private String phoneNum;
private String ssn;
private String phoneNumber;
private Address address;
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) {
socialSecurityNum = event.getSocialSecurityNum();
phoneNum = event.getPhoneNum();
ssn = event.getSsn();
phoneNumber = event.getPhoneNumber();
address = event.getAddress();
}
}

View 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"
},
}
}
}
}