Skip to content

Commit

Permalink
criando camada de serviço
Browse files Browse the repository at this point in the history
com a base dos comandos
  • Loading branch information
GabryelBoeira committed Oct 10, 2024
1 parent 531475b commit 8350a45
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
Expand Down Expand Up @@ -31,7 +30,7 @@ public class AddressEntity implements Serializable {

private String street;

private String number;
private Integer number;

private String city;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.github.gabryel.videolocadora.service.customer;

import io.github.gabryel.videolocadora.entity.customer.CustomerEntity;
import io.github.gabryel.videolocadora.repository.customer.CustomerRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class CustomerService {

private final CustomerRepository customerRepository;

public void save(CustomerEntity customer) {
customerRepository.save(customer);
}

public CustomerEntity findById(Long id) {
return customerRepository.findById(id).orElse(null);
}

public List<CustomerEntity> findAll() {
return customerRepository.findAll();
}

public void delete(Long id) {
customerRepository.deleteById(id);
}

public List<CustomerEntity> findByCpf(String cpf) {
return customerRepository.findByCpf(cpf);
}

}

0 comments on commit 8350a45

Please sign in to comment.