-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...adora/src/main/java/io/github/gabryel/videolocadora/service/customer/CustomerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |