Use mapstruct

This commit is contained in:
2020-10-21 21:34:57 +02:00
parent 681fd635b3
commit cb76a3253d
12 changed files with 390 additions and 67 deletions
@@ -0,0 +1,17 @@
package be.simplenotes.persistance.converters
import be.simplenotes.domain.model.PersistedUser
import be.simplenotes.domain.model.User
import be.simplenotes.persistance.users.UserEntity
import me.liuwj.ktorm.entity.Entity
import org.mapstruct.Mapper
@Mapper(uses = [UserEntityFactory::class])
internal interface UserConverter {
fun toUser(userEntity: UserEntity): User
fun toPersistedUser(userEntity: UserEntity): PersistedUser
fun toEntity(user: User): UserEntity
fun toEntity(user: PersistedUser): UserEntity
}
internal class UserEntityFactory : Entity.Factory<UserEntity>()