private Customer mapToCustomer(CustomerDto customerDto) throws Exception {
if(customerDto.getFirstName().isEmpty() || customerDto.getLastName().isEmpty() || customerDto.getEmail().isEmpty() || customerDto.getPassword().isEmpty() || customerDto.getRole().isEmpty()) {
throw new Exception("All fields must be filled");
}
return Customer.builder()
.firstName(customerDto.getFirstName())
.lastName(customerDto.getLastName())
.email(customerDto.getEmail())
.password(customerDto.getPassword())
.role(customerDto.getRole())
.build();
}
private Customer mapToCustomer(CustomerDto customerDto) throws Exception {
if(customerDto.getFirstName().isEmpty() || customerDto.getLastName().isEmpty() || customerDto.getEmail().isEmpty() || customerDto.getPassword().isEmpty() || customerDto.getRole().isEmpty()) {
throw new Exception("All fields must be filled");
}
return Customer.builder()
.firstName(customerDto.getFirstName())
.lastName(customerDto.getLastName())
.email(customerDto.getEmail())
.password(customerDto.getPassword())
.role(customerDto.getRole())
.build();
}