refactor: ifEmptyを使用するように

This commit is contained in:
usbharu 2024-09-06 18:44:10 +09:00
parent 20a762b8f4
commit 5ae4d1577a
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
1 changed files with 1 additions and 3 deletions

View File

@ -26,10 +26,8 @@ class GetActorDetailApplicationService(
actorRepository.findById(ActorId(command.id)) actorRepository.findById(ActorId(command.id))
?: throw IllegalArgumentException("Actor ${command.id} not found.") ?: throw IllegalArgumentException("Actor ${command.id} not found.")
} else if (command.actorName != null) { } else if (command.actorName != null) {
val host = if (command.actorName.host.isEmpty()) { val host = command.actorName.host.ifEmpty {
applicationConfig.url.host applicationConfig.url.host
} else {
command.actorName.host
} }
actorRepository.findByNameAndDomain(command.actorName.userpart, host) actorRepository.findByNameAndDomain(command.actorName.userpart, host)
?: throw IllegalArgumentException("Actor ${command.actorName} not found.") ?: throw IllegalArgumentException("Actor ${command.actorName} not found.")