Ignore:
Timestamp:
02/03/24 15:58:58 (9 months ago)
Author:
Blazho <aleksandar.blazhevski@…>
Branches:
master
Children:
aea04dd
Parents:
3e572eb
Message:

added missing files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/cookbook/service/impl/ReceptServiceImpl.java

    r3e572eb r501396e  
    1 package com.example.cookbook.service.impl;public class ReceptServiceImpl {
     1package com.example.cookbook.service.impl;
     2
     3import com.example.cookbook.model.Recept;
     4import com.example.cookbook.model.exception.ReceptNeEPronajdenException;
     5import com.example.cookbook.repository.ReceptRepository;
     6import com.example.cookbook.service.ReceptService;
     7import org.springframework.stereotype.Service;
     8
     9import java.sql.SQLException;
     10import java.util.List;
     11import java.util.Optional;
     12
     13@Service
     14public class ReceptServiceImpl implements ReceptService {
     15
     16    private final ReceptRepository receptRepository;
     17
     18    public ReceptServiceImpl(ReceptRepository receptRepository) {
     19        this.receptRepository = receptRepository;
     20    }
     21
     22    @Override
     23    public List<Recept> listAll() throws SQLException {
     24        return receptRepository.findAll();
     25    }
     26
     27    @Override
     28    public Recept findById(Long id) throws SQLException {
     29        Recept recept;
     30
     31        recept = receptRepository.findById(id).orElseThrow(ReceptNeEPronajdenException::new);
     32
     33        return recept;
     34    }
    235}
Note: See TracChangeset for help on using the changeset viewer.