forked from Olympic/NTO-2025-Backend-TeamTask
30 lines
767 B
Java
30 lines
767 B
Java
package com.example.nto.service.impl;
|
|
|
|
import com.example.nto.entity.Place;
|
|
import com.example.nto.repository.PlaceRepository;
|
|
import com.example.nto.service.PlaceService;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class PlaceServiceImpl implements PlaceService {
|
|
|
|
private final PlaceRepository placeRepository;
|
|
|
|
public PlaceServiceImpl(PlaceRepository placeRepository) {
|
|
this.placeRepository = placeRepository;
|
|
}
|
|
|
|
@Override
|
|
public List<Place> getAllPlaces() {
|
|
return placeRepository.findAll();
|
|
}
|
|
|
|
@Override
|
|
public Place getPlaceById(Long id) {
|
|
return placeRepository.findById(id)
|
|
.orElseThrow(() -> new RuntimeException("Place not found"));
|
|
}
|
|
}
|