fixed read endpoint for all customers
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
package de.strasser.peter.hexagonal.web;
|
||||
|
||||
import de.strasser.peter.hexagonal.application.customer.port.in.QueryAllCustomersCRUD;
|
||||
import de.strasser.peter.hexagonal.web.dto.response.CustomerResponse;
|
||||
import de.strasser.peter.hexagonal.web.mapper.CustomerWebMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class CustomerCRUDController {
|
||||
private final QueryAllCustomersCRUD queryAllCustomersCRUD;
|
||||
private final CustomerWebMapper customerMapper;
|
||||
|
||||
@GetMapping("/v1/customers")
|
||||
public Object getAllCustomers() {
|
||||
return this.queryAllCustomersCRUD.getAll();
|
||||
public List<CustomerResponse> getAllCustomers() {
|
||||
return customerMapper.toResponse(this.queryAllCustomersCRUD.getAll());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
package de.strasser.peter.hexagonal.web.dto.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CustomerResponse {
|
||||
private BigInteger id;
|
||||
private String name;
|
||||
private String hashedPassword;
|
||||
private LocalDate birthday;
|
||||
private int age;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user