Merge branch 'dev' into 'master'

Dev

See merge request sa4-2020/the-sanmarinoes/backend!101
This commit is contained in:
Claudio Maggioni 2020-04-28 10:14:10 +02:00
commit f8989f7bc5
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 {