Move types into simplenotes-types module

This commit is contained in:
2020-10-23 16:08:35 +02:00
parent 4c9ac8944e
commit c2eaf3d0cc
36 changed files with 102 additions and 60 deletions
@@ -3,9 +3,7 @@ package be.simplenotes.persistance
import be.simplenotes.domain.usecases.repositories.NoteRepository
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.persistance.converters.NoteConverter
import be.simplenotes.persistance.converters.NoteConverterImpl
import be.simplenotes.persistance.converters.UserConverter
import be.simplenotes.persistance.converters.UserConverterImpl
import be.simplenotes.persistance.notes.NoteRepositoryImpl
import be.simplenotes.persistance.users.UserRepositoryImpl
import be.simplenotes.shared.config.DataSourceConfig
@@ -15,6 +13,7 @@ import me.liuwj.ktorm.database.Database
import org.koin.dsl.bind
import org.koin.dsl.module
import org.koin.dsl.onClose
import org.mapstruct.factory.Mappers
import javax.sql.DataSource
private fun hikariDataSource(conf: DataSourceConfig): HikariDataSource {
@@ -34,8 +33,8 @@ val migrationModule = module {
}
val persistanceModule = module {
single<NoteConverter> { NoteConverterImpl() }
single<UserConverter> { UserConverterImpl() }
single { Mappers.getMapper(NoteConverter::class.java) }
single { Mappers.getMapper(UserConverter::class.java) }
single<UserRepository> { UserRepositoryImpl(get(), get()) }
single<NoteRepository> { NoteRepositoryImpl(get(), get()) }
single { hikariDataSource(get()) } bind DataSource::class onClose { it?.close() }
@@ -1,6 +1,6 @@
package be.simplenotes.persistance.converters
import be.simplenotes.domain.model.*
import be.simplenotes.types.*
import be.simplenotes.persistance.notes.NoteEntity
import me.liuwj.ktorm.entity.Entity
import org.mapstruct.Mapper
@@ -1,7 +1,7 @@
package be.simplenotes.persistance.converters
import be.simplenotes.domain.model.PersistedUser
import be.simplenotes.domain.model.User
import be.simplenotes.types.PersistedUser
import be.simplenotes.types.User
import be.simplenotes.persistance.users.UserEntity
import me.liuwj.ktorm.entity.Entity
import org.mapstruct.Mapper
@@ -1,9 +1,9 @@
package be.simplenotes.persistance.notes
import be.simplenotes.domain.model.ExportedNote
import be.simplenotes.domain.model.Note
import be.simplenotes.domain.model.PersistedNote
import be.simplenotes.domain.model.PersistedNoteMetadata
import be.simplenotes.types.ExportedNote
import be.simplenotes.types.Note
import be.simplenotes.types.PersistedNote
import be.simplenotes.types.PersistedNoteMetadata
import be.simplenotes.domain.usecases.repositories.NoteRepository
import be.simplenotes.persistance.converters.NoteConverter
import me.liuwj.ktorm.database.Database
@@ -1,7 +1,7 @@
package be.simplenotes.persistance.users
import be.simplenotes.domain.model.PersistedUser
import be.simplenotes.domain.model.User
import be.simplenotes.types.PersistedUser
import be.simplenotes.types.User
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.persistance.converters.UserConverter
import me.liuwj.ktorm.database.Database
@@ -1,6 +1,6 @@
package be.simplenotes.persistance.converters
import be.simplenotes.domain.model.*
import be.simplenotes.types.*
import be.simplenotes.persistance.notes.NoteEntity
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.DisplayName
@@ -1,7 +1,7 @@
package be.simplenotes.persistance.converters
import be.simplenotes.domain.model.PersistedUser
import be.simplenotes.domain.model.User
import be.simplenotes.types.PersistedUser
import be.simplenotes.types.User
import be.simplenotes.persistance.users.UserEntity
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@@ -1,6 +1,6 @@
package be.simplenotes.persistance.notes
import be.simplenotes.domain.model.*
import be.simplenotes.types.*
import be.simplenotes.domain.usecases.repositories.NoteRepository
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.persistance.DbMigrations
@@ -1,6 +1,6 @@
package be.simplenotes.persistance.users
import be.simplenotes.domain.model.User
import be.simplenotes.types.User
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.persistance.DbMigrations
import be.simplenotes.persistance.migrationModule