This commit is contained in:
Claudio Maggioni (maggicl) 2020-04-28 10:05:08 +02:00
parent 3118c07a83
commit ba73348a74
3 changed files with 15 additions and 0 deletions

View file

@ -31,6 +31,11 @@ public class ButtonDimmerController
this.buttonDimmerRepository = inputRepository; this.buttonDimmerRepository = inputRepository;
} }
@GetMapping("/{id}")
public ButtonDimmer findById(@PathVariable("id") long id) throws NotFoundException {
return buttonDimmerRepository.findById(id).orElseThrow(NotFoundException::new);
}
@PostMapping @PostMapping
public ButtonDimmer create( public ButtonDimmer create(
@Valid @RequestBody final GenericDeviceSaveReguest bd, final Principal principal) @Valid @RequestBody final GenericDeviceSaveReguest bd, final Principal principal)

View file

@ -27,6 +27,11 @@ public class KnobDimmerController extends InputDeviceConnectionController<KnobDi
this.knobDimmerRepository = inputRepository; this.knobDimmerRepository = inputRepository;
} }
@GetMapping("/{id}")
public KnobDimmer findById(@PathVariable("id") long id) throws NotFoundException {
return knobDimmerRepository.findById(id).orElseThrow(NotFoundException::new);
}
@PostMapping @PostMapping
public KnobDimmer create( public KnobDimmer create(
@Valid @RequestBody GenericDeviceSaveReguest kd, final Principal principal) @Valid @RequestBody GenericDeviceSaveReguest kd, final Principal principal)

View file

@ -37,6 +37,11 @@ public class SwitchController extends InputDeviceConnectionController<Switch, Sw
this.switchRepository = inputRepository; this.switchRepository = inputRepository;
} }
@GetMapping("/{id}")
public Switch findById(@PathVariable("id") long id) throws NotFoundException {
return switchRepository.findById(id).orElseThrow(NotFoundException::new);
}
@PostMapping @PostMapping
public Switch create(@Valid @RequestBody GenericDeviceSaveReguest s, final Principal principal) public Switch create(@Valid @RequestBody GenericDeviceSaveReguest s, final Principal principal)
throws NotFoundException { throws NotFoundException {