Add Location Entity, Service and Repository. Add Test to add a location line for a client wich rent a game
This commit is contained in:
17
src/main/java/fr/eni/demo/bll/AdresseService.java
Normal file
17
src/main/java/fr/eni/demo/bll/AdresseService.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package fr.eni.demo.bll;
|
||||
|
||||
import fr.eni.demo.bo.Adresse;
|
||||
import fr.eni.demo.dal.AdresseRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AdresseService {
|
||||
|
||||
@Autowired
|
||||
AdresseRepository adresseRepository;
|
||||
|
||||
public void add(Adresse adresse) {
|
||||
adresseRepository.save(adresse);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import fr.eni.demo.dal.ClientRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ClientService {
|
||||
|
||||
@@ -14,4 +16,8 @@ public class ClientService {
|
||||
public void add(Client client) {
|
||||
clientRepository.save(client);
|
||||
}
|
||||
|
||||
public Optional<Client> findById(Long clientId) {
|
||||
return clientRepository.findById(clientId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
|
||||
public class LocationService {
|
||||
|
||||
@Autowired
|
||||
LocationRepository locationRepository;
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
public void add(Location location) {
|
||||
locationRepository.save(location);
|
||||
|
||||
@@ -5,6 +5,8 @@ import fr.eni.demo.dal.StockRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class StockService {
|
||||
|
||||
@@ -14,4 +16,8 @@ public class StockService {
|
||||
public void add(Stock stock) {
|
||||
stockRepository.save(stock);
|
||||
}
|
||||
|
||||
public Optional<Stock> findById(Long gameId) {
|
||||
return stockRepository.findById(gameId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user