Proof of concept (#6)

* Sample template created

* added findByName functionality for item

* Solve Cors errors and inhibit DefaultExposure

* changed project structure

* Added frontend

* Creation of base template (#1)

* changed base path of REST api and updated frontend api quering
This commit is contained in:
cato
2022-06-02 19:11:46 +02:00
committed by GitHub
parent edaf3c557e
commit f6385b40f6
32 changed files with 7031 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package whattocook.implementation;
import whattocook.models.Item;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import whattocook.repositories.ItemRepository;
import whattocook.services.ItemService;
import java.util.List;
import java.util.Optional;
@Service
public class ItemServiceImpl implements ItemService {
@Autowired
private ItemRepository itemRepository;
@Override
public Item save(Item item) {
return itemRepository.save(item);
}
@Override
public void deleteById(Long id) {
itemRepository.deleteById(id);
}
@Override
public Optional<Item> findById(long id) {
return itemRepository.findById(id);
}
@Override
public Optional<Item> findByName(String name) {
return itemRepository.findByName(name);
}
@Override
public List<Item> findAll() {
return itemRepository.findAll();
}
}