Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
fix: code lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasmzsouza committed Jul 23, 2024
1 parent 5938191 commit 05048e6
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
import br.com.fiap.grupo30.fastfood.presentation.presenters.exceptions.ResourceConflictException;
import br.com.fiap.grupo30.fastfood.presentation.presenters.exceptions.ResourceNotFoundException;
import br.com.fiap.grupo30.fastfood.presentation.presenters.mapper.impl.CustomerEntityMapper;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@Service
public class CustomerGateway implements CustomerRepository {

Expand All @@ -24,8 +23,8 @@ public class CustomerGateway implements CustomerRepository {

@Autowired
public CustomerGateway(
JpaCustomerRepository jpaCustomerRepository,
CustomerEntityMapper customerEntityMapper) {
JpaCustomerRepository jpaCustomerRepository,
CustomerEntityMapper customerEntityMapper) {
this.jpaCustomerRepository = jpaCustomerRepository;
this.customerEntityMapper = customerEntityMapper;
}
Expand All @@ -49,11 +48,11 @@ public Customer findCustomerByCpf(String cpf) {
public Customer insert(Customer customer) {
try {
CustomerEntity entity =
jpaCustomerRepository.save(customerEntityMapper.mapTo(customer));
jpaCustomerRepository.save(customerEntityMapper.mapTo(customer));
return this.customerEntityMapper.mapFrom(entity);
} catch (DataIntegrityViolationException e) {
throw new ResourceConflictException(
"CPF already exists: " + customer.getCpf().value(), e);
"CPF already exists: " + customer.getCpf().value(), e);
}
}
}

0 comments on commit 05048e6

Please sign in to comment.