Homeautomation/src/main/java/de/ph87/homeautomation/schedule/entry/ScheduleEntryController.java

114 lines
4.1 KiB
Java

package de.ph87.homeautomation.schedule.entry;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("schedule/entry")
@RequiredArgsConstructor
public class ScheduleEntryController {
private final ScheduleEntryWriter scheduleEntryWriter;
@GetMapping("create/{scheduleId}")
public ScheduleEntryDto create(@PathVariable final long scheduleId) {
return scheduleEntryWriter.create(scheduleId);
}
@GetMapping("delete/{id}")
public void delete(@PathVariable final long id) {
scheduleEntryWriter.delete(id);
}
@PostMapping("set/{id}/position")
public ScheduleEntryDto setPosition(@PathVariable final long id, @RequestBody final int value) {
return scheduleEntryWriter.setPosition(id, value);
}
@PostMapping("set/{id}/enabled")
public ScheduleEntryDto setEnabled(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setEnabled(id, value);
}
@PostMapping("set/{id}/monday")
public ScheduleEntryDto setMonday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setMonday(id, value);
}
@PostMapping("set/{id}/tuesday")
public ScheduleEntryDto setTuesday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setTuesday(id, value);
}
@PostMapping("set/{id}/wednesday")
public ScheduleEntryDto setWednesday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setWednesday(id, value);
}
@PostMapping("set/{id}/thursday")
public ScheduleEntryDto setThursday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setThursday(id, value);
}
@PostMapping("set/{id}/friday")
public ScheduleEntryDto setFriday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setFriday(id, value);
}
@PostMapping("set/{id}/saturday")
public ScheduleEntryDto setSaturday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setSaturday(id, value);
}
@PostMapping("set/{id}/sunday")
public ScheduleEntryDto setSunday(@PathVariable final long id, @RequestBody final boolean value) {
return scheduleEntryWriter.setSunday(id, value);
}
@PostMapping("set/{id}/type")
public ScheduleEntryDto setType(@PathVariable final long id, @RequestBody final String value) {
return scheduleEntryWriter.setType(id, ScheduleEntryType.valueOf(value));
}
@PostMapping("set/{id}/zenith")
public ScheduleEntryDto setZenith(@PathVariable final long id, @RequestBody final String value) {
return scheduleEntryWriter.setZenith(id, Double.parseDouble(value));
}
@PostMapping("set/{id}/hour")
public ScheduleEntryDto setHour(@PathVariable final long id, @RequestBody final int value) {
return scheduleEntryWriter.setHour(id, value);
}
@PostMapping("set/{id}/minute")
public ScheduleEntryDto setMinute(@PathVariable final long id, @RequestBody final int value) {
return scheduleEntryWriter.setMinute(id, value);
}
@PostMapping("set/{id}/second")
public ScheduleEntryDto setSecond(@PathVariable final long id, @RequestBody final int value) {
return scheduleEntryWriter.setSecond(id, value);
}
@PostMapping("set/{id}/fuzzySeconds")
public ScheduleEntryDto setFuzzySeconds(@PathVariable final long id, @RequestBody final int value) {
return scheduleEntryWriter.setFuzzySeconds(id, value);
}
@PostMapping("set/{id}/property")
public ScheduleEntryDto setProperty(@PathVariable final long id, @RequestBody(required = false) final Long propertyId) {
return scheduleEntryWriter.setProperty(id, propertyId);
}
@PostMapping("set/{id}/value")
public ScheduleEntryDto setValue(@PathVariable final long id, @RequestBody final double value) {
return scheduleEntryWriter.setValue(id, value);
}
@PostMapping("set/{id}/bulk")
public ScheduleEntryDto setBulk(@PathVariable final long id, @RequestBody(required = false) final Long bulkId) {
return scheduleEntryWriter.setBulk(id, bulkId);
}
}