24 lines
645 B
Java
24 lines
645 B
Java
package de.ph87.homeautomation.schedule;
|
|
|
|
import de.ph87.homeautomation.property.PropertyMapper;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import static de.ph87.homeautomation.shared.Helpers.mapIfNotNull;
|
|
|
|
@Slf4j
|
|
@Service
|
|
@Transactional
|
|
@RequiredArgsConstructor
|
|
public class ScheduleMapper {
|
|
|
|
private final PropertyMapper propertyMapper;
|
|
|
|
public ScheduleDto toDto(final Schedule schedule) {
|
|
return new ScheduleDto(schedule, mapIfNotNull(schedule.getProperty(), propertyMapper::toDto));
|
|
}
|
|
|
|
}
|