diff --git a/src/main/kotlin/pl/grzeslowski/jsuplaservermock/InitDb.kt b/src/main/kotlin/pl/grzeslowski/jsuplaservermock/InitDb.kt index 73747ae..a8991f7 100644 --- a/src/main/kotlin/pl/grzeslowski/jsuplaservermock/InitDb.kt +++ b/src/main/kotlin/pl/grzeslowski/jsuplaservermock/InitDb.kt @@ -59,11 +59,15 @@ open class InitDb(private val deviceService: DeviceService) : CommandLineRunner // multiple channels buildDeviceWithMultipleChannels("Multiple channels #1"), buildDeviceWithMultipleChannels("Multiple channels #2") - ).forEach { - deviceService.addDevice(it) - updateEnabled(it) - updateName(it) - updateComment(it) + ).forEach { device -> + device.channelsIds = device.channels + .stream() + .map { it.id } + .collect(Collectors.toList()) + deviceService.addDevice(device) + updateEnabled(device) + updateName(device) + updateComment(device) } }