FIX: used wrong CrudAction.CREATE for update

This commit is contained in:
Patrick Haßel 2024-11-29 13:20:34 +01:00
parent 9023f57c37
commit 3da3dea353
2 changed files with 4 additions and 2 deletions

View File

@ -87,10 +87,11 @@ public class DeviceService implements IThingService<DeviceDto> {
@EventListener(PropertyDto.class)
public void onPropertyChange(@NonNull final PropertyDto<?> dto) {
deviceRepository.findAllByStatePropertyId(dto.getId()).forEach(device -> publish(device, CrudAction.CREATED));
deviceRepository.findAllByStatePropertyId(dto.getId()).forEach(device -> publish(device, CrudAction.UPDATED));
}
@NonNull
@SuppressWarnings("SameParameterValue")
private DeviceDto publish(@NonNull final Device device, @NonNull final CrudAction action) {
final DeviceDto dto = toDto(device);
log.info("Device {}: {}", action, dto);

View File

@ -115,10 +115,11 @@ public class TunableService implements IThingService<TunableDto> {
@EventListener(PropertyDto.class)
public void onPropertyChange(@NonNull final PropertyDto<?> dto) {
tunableRepository.findDistinctByStatePropertyIdOrBrightnessPropertyIdOrColdnessPropertyId(dto.getId(), dto.getId(), dto.getId()).forEach(tunable -> publish(tunable, CrudAction.CREATED));
tunableRepository.findDistinctByStatePropertyIdOrBrightnessPropertyIdOrColdnessPropertyId(dto.getId(), dto.getId(), dto.getId()).forEach(tunable -> publish(tunable, CrudAction.UPDATED));
}
@NonNull
@SuppressWarnings("SameParameterValue")
private TunableDto publish(@NonNull final Tunable tunable, @NonNull final CrudAction action) {
final TunableDto dto = toDto(tunable);
log.info("Tunable {}: {}", action, dto);