Homeautomation/src/main/java/de/ph87/homeautomation/schedule/ScheduleController.java

24 lines
659 B
Java

package de.ph87.homeautomation.schedule;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("schedule")
@RequiredArgsConstructor
public class ScheduleController {
private final ScheduleRepository scheduleRepository;
@GetMapping("findAll")
public List<ScheduleDto> findAll() {
return scheduleRepository.findAll().stream().map(ScheduleDto::new).collect(Collectors.toList());
}
}