Last change
on this file was b3f2adb, checked in by Aleksandar Siljanoski <acewow3@…>, 14 months ago |
Adding project to repo
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | package com.example.eatys_app.service;
|
---|
2 |
|
---|
3 | import com.example.eatys_app.model.Menadzer;
|
---|
4 | import com.example.eatys_app.model.exceptions.InvalidMenadzerIdException;
|
---|
5 | import com.example.eatys_app.repository.MenadzerRepository;
|
---|
6 | import org.springframework.stereotype.Service;
|
---|
7 |
|
---|
8 | import java.util.Date;
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class MenadzerServiceImpl implements MenadzerService{
|
---|
13 |
|
---|
14 | private final MenadzerRepository menadzerRepository;
|
---|
15 |
|
---|
16 | public MenadzerServiceImpl(MenadzerRepository menadzerRepository) {
|
---|
17 | this.menadzerRepository = menadzerRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public Menadzer findById(Integer id) {
|
---|
23 | return this.menadzerRepository.findById(id).orElseThrow(InvalidMenadzerIdException::new);
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public List<Menadzer> listAll() {
|
---|
28 | return this.menadzerRepository.findAll();
|
---|
29 | }
|
---|
30 |
|
---|
31 | @Override
|
---|
32 | public Menadzer create(Date vraboten_od) {
|
---|
33 | Menadzer menadzer = new Menadzer(vraboten_od);
|
---|
34 | return this.menadzerRepository.save(menadzer);
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.