added "/customers/{id}/toaccounts" andpoint test
tests refactoring
This commit is contained in:
@@ -27,9 +27,8 @@ public class CustomerQueryController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/customers/{customerId}", method = RequestMethod.GET)
|
||||
public Observable<CustomerResponse> getCustomer(@PathVariable String customerId) {
|
||||
return customerQueryService.findByCustomerId(new EntityIdentifier(customerId))
|
||||
.map(this::getCustomerResponse);
|
||||
public Observable<QuerySideCustomer> getCustomer(@PathVariable String customerId) {
|
||||
return customerQueryService.findByCustomerId(new EntityIdentifier(customerId));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/customers", method = RequestMethod.GET)
|
||||
@@ -50,10 +49,6 @@ public class CustomerQueryController {
|
||||
}
|
||||
|
||||
private CustomersQueryResponse getCustomersQueryResponse(List<QuerySideCustomer> customersList) {
|
||||
return new CustomersQueryResponse(customersList
|
||||
.stream()
|
||||
.map(this::getCustomerResponse)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
return new CustomersQueryResponse(customersList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.web.queryside.customers;
|
||||
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.QuerySideCustomer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,20 +10,20 @@ import java.util.List;
|
||||
*/
|
||||
public class CustomersQueryResponse {
|
||||
|
||||
private List<CustomerResponse> customers;
|
||||
private List<QuerySideCustomer> customers;
|
||||
|
||||
public CustomersQueryResponse() {
|
||||
}
|
||||
|
||||
public CustomersQueryResponse(List<CustomerResponse> customers) {
|
||||
public CustomersQueryResponse(List<QuerySideCustomer> customers) {
|
||||
this.customers = customers;
|
||||
}
|
||||
|
||||
public List<CustomerResponse> getCustomers() {
|
||||
public List<QuerySideCustomer> getCustomers() {
|
||||
return customers;
|
||||
}
|
||||
|
||||
public void setCustomers(List<CustomerResponse> customers) {
|
||||
public void setCustomers(List<QuerySideCustomer> customers) {
|
||||
this.customers = customers;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user