source: src/main/java/com/example/service/impl/CateringServiceImpl.java

Last change on this file was a51a591, checked in by colovik <j.colovik@…>, 14 months ago

final

  • Property mode set to 100644
File size: 871 bytes
Line 
1package com.example.service.impl;
2
3import com.example.exceptions.NoSuchUsernameException;
4import com.example.model.Catering;
5import com.example.repository.CateringRepository;
6import com.example.service.CateringService;
7import org.springframework.stereotype.Service;
8
9import java.util.List;
10
11@Service
12public class CateringServiceImpl implements CateringService {
13
14 private final CateringRepository cateringRepository;
15
16 public CateringServiceImpl(CateringRepository cateringRepository) {
17 this.cateringRepository = cateringRepository;
18 }
19
20 @Override
21 public List<Catering> findAll() {
22 return this.cateringRepository.findAll();
23 }
24
25 @Override
26 public Catering findByName(String name) {
27 return this.cateringRepository.findAllByName(name).stream().findFirst()
28 .orElseThrow(NoSuchUsernameException::new);
29 }
30}
Note: See TracBrowser for help on using the repository browser.