Last change
on this file since a51a591 was a51a591, checked in by colovik <j.colovik@…>, 14 months ago |
final
|
-
Property mode
set to
100644
|
File size:
871 bytes
|
Line | |
---|
1 | package com.example.service.impl;
|
---|
2 |
|
---|
3 | import com.example.exceptions.NoSuchUsernameException;
|
---|
4 | import com.example.model.Catering;
|
---|
5 | import com.example.repository.CateringRepository;
|
---|
6 | import com.example.service.CateringService;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public 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.