This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftsrecords.talkadvisor.infra.resources | |
import org.craftsrecords.talkadvisor.recommendation.preferences.Preferences as DomainPreferences | |
import org.craftsrecords.talkadvisor.recommendation.preferences.Topic as DomainTopic | |
import org.craftsrecords.talkadvisor.recommendation.talk.TalkFormat as DomainTalkFormat | |
data class Preferences(val topics: List<Topic>, val talksFormats: List<String>) { | |
fun toDomainObject(): DomainPreferences { | |
return DomainPreferences(topics.toDomainObjects(), talksFormats.toDomainTalkFormats()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftsrecords.talkadvisor.infra.resources | |
import org.craftsrecords.talkadvisor.recommendation.preferences.Topic as DomainTopic | |
class Topic(val name: String) { | |
fun toDomainObject(): DomainTopic { | |
return DomainTopic(this.name) | |
} | |
} | |
fun Iterable<Topic>.toDomainObjects(): Set<DomainTopic> { | |
return this.map(Topic::toDomainObject).toSet() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment