source: src/main/java/com/example/eatys_app/service/MenadzerServiceImpl.java

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
RevLine 
[b3f2adb]1package com.example.eatys_app.service;
2
3import com.example.eatys_app.model.Menadzer;
4import com.example.eatys_app.model.exceptions.InvalidMenadzerIdException;
5import com.example.eatys_app.repository.MenadzerRepository;
6import org.springframework.stereotype.Service;
7
8import java.util.Date;
9import java.util.List;
10
11@Service
12public 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.