From 38750a588cb99a86fe49fb41086699f33161f979 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Fri, 23 Oct 2020 17:12:38 +0200 Subject: [PATCH] Move packages + remove circular dependencies --- Dockerfile | 28 +++++++------ css/package.json | 4 +- css/tailwind.config.js | 2 +- deploy-docker-hub.sh | 4 +- pom.xml | 2 +- simplenotes-app/pom.xml | 28 ++++++++++--- .../kotlin/{ => be/simplenotes/app}/Config.kt | 0 .../kotlin/{ => be/simplenotes/app}/Server.kt | 0 .../{ => be/simplenotes/app}/SimpleNotes.kt | 0 .../simplenotes/app}/api/ApiNoteController.kt | 0 .../simplenotes/app}/api/ApiUserController.kt | 0 .../app}/controllers/BaseController.kt | 0 .../app}/controllers/HealthCheckController.kt | 0 .../app}/controllers/NoteController.kt | 0 .../app}/controllers/SettingsController.kt | 0 .../app}/controllers/UserController.kt | 0 .../app}/extensions/Http4kExtensions.kt | 0 .../app}/extensions/KoinExtensions.kt | 0 .../app}/extensions/KotlinxHtmlExtensions.kt | 0 .../simplenotes/app}/filters/AuthFilter.kt | 0 .../simplenotes/app}/filters/ErrorFilter.kt | 0 .../app}/filters/ImmutableFilter.kt | 0 .../app}/filters/SecurityFilter.kt | 0 .../app}/filters/TransactionFilter.kt | 0 .../kotlin/be/simplenotes/app/jetty/Jetty.kt | 40 +++++++++++++++++++ .../simplenotes/app}/modules/ApiModule.kt | 0 .../simplenotes/app}/modules/ConfigModule.kt | 0 .../simplenotes/app}/modules/CoreModules.kt | 0 .../simplenotes/app}/modules/JsonModule.kt | 0 .../simplenotes/app}/modules/ServerModule.kt | 4 +- .../{ => be/simplenotes/app}/routes/Router.kt | 0 .../serialization/LocaleDateTimeSerializer.kt | 0 .../app}/serialization/UuidSerializer.kt | 0 .../simplenotes/app}/utils/PrettyDate.kt | 0 .../app}/utils/SearchTermsParser.kt | 2 +- .../app}/utils/StaticFilesResolver.kt | 0 .../simplenotes/app}/views/BaseView.kt | 0 .../simplenotes/app}/views/ErrorView.kt | 0 .../simplenotes/app}/views/NoteView.kt | 0 .../simplenotes/app}/views/SettingView.kt | 0 .../simplenotes/app}/views/UserView.kt | 0 .../{ => be/simplenotes/app}/views/View.kt | 0 .../app}/views/components/Alerts.kt | 0 .../app}/views/components/DeletedNoteTable.kt | 0 .../app}/views/components/Forms.kt | 0 .../app}/views/components/Navbar.kt | 0 .../app}/views/components/NoteListHeader.kt | 0 .../app}/views/components/NoteTable.kt | 0 .../src/main/kotlin/module-info.java | 25 ++++++++++++ simplenotes-app/src/test/kotlin/Empty.kt | 1 - .../app}/filters/AuthFilterTest.kt | 0 .../app}/utils/SearchTermsParserKtTest.kt | 2 +- .../{ => be/simplenotes/config}/Config.kt | 0 .../src/main/kotlin/module-info.java | 5 +++ simplenotes-domain/pom.xml | 14 +++++++ .../simplenotes/domain}/DomainModule.kt | 0 .../domain}/security/HtmlSanitizer.kt | 2 +- .../domain}/security/JwtPayload.kt | 0 .../domain}/security/PasswordHash.kt | 0 .../simplenotes/domain}/security/SimpleJwt.kt | 0 .../domain}/usecases/NoteService.kt | 8 ++-- .../domain}/usecases/UserService.kt | 0 .../domain}/usecases/export/ExportUseCase.kt | 0 .../usecases/export/ExportUseCaseImpl.kt | 2 +- .../usecases/markdown/MarkdownConverter.kt | 0 .../users/delete/DeleteUseCaseImpl.kt | 4 +- .../usecases/users/delete/DeleteUsecase.kt | 0 .../usecases/users/login/LoginUseCaseImpl.kt | 2 +- .../usecases/users/login/LoginUsecase.kt | 0 .../users/register/RegisterUseCaseImpl.kt | 2 +- .../users/register/RegisterUsecase.kt | 0 .../domain}/validation/NoteValidations.kt | 0 .../domain}/validation/UserValidations.kt | 0 .../src/main/kotlin/module-info.java | 33 +++++++++++++++ simplenotes-domain/src/test/kotlin/Empty.kt | 5 --- .../security/JwtPayloadExtractorTest.kt | 0 .../domain}/testutils/ArrowAssertions.kt | 0 .../users/login/LoginUseCaseImplTest.kt | 2 +- .../users/register/RegisterUseCaseImplTest.kt | 2 +- .../domain}/validation/UserValidationsTest.kt | 0 simplenotes-persistance/pom.xml | 9 ++--- .../simplenotes/persistance}/HealthCheck.kt | 0 .../simplenotes/persistance}/Migrations.kt | 0 .../persistance}/PersistanceModule.kt | 19 ++++----- .../persistance}/converters/NoteConverter.kt | 0 .../persistance}/converters/UserConverter.kt | 0 .../extensions/KtormExtensions.kt | 0 .../persistance}/notes/NoteRepositoryImpl.kt | 2 +- .../simplenotes/persistance}/notes/Notes.kt | 0 .../simplenotes/persistance}/notes/Tags.kt | 0 .../repositories/NoteRepository.kt | 2 +- .../repositories/UserRepository.kt | 2 +- .../persistance}/users/UserRepositoryImpl.kt | 2 +- .../simplenotes/persistance}/users/Users.kt | 0 .../utils/DataSourceConfigUtils.kt | 0 .../src/main/kotlin/module-info.java | 18 +++++++++ .../src/test/kotlin/Empty.kt | 1 - .../converters/NoteConverterTest.kt | 2 +- .../converters/UserConverterTest.kt | 0 .../notes/NoteRepositoryImplTest.kt | 7 ++-- .../users/UserRepositoryImplTest.kt | 2 +- simplenotes-search/pom.xml | 6 +-- .../{ => be/simplenotes/search}/Constants.kt | 0 .../{ => be/simplenotes/search}/Extractors.kt | 0 .../simplenotes/search}/FieldConverters.kt | 0 .../{ => be/simplenotes/search}/LuceneDsl.kt | 10 ++--- .../simplenotes/search}/NoteSearcherImpl.kt | 4 +- .../simplenotes/search}/SeachModule.kt | 1 - .../be/simplenotes}/search/SearchUseCase.kt | 2 +- .../simplenotes/search}/utils/PathUtils.kt | 0 .../src/main/kotlin/module-info.java | 10 +++++ .../search}/NoteSearcherImplTest.kt | 1 - .../search}/TagsFieldConverterTest.kt | 0 .../kotlin/{ => be/simplenotes/types}/Note.kt | 0 .../kotlin/{ => be/simplenotes/types}/User.kt | 0 .../src/main/kotlin/module-info.java | 6 +++ 116 files changed, 242 insertions(+), 87 deletions(-) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/Config.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/Server.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/SimpleNotes.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/api/ApiNoteController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/api/ApiUserController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/controllers/BaseController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/controllers/HealthCheckController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/controllers/NoteController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/controllers/SettingsController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/controllers/UserController.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/extensions/Http4kExtensions.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/extensions/KoinExtensions.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/extensions/KotlinxHtmlExtensions.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/filters/AuthFilter.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/filters/ErrorFilter.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/filters/ImmutableFilter.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/filters/SecurityFilter.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/filters/TransactionFilter.kt (100%) create mode 100644 simplenotes-app/src/main/kotlin/be/simplenotes/app/jetty/Jetty.kt rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/modules/ApiModule.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/modules/ConfigModule.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/modules/CoreModules.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/modules/JsonModule.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/modules/ServerModule.kt (96%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/routes/Router.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/serialization/LocaleDateTimeSerializer.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/serialization/UuidSerializer.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/utils/PrettyDate.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/utils/SearchTermsParser.kt (95%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/utils/StaticFilesResolver.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/BaseView.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/ErrorView.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/NoteView.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/SettingView.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/UserView.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/View.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/Alerts.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/DeletedNoteTable.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/Forms.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/Navbar.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/NoteListHeader.kt (100%) rename simplenotes-app/src/main/kotlin/{ => be/simplenotes/app}/views/components/NoteTable.kt (100%) create mode 100644 simplenotes-app/src/main/kotlin/module-info.java delete mode 100644 simplenotes-app/src/test/kotlin/Empty.kt rename simplenotes-app/src/test/kotlin/{ => be/simplenotes/app}/filters/AuthFilterTest.kt (100%) rename simplenotes-app/src/test/kotlin/{ => be/simplenotes/app}/utils/SearchTermsParserKtTest.kt (97%) rename simplenotes-config/src/main/kotlin/{ => be/simplenotes/config}/Config.kt (100%) create mode 100644 simplenotes-config/src/main/kotlin/module-info.java rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/DomainModule.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/security/HtmlSanitizer.kt (95%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/security/JwtPayload.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/security/PasswordHash.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/security/SimpleJwt.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/NoteService.kt (93%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/UserService.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/export/ExportUseCase.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/export/ExportUseCaseImpl.kt (96%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/markdown/MarkdownConverter.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/delete/DeleteUseCaseImpl.kt (89%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/delete/DeleteUsecase.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/login/LoginUseCaseImpl.kt (93%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/login/LoginUsecase.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/register/RegisterUseCaseImpl.kt (92%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/usecases/users/register/RegisterUsecase.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/validation/NoteValidations.kt (100%) rename simplenotes-domain/src/main/kotlin/{ => be/simplenotes/domain}/validation/UserValidations.kt (100%) create mode 100644 simplenotes-domain/src/main/kotlin/module-info.java delete mode 100644 simplenotes-domain/src/test/kotlin/Empty.kt rename simplenotes-domain/src/test/kotlin/{ => be/simplenotes/domain}/security/JwtPayloadExtractorTest.kt (100%) rename simplenotes-domain/src/test/kotlin/{ => be/simplenotes/domain}/testutils/ArrowAssertions.kt (100%) rename simplenotes-domain/src/test/kotlin/{ => be/simplenotes/domain}/usecases/users/login/LoginUseCaseImplTest.kt (97%) rename simplenotes-domain/src/test/kotlin/{ => be/simplenotes/domain}/usecases/users/register/RegisterUseCaseImplTest.kt (96%) rename simplenotes-domain/src/test/kotlin/{ => be/simplenotes/domain}/validation/UserValidationsTest.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/HealthCheck.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/Migrations.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/PersistanceModule.kt (80%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/converters/NoteConverter.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/converters/UserConverter.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/extensions/KtormExtensions.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/notes/NoteRepositoryImpl.kt (99%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/notes/Notes.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/notes/Tags.kt (100%) rename {simplenotes-domain/src/main/kotlin/usecases => simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance}/repositories/NoteRepository.kt (95%) rename {simplenotes-domain/src/main/kotlin/usecases => simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance}/repositories/UserRepository.kt (87%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/users/UserRepositoryImpl.kt (95%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/users/Users.kt (100%) rename simplenotes-persistance/src/main/kotlin/{ => be/simplenotes/persistance}/utils/DataSourceConfigUtils.kt (100%) create mode 100644 simplenotes-persistance/src/main/kotlin/module-info.java delete mode 100644 simplenotes-persistance/src/test/kotlin/Empty.kt rename simplenotes-persistance/src/test/kotlin/{ => be/simplenotes/persistance}/converters/NoteConverterTest.kt (100%) rename simplenotes-persistance/src/test/kotlin/{ => be/simplenotes/persistance}/converters/UserConverterTest.kt (100%) rename simplenotes-persistance/src/test/kotlin/{ => be/simplenotes/persistance}/notes/NoteRepositoryImplTest.kt (98%) rename simplenotes-persistance/src/test/kotlin/{ => be/simplenotes/persistance}/users/UserRepositoryImplTest.kt (98%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/Constants.kt (100%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/Extractors.kt (100%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/FieldConverters.kt (100%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/LuceneDsl.kt (77%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/NoteSearcherImpl.kt (93%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/SeachModule.kt (75%) rename {simplenotes-domain/src/main/kotlin/usecases => simplenotes-search/src/main/kotlin/be/simplenotes}/search/SearchUseCase.kt (92%) rename simplenotes-search/src/main/kotlin/{ => be/simplenotes/search}/utils/PathUtils.kt (100%) create mode 100644 simplenotes-search/src/main/kotlin/module-info.java rename simplenotes-search/src/test/kotlin/{ => be/simplenotes/search}/NoteSearcherImplTest.kt (98%) rename simplenotes-search/src/test/kotlin/{ => be/simplenotes/search}/TagsFieldConverterTest.kt (100%) rename simplenotes-types/src/main/kotlin/{ => be/simplenotes/types}/Note.kt (100%) rename simplenotes-types/src/main/kotlin/{ => be/simplenotes/types}/User.kt (100%) create mode 100644 simplenotes-types/src/main/kotlin/module-info.java diff --git a/Dockerfile b/Dockerfile index 9f26464..1f5c8ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,19 +4,23 @@ WORKDIR /tmp # Cache dependencies COPY pom.xml . -COPY app/pom.xml app/pom.xml -COPY domain/pom.xml domain/pom.xml -COPY persistance/pom.xml persistance/pom.xml -COPY shared/pom.xml shared/pom.xml -COPY search/pom.xml search/pom.xml +COPY simplenotes-test-resources/pom.xml simplenotes-test-resources/pom.xml +COPY simplenotes-types/pom.xml simplenotes-types/pom.xml +COPY simplenotes-config/pom.xml simplenotes-config/pom.xml +COPY simplenotes-persistance/pom.xml simplenotes-persistance/pom.xml +COPY simplenotes-search/pom.xml simplenotes-search/pom.xml +COPY simplenotes-domain/pom.xml simplenotes-domain/pom.xml +COPY simplenotes-app/pom.xml simplenotes-app/pom.xml RUN mvn verify clean --fail-never -COPY app/src app/src -COPY domain/src domain/src -COPY persistance/src persistance/src -COPY shared/src shared/src -COPY search/src search/src +COPY simplenotes-test-resources/src simplenotes-test-resources/src +COPY simplenotes-types/src simplenotes-types/src +COPY simplenotes-config/src simplenotes-config/src +COPY simplenotes-persistance/src simplenotes-persistance/src +COPY simplenotes-search/src simplenotes-search/src +COPY simplenotes-domain/src simplenotes-domain/src +COPY simplenotes-app/src simplenotes-app/src RUN mvn -Dstyle.color=always package @@ -42,8 +46,8 @@ RUN chown -R $APPLICATION_USER /app USER $APPLICATION_USER -COPY --from=builder /tmp/app/target/app-*.jar /app/app.jar +COPY --from=builder /tmp/simplenotes-app/target/simplenotes-app-*.jar /app/simplenotes.jar COPY --from=jdkbuilder /myjdk /myjdk WORKDIR /app -CMD ["/myjdk/bin/java", "-server", "-XX:+UnlockExperimentalVMOptions", "-Xms64m", "-Xmx256m", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "app.jar"] +CMD ["/myjdk/bin/java", "-server", "-XX:+UnlockExperimentalVMOptions", "-Xms64m", "-Xmx256m", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "simplenotes.jar"] diff --git a/css/package.json b/css/package.json index 200eea4..62b51dc 100644 --- a/css/package.json +++ b/css/package.json @@ -2,8 +2,8 @@ "name": "css", "version": "1.0.0", "scripts": { - "css": "NODE_ENV=dev MANIFEST=../app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../app/src/main/resources/static/styles.css", - "css-purge": "NODE_ENV=production MANIFEST=../app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../app/src/main/resources/static/styles.css" + "css": "NODE_ENV=dev MANIFEST=../simplenotes-app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../simplenotes-app/src/main/resources/static/styles.css", + "css-purge": "NODE_ENV=production MANIFEST=../simplenotes-app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../simplenotes-app/src/main/resources/static/styles.css" }, "dependencies": { "autoprefixer": "^9.8.6", diff --git a/css/tailwind.config.js b/css/tailwind.config.js index 5e25447..89b9bb2 100644 --- a/css/tailwind.config.js +++ b/css/tailwind.config.js @@ -1,7 +1,7 @@ module.exports = { purge: { content: [ - '../app/src/main/kotlin/views/**/*.kt' + '../simplenotes-app/src/main/kotlin/be/simplenotes/app/views/**/*.kt' ] }, theme: { diff --git a/deploy-docker-hub.sh b/deploy-docker-hub.sh index 1778647..ed7be34 100755 --- a/deploy-docker-hub.sh +++ b/deploy-docker-hub.sh @@ -1,7 +1,7 @@ #!/bin/sh -rm app/src/main/resources/css-manifest.json -rm app/src/main/resources/static/styles* +rm simplenotes-app/src/main/resources/css-manifest.json +rm simplenotes-app/src/main/resources/static/styles* yarn --cwd css run css-purge \ && docker build -t hubv/simplenotes:latest . \ diff --git a/pom.xml b/pom.xml index 26d5aec..b2ec063 100644 --- a/pom.xml +++ b/pom.xml @@ -181,7 +181,7 @@ io.arrow-kt arrow-core - 0.10.5 + 0.11.0 org.slf4j diff --git a/simplenotes-app/pom.xml b/simplenotes-app/pom.xml index 74f8635..29e7a4d 100644 --- a/simplenotes-app/pom.xml +++ b/simplenotes-app/pom.xml @@ -39,16 +39,32 @@ org.http4k http4k-core + + + + org.eclipse.jetty + jetty-server + 9.4.32.v20200930 + compile + + + org.eclipse.jetty + jetty-servlet + 9.4.32.v20200930 + compile + + + javax.servlet + javax.servlet-api + 4.0.1 + compile + + org.jetbrains.kotlinx kotlinx-html-jvm diff --git a/simplenotes-app/src/main/kotlin/Config.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/Config.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/Config.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/Config.kt diff --git a/simplenotes-app/src/main/kotlin/Server.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/Server.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/Server.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/Server.kt diff --git a/simplenotes-app/src/main/kotlin/SimpleNotes.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/SimpleNotes.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/SimpleNotes.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/SimpleNotes.kt diff --git a/simplenotes-app/src/main/kotlin/api/ApiNoteController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/api/ApiNoteController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/api/ApiNoteController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/api/ApiNoteController.kt diff --git a/simplenotes-app/src/main/kotlin/api/ApiUserController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/api/ApiUserController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/api/ApiUserController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/api/ApiUserController.kt diff --git a/simplenotes-app/src/main/kotlin/controllers/BaseController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/BaseController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/controllers/BaseController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/BaseController.kt diff --git a/simplenotes-app/src/main/kotlin/controllers/HealthCheckController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/HealthCheckController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/controllers/HealthCheckController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/HealthCheckController.kt diff --git a/simplenotes-app/src/main/kotlin/controllers/NoteController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/NoteController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/controllers/NoteController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/NoteController.kt diff --git a/simplenotes-app/src/main/kotlin/controllers/SettingsController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/SettingsController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/controllers/SettingsController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/SettingsController.kt diff --git a/simplenotes-app/src/main/kotlin/controllers/UserController.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/UserController.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/controllers/UserController.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/controllers/UserController.kt diff --git a/simplenotes-app/src/main/kotlin/extensions/Http4kExtensions.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/Http4kExtensions.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/extensions/Http4kExtensions.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/Http4kExtensions.kt diff --git a/simplenotes-app/src/main/kotlin/extensions/KoinExtensions.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/KoinExtensions.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/extensions/KoinExtensions.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/KoinExtensions.kt diff --git a/simplenotes-app/src/main/kotlin/extensions/KotlinxHtmlExtensions.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/KotlinxHtmlExtensions.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/extensions/KotlinxHtmlExtensions.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/extensions/KotlinxHtmlExtensions.kt diff --git a/simplenotes-app/src/main/kotlin/filters/AuthFilter.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/AuthFilter.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/filters/AuthFilter.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/AuthFilter.kt diff --git a/simplenotes-app/src/main/kotlin/filters/ErrorFilter.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/ErrorFilter.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/filters/ErrorFilter.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/ErrorFilter.kt diff --git a/simplenotes-app/src/main/kotlin/filters/ImmutableFilter.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/ImmutableFilter.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/filters/ImmutableFilter.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/ImmutableFilter.kt diff --git a/simplenotes-app/src/main/kotlin/filters/SecurityFilter.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/SecurityFilter.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/filters/SecurityFilter.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/SecurityFilter.kt diff --git a/simplenotes-app/src/main/kotlin/filters/TransactionFilter.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/TransactionFilter.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/filters/TransactionFilter.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/filters/TransactionFilter.kt diff --git a/simplenotes-app/src/main/kotlin/be/simplenotes/app/jetty/Jetty.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/jetty/Jetty.kt new file mode 100644 index 0000000..644ebec --- /dev/null +++ b/simplenotes-app/src/main/kotlin/be/simplenotes/app/jetty/Jetty.kt @@ -0,0 +1,40 @@ +package be.simplenotes.app.jetty + +import org.eclipse.jetty.server.Server +import org.eclipse.jetty.server.ServerConnector +import org.eclipse.jetty.servlet.ServletContextHandler +import org.eclipse.jetty.servlet.ServletContextHandler.SESSIONS +import org.eclipse.jetty.servlet.ServletHolder +import org.http4k.core.HttpHandler +import org.http4k.server.Http4kServer +import org.http4k.server.ServerConfig +import org.http4k.servlet.asServlet + +class Jetty(private val port: Int, private val server: Server) : ServerConfig { + constructor(port: Int = 8000) : this(port, http(port)) + constructor(port: Int, vararg inConnectors: ConnectorBuilder) : this(port, Server().apply { + inConnectors.forEach { addConnector(it(this)) } + }) + + override fun toServer(httpHandler: HttpHandler): Http4kServer { + server.insertHandler(httpHandler.toJettyHandler()) + + return object : Http4kServer { + override fun start(): Http4kServer = apply { + server.start() + } + + override fun stop(): Http4kServer = apply { server.stop() } + + override fun port(): Int = if (port > 0) port else server.uri.port + } + } +} + +fun HttpHandler.toJettyHandler() = ServletContextHandler(SESSIONS).apply { + addServlet(ServletHolder(this@toJettyHandler.asServlet()), "/*") +} + +typealias ConnectorBuilder = (Server) -> ServerConnector + +fun http(httpPort: Int): ConnectorBuilder = { server: Server -> ServerConnector(server).apply { port = httpPort } } diff --git a/simplenotes-app/src/main/kotlin/modules/ApiModule.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ApiModule.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/modules/ApiModule.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ApiModule.kt diff --git a/simplenotes-app/src/main/kotlin/modules/ConfigModule.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ConfigModule.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/modules/ConfigModule.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ConfigModule.kt diff --git a/simplenotes-app/src/main/kotlin/modules/CoreModules.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/CoreModules.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/modules/CoreModules.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/CoreModules.kt diff --git a/simplenotes-app/src/main/kotlin/modules/JsonModule.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/JsonModule.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/modules/JsonModule.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/JsonModule.kt diff --git a/simplenotes-app/src/main/kotlin/modules/ServerModule.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ServerModule.kt similarity index 96% rename from simplenotes-app/src/main/kotlin/modules/ServerModule.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ServerModule.kt index b1e6f1f..421fa9f 100644 --- a/simplenotes-app/src/main/kotlin/modules/ServerModule.kt +++ b/simplenotes-app/src/main/kotlin/be/simplenotes/app/modules/ServerModule.kt @@ -5,6 +5,8 @@ import be.simplenotes.app.filters.AuthFilter import be.simplenotes.app.filters.AuthType import be.simplenotes.app.filters.ErrorFilter import be.simplenotes.app.filters.TransactionFilter +import be.simplenotes.app.jetty.ConnectorBuilder +import be.simplenotes.app.jetty.Jetty import be.simplenotes.app.routes.Router import be.simplenotes.app.utils.StaticFileResolver import be.simplenotes.app.utils.StaticFileResolverImpl @@ -14,8 +16,6 @@ import org.eclipse.jetty.server.ServerConnector import org.http4k.core.Filter import org.http4k.core.RequestContexts import org.http4k.routing.RoutingHttpHandler -import org.http4k.server.ConnectorBuilder -import org.http4k.server.Jetty import org.http4k.server.asServer import org.koin.core.qualifier.named import org.koin.core.qualifier.qualifier diff --git a/simplenotes-app/src/main/kotlin/routes/Router.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/routes/Router.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/routes/Router.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/routes/Router.kt diff --git a/simplenotes-app/src/main/kotlin/serialization/LocaleDateTimeSerializer.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/serialization/LocaleDateTimeSerializer.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/serialization/LocaleDateTimeSerializer.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/serialization/LocaleDateTimeSerializer.kt diff --git a/simplenotes-app/src/main/kotlin/serialization/UuidSerializer.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/serialization/UuidSerializer.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/serialization/UuidSerializer.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/serialization/UuidSerializer.kt diff --git a/simplenotes-app/src/main/kotlin/utils/PrettyDate.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/PrettyDate.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/utils/PrettyDate.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/PrettyDate.kt diff --git a/simplenotes-app/src/main/kotlin/utils/SearchTermsParser.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/SearchTermsParser.kt similarity index 95% rename from simplenotes-app/src/main/kotlin/utils/SearchTermsParser.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/SearchTermsParser.kt index 3cd38aa..3e2a0aa 100644 --- a/simplenotes-app/src/main/kotlin/utils/SearchTermsParser.kt +++ b/simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/SearchTermsParser.kt @@ -1,6 +1,6 @@ package be.simplenotes.app.utils -import be.simplenotes.domain.usecases.search.SearchTerms +import be.simplenotes.search.SearchTerms private fun innerRegex(name: String) = """$name:['"](.*?)['"]""".toRegex() diff --git a/simplenotes-app/src/main/kotlin/utils/StaticFilesResolver.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/StaticFilesResolver.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/utils/StaticFilesResolver.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/utils/StaticFilesResolver.kt diff --git a/simplenotes-app/src/main/kotlin/views/BaseView.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/BaseView.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/BaseView.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/BaseView.kt diff --git a/simplenotes-app/src/main/kotlin/views/ErrorView.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/ErrorView.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/ErrorView.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/ErrorView.kt diff --git a/simplenotes-app/src/main/kotlin/views/NoteView.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/NoteView.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/NoteView.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/NoteView.kt diff --git a/simplenotes-app/src/main/kotlin/views/SettingView.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/SettingView.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/SettingView.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/SettingView.kt diff --git a/simplenotes-app/src/main/kotlin/views/UserView.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/UserView.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/UserView.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/UserView.kt diff --git a/simplenotes-app/src/main/kotlin/views/View.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/View.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/View.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/View.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/Alerts.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Alerts.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/Alerts.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Alerts.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/DeletedNoteTable.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/DeletedNoteTable.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/DeletedNoteTable.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/DeletedNoteTable.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/Forms.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Forms.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/Forms.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Forms.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/Navbar.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Navbar.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/Navbar.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/Navbar.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/NoteListHeader.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/NoteListHeader.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/NoteListHeader.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/NoteListHeader.kt diff --git a/simplenotes-app/src/main/kotlin/views/components/NoteTable.kt b/simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/NoteTable.kt similarity index 100% rename from simplenotes-app/src/main/kotlin/views/components/NoteTable.kt rename to simplenotes-app/src/main/kotlin/be/simplenotes/app/views/components/NoteTable.kt diff --git a/simplenotes-app/src/main/kotlin/module-info.java b/simplenotes-app/src/main/kotlin/module-info.java new file mode 100644 index 0000000..a55f4ef --- /dev/null +++ b/simplenotes-app/src/main/kotlin/module-info.java @@ -0,0 +1,25 @@ +module simplenotes.app { + requires java.sql; + requires kotlin.stdlib; + + requires simplenotes.config; + requires simplenotes.persistance; + requires simplenotes.domain; + requires simplenotes.search; + requires simplenotes.types; + + requires http4k.core; + requires org.eclipse.jetty.server; + requires org.eclipse.jetty.servlet; + requires org.eclipse.jetty.util; + + requires slf4j.api; + requires koin.core; + requires arrow.module; + requires kotlinx.html.jvm; + requires kotlinx.serialization.core.jvm; + requires kotlinx.serialization.json.jvm; + requires konform.jvm; + requires prettytime; + requires ktorm.core; +} diff --git a/simplenotes-app/src/test/kotlin/Empty.kt b/simplenotes-app/src/test/kotlin/Empty.kt deleted file mode 100644 index 59900e4..0000000 --- a/simplenotes-app/src/test/kotlin/Empty.kt +++ /dev/null @@ -1 +0,0 @@ -package be.simplenotes.app diff --git a/simplenotes-app/src/test/kotlin/filters/AuthFilterTest.kt b/simplenotes-app/src/test/kotlin/be/simplenotes/app/filters/AuthFilterTest.kt similarity index 100% rename from simplenotes-app/src/test/kotlin/filters/AuthFilterTest.kt rename to simplenotes-app/src/test/kotlin/be/simplenotes/app/filters/AuthFilterTest.kt diff --git a/simplenotes-app/src/test/kotlin/utils/SearchTermsParserKtTest.kt b/simplenotes-app/src/test/kotlin/be/simplenotes/app/utils/SearchTermsParserKtTest.kt similarity index 97% rename from simplenotes-app/src/test/kotlin/utils/SearchTermsParserKtTest.kt rename to simplenotes-app/src/test/kotlin/be/simplenotes/app/utils/SearchTermsParserKtTest.kt index 69e6acd..8a22d2d 100644 --- a/simplenotes-app/src/test/kotlin/utils/SearchTermsParserKtTest.kt +++ b/simplenotes-app/src/test/kotlin/be/simplenotes/app/utils/SearchTermsParserKtTest.kt @@ -1,6 +1,6 @@ package be.simplenotes.app.utils -import be.simplenotes.domain.usecases.search.SearchTerms +import be.simplenotes.search.SearchTerms import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource diff --git a/simplenotes-config/src/main/kotlin/Config.kt b/simplenotes-config/src/main/kotlin/be/simplenotes/config/Config.kt similarity index 100% rename from simplenotes-config/src/main/kotlin/Config.kt rename to simplenotes-config/src/main/kotlin/be/simplenotes/config/Config.kt diff --git a/simplenotes-config/src/main/kotlin/module-info.java b/simplenotes-config/src/main/kotlin/module-info.java new file mode 100644 index 0000000..12e8479 --- /dev/null +++ b/simplenotes-config/src/main/kotlin/module-info.java @@ -0,0 +1,5 @@ +module simplenotes.config { + requires kotlin.stdlib; + + exports be.simplenotes.config; +} diff --git a/simplenotes-domain/pom.xml b/simplenotes-domain/pom.xml index a8e3da4..a41855a 100644 --- a/simplenotes-domain/pom.xml +++ b/simplenotes-domain/pom.xml @@ -28,10 +28,12 @@ org.koin koin-core + io.arrow-kt arrow-core + com.natpryce hamkrest @@ -94,6 +96,18 @@ 1.0-SNAPSHOT compile + + be.simplenotes + simplenotes-persistance + 1.0-SNAPSHOT + compile + + + be.simplenotes + simplenotes-search + 1.0-SNAPSHOT + compile + diff --git a/simplenotes-domain/src/main/kotlin/DomainModule.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/DomainModule.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/DomainModule.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/DomainModule.kt diff --git a/simplenotes-domain/src/main/kotlin/security/HtmlSanitizer.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/HtmlSanitizer.kt similarity index 95% rename from simplenotes-domain/src/main/kotlin/security/HtmlSanitizer.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/HtmlSanitizer.kt index 85ec1b0..4e1b87d 100644 --- a/simplenotes-domain/src/main/kotlin/security/HtmlSanitizer.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/HtmlSanitizer.kt @@ -2,7 +2,7 @@ package be.simplenotes.domain.security import org.owasp.html.HtmlPolicyBuilder -object HtmlSanitizer { +internal object HtmlSanitizer { private val htmlPolicy = HtmlPolicyBuilder() .allowElements("a") .allowCommonBlockElements() diff --git a/simplenotes-domain/src/main/kotlin/security/JwtPayload.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/JwtPayload.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/security/JwtPayload.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/JwtPayload.kt diff --git a/simplenotes-domain/src/main/kotlin/security/PasswordHash.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/PasswordHash.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/security/PasswordHash.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/PasswordHash.kt diff --git a/simplenotes-domain/src/main/kotlin/security/SimpleJwt.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/SimpleJwt.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/security/SimpleJwt.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/security/SimpleJwt.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/NoteService.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/NoteService.kt similarity index 93% rename from simplenotes-domain/src/main/kotlin/usecases/NoteService.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/NoteService.kt index 8f7c70e..498768d 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/NoteService.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/NoteService.kt @@ -8,10 +8,10 @@ import be.simplenotes.types.PersistedNoteMetadata import be.simplenotes.domain.security.HtmlSanitizer import be.simplenotes.domain.usecases.markdown.MarkdownConverter import be.simplenotes.domain.usecases.markdown.MarkdownParsingError -import be.simplenotes.domain.usecases.repositories.NoteRepository -import be.simplenotes.domain.usecases.repositories.UserRepository -import be.simplenotes.domain.usecases.search.NoteSearcher -import be.simplenotes.domain.usecases.search.SearchTerms +import be.simplenotes.persistance.repositories.NoteRepository +import be.simplenotes.persistance.repositories.UserRepository +import be.simplenotes.search.NoteSearcher +import be.simplenotes.search.SearchTerms import java.util.* class NoteService( diff --git a/simplenotes-domain/src/main/kotlin/usecases/UserService.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/UserService.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/UserService.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/UserService.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/export/ExportUseCase.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/export/ExportUseCase.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/export/ExportUseCase.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/export/ExportUseCase.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/export/ExportUseCaseImpl.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/export/ExportUseCaseImpl.kt similarity index 96% rename from simplenotes-domain/src/main/kotlin/usecases/export/ExportUseCaseImpl.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/export/ExportUseCaseImpl.kt index dfd7471..2513e2c 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/export/ExportUseCaseImpl.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/export/ExportUseCaseImpl.kt @@ -1,7 +1,7 @@ package be.simplenotes.domain.usecases.export import be.simplenotes.types.ExportedNote -import be.simplenotes.domain.usecases.repositories.NoteRepository +import be.simplenotes.persistance.repositories.NoteRepository import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.Json import org.apache.commons.compress.archivers.zip.ZipArchiveEntry diff --git a/simplenotes-domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/markdown/MarkdownConverter.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/markdown/MarkdownConverter.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/delete/DeleteUseCaseImpl.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/delete/DeleteUseCaseImpl.kt similarity index 89% rename from simplenotes-domain/src/main/kotlin/usecases/users/delete/DeleteUseCaseImpl.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/delete/DeleteUseCaseImpl.kt index 12c26e2..037f4d4 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/users/delete/DeleteUseCaseImpl.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/delete/DeleteUseCaseImpl.kt @@ -4,9 +4,9 @@ import arrow.core.Either import arrow.core.extensions.fx import arrow.core.rightIfNotNull import be.simplenotes.domain.security.PasswordHash -import be.simplenotes.domain.usecases.repositories.UserRepository -import be.simplenotes.domain.usecases.search.NoteSearcher +import be.simplenotes.persistance.repositories.UserRepository import be.simplenotes.domain.validation.UserValidations +import be.simplenotes.search.NoteSearcher internal class DeleteUseCaseImpl( private val userRepository: UserRepository, diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/delete/DeleteUsecase.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/delete/DeleteUsecase.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/users/delete/DeleteUsecase.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/delete/DeleteUsecase.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/login/LoginUseCaseImpl.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImpl.kt similarity index 93% rename from simplenotes-domain/src/main/kotlin/usecases/users/login/LoginUseCaseImpl.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImpl.kt index 268d125..cfef653 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/users/login/LoginUseCaseImpl.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImpl.kt @@ -7,8 +7,8 @@ import arrow.core.rightIfNotNull import be.simplenotes.domain.security.JwtPayload import be.simplenotes.domain.security.PasswordHash import be.simplenotes.domain.security.SimpleJwt -import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.domain.validation.UserValidations +import be.simplenotes.persistance.repositories.UserRepository internal class LoginUseCaseImpl( private val userRepository: UserRepository, diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/login/LoginUsecase.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/login/LoginUsecase.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/users/login/LoginUsecase.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/login/LoginUsecase.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/register/RegisterUseCaseImpl.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImpl.kt similarity index 92% rename from simplenotes-domain/src/main/kotlin/usecases/users/register/RegisterUseCaseImpl.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImpl.kt index eb16064..11e2139 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/users/register/RegisterUseCaseImpl.kt +++ b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImpl.kt @@ -5,8 +5,8 @@ import arrow.core.filterOrElse import arrow.core.leftIfNull import be.simplenotes.types.PersistedUser import be.simplenotes.domain.security.PasswordHash -import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.domain.validation.UserValidations +import be.simplenotes.persistance.repositories.UserRepository internal class RegisterUseCaseImpl( private val userRepository: UserRepository, diff --git a/simplenotes-domain/src/main/kotlin/usecases/users/register/RegisterUsecase.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUsecase.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/usecases/users/register/RegisterUsecase.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUsecase.kt diff --git a/simplenotes-domain/src/main/kotlin/validation/NoteValidations.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/validation/NoteValidations.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/validation/NoteValidations.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/validation/NoteValidations.kt diff --git a/simplenotes-domain/src/main/kotlin/validation/UserValidations.kt b/simplenotes-domain/src/main/kotlin/be/simplenotes/domain/validation/UserValidations.kt similarity index 100% rename from simplenotes-domain/src/main/kotlin/validation/UserValidations.kt rename to simplenotes-domain/src/main/kotlin/be/simplenotes/domain/validation/UserValidations.kt diff --git a/simplenotes-domain/src/main/kotlin/module-info.java b/simplenotes-domain/src/main/kotlin/module-info.java new file mode 100644 index 0000000..8392e17 --- /dev/null +++ b/simplenotes-domain/src/main/kotlin/module-info.java @@ -0,0 +1,33 @@ +module simplenotes.domain { + requires kotlin.stdlib; + requires kotlin.stdlib.jdk7; + + requires simplenotes.config; + requires simplenotes.types; + requires simplenotes.persistance; + + exports be.simplenotes.domain to simplenotes.app; + exports be.simplenotes.domain.security to simplenotes.app; + exports be.simplenotes.domain.usecases to simplenotes.app; + exports be.simplenotes.domain.usecases.markdown to simplenotes.app; + exports be.simplenotes.domain.usecases.users.login to simplenotes.app; + exports be.simplenotes.domain.usecases.users.delete to simplenotes.app; + exports be.simplenotes.domain.usecases.users.register to simplenotes.app; + + requires arrow.module; + + requires flexmark; + requires flexmark.util.data; + requires flexmark.ext.gfm.tasklist; + + requires koin.core; + requires konform.jvm; + requires org.yaml.snakeyaml; + requires java.jwt; + requires kotlinx.serialization.core.jvm; + requires org.apache.commons.compress; + requires kotlinx.serialization.json.jvm; + requires owasp.java.html.sanitizer; + requires jbcrypt; + requires simplenotes.search; +} diff --git a/simplenotes-domain/src/test/kotlin/Empty.kt b/simplenotes-domain/src/test/kotlin/Empty.kt deleted file mode 100644 index 8c13eef..0000000 --- a/simplenotes-domain/src/test/kotlin/Empty.kt +++ /dev/null @@ -1,5 +0,0 @@ -package be.simplenotes.domain - -/** - * Empty file @see [root-package-declaration](https://discuss.kotlinlang.org/t/root-package-declaration-to-reduce-folder-clutter/2247/4) - */ diff --git a/simplenotes-domain/src/test/kotlin/security/JwtPayloadExtractorTest.kt b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/security/JwtPayloadExtractorTest.kt similarity index 100% rename from simplenotes-domain/src/test/kotlin/security/JwtPayloadExtractorTest.kt rename to simplenotes-domain/src/test/kotlin/be/simplenotes/domain/security/JwtPayloadExtractorTest.kt diff --git a/simplenotes-domain/src/test/kotlin/testutils/ArrowAssertions.kt b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/testutils/ArrowAssertions.kt similarity index 100% rename from simplenotes-domain/src/test/kotlin/testutils/ArrowAssertions.kt rename to simplenotes-domain/src/test/kotlin/be/simplenotes/domain/testutils/ArrowAssertions.kt diff --git a/simplenotes-domain/src/test/kotlin/usecases/users/login/LoginUseCaseImplTest.kt b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImplTest.kt similarity index 97% rename from simplenotes-domain/src/test/kotlin/usecases/users/login/LoginUseCaseImplTest.kt rename to simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImplTest.kt index 2228c45..e401cc3 100644 --- a/simplenotes-domain/src/test/kotlin/usecases/users/login/LoginUseCaseImplTest.kt +++ b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/login/LoginUseCaseImplTest.kt @@ -3,7 +3,7 @@ package be.simplenotes.domain.usecases.users.login import be.simplenotes.types.PersistedUser import be.simplenotes.domain.security.BcryptPasswordHash import be.simplenotes.domain.security.SimpleJwt -import be.simplenotes.domain.usecases.repositories.UserRepository +import be.simplenotes.persistance.repositories.UserRepository import be.simplenotes.config.JwtConfig import be.simplenotes.domain.testutils.isLeftOfType import be.simplenotes.domain.testutils.isRight diff --git a/simplenotes-domain/src/test/kotlin/usecases/users/register/RegisterUseCaseImplTest.kt b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImplTest.kt similarity index 96% rename from simplenotes-domain/src/test/kotlin/usecases/users/register/RegisterUseCaseImplTest.kt rename to simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImplTest.kt index 0fdeb72..6e23345 100644 --- a/simplenotes-domain/src/test/kotlin/usecases/users/register/RegisterUseCaseImplTest.kt +++ b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/usecases/users/register/RegisterUseCaseImplTest.kt @@ -4,7 +4,7 @@ import be.simplenotes.types.PersistedUser import be.simplenotes.domain.security.BcryptPasswordHash import be.simplenotes.domain.testutils.isLeftOfType import be.simplenotes.domain.testutils.isRight -import be.simplenotes.domain.usecases.repositories.UserRepository +import be.simplenotes.persistance.repositories.UserRepository import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.equalTo import io.mockk.* diff --git a/simplenotes-domain/src/test/kotlin/validation/UserValidationsTest.kt b/simplenotes-domain/src/test/kotlin/be/simplenotes/domain/validation/UserValidationsTest.kt similarity index 100% rename from simplenotes-domain/src/test/kotlin/validation/UserValidationsTest.kt rename to simplenotes-domain/src/test/kotlin/be/simplenotes/domain/validation/UserValidationsTest.kt diff --git a/simplenotes-persistance/pom.xml b/simplenotes-persistance/pom.xml index 7c0c2db..80a6a3c 100644 --- a/simplenotes-persistance/pom.xml +++ b/simplenotes-persistance/pom.xml @@ -15,11 +15,6 @@ org.mapstruct mapstruct - - be.simplenotes - simplenotes-domain - 1.0-SNAPSHOT - be.simplenotes simplenotes-types @@ -69,11 +64,13 @@ flyway-core 6.5.4 + com.zaxxer HikariCP - 3.4.5 + 3.4.3 + me.liuwj.ktorm ktorm-core diff --git a/simplenotes-persistance/src/main/kotlin/HealthCheck.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/HealthCheck.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/HealthCheck.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/HealthCheck.kt diff --git a/simplenotes-persistance/src/main/kotlin/Migrations.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/Migrations.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/Migrations.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/Migrations.kt diff --git a/simplenotes-persistance/src/main/kotlin/PersistanceModule.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/PersistanceModule.kt similarity index 80% rename from simplenotes-persistance/src/main/kotlin/PersistanceModule.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/PersistanceModule.kt index 9cbdddc..3238e4a 100644 --- a/simplenotes-persistance/src/main/kotlin/PersistanceModule.kt +++ b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/PersistanceModule.kt @@ -1,19 +1,20 @@ 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.UserConverter -import be.simplenotes.persistance.notes.NoteRepositoryImpl -import be.simplenotes.persistance.users.UserRepositoryImpl import be.simplenotes.config.DataSourceConfig +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.repositories.NoteRepository +import be.simplenotes.persistance.repositories.UserRepository +import be.simplenotes.persistance.users.UserRepositoryImpl import com.zaxxer.hikari.HikariConfig import com.zaxxer.hikari.HikariDataSource 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 { @@ -33,8 +34,8 @@ val migrationModule = module { } val persistanceModule = module { - single { Mappers.getMapper(NoteConverter::class.java) } - single { Mappers.getMapper(UserConverter::class.java) } + single { NoteConverterImpl() } + single { UserConverterImpl() } single { UserRepositoryImpl(get(), get()) } single { NoteRepositoryImpl(get(), get()) } single { hikariDataSource(get()) } bind DataSource::class onClose { it?.close() } diff --git a/simplenotes-persistance/src/main/kotlin/converters/NoteConverter.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/converters/NoteConverter.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/converters/NoteConverter.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/converters/NoteConverter.kt diff --git a/simplenotes-persistance/src/main/kotlin/converters/UserConverter.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/converters/UserConverter.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/converters/UserConverter.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/converters/UserConverter.kt diff --git a/simplenotes-persistance/src/main/kotlin/extensions/KtormExtensions.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/extensions/KtormExtensions.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/extensions/KtormExtensions.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/extensions/KtormExtensions.kt diff --git a/simplenotes-persistance/src/main/kotlin/notes/NoteRepositoryImpl.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImpl.kt similarity index 99% rename from simplenotes-persistance/src/main/kotlin/notes/NoteRepositoryImpl.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImpl.kt index f2cc46d..c2297e4 100644 --- a/simplenotes-persistance/src/main/kotlin/notes/NoteRepositoryImpl.kt +++ b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImpl.kt @@ -4,8 +4,8 @@ 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 be.simplenotes.persistance.repositories.NoteRepository import me.liuwj.ktorm.database.Database import me.liuwj.ktorm.dsl.* import me.liuwj.ktorm.entity.* diff --git a/simplenotes-persistance/src/main/kotlin/notes/Notes.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/Notes.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/notes/Notes.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/Notes.kt diff --git a/simplenotes-persistance/src/main/kotlin/notes/Tags.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/Tags.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/notes/Tags.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/notes/Tags.kt diff --git a/simplenotes-domain/src/main/kotlin/usecases/repositories/NoteRepository.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/NoteRepository.kt similarity index 95% rename from simplenotes-domain/src/main/kotlin/usecases/repositories/NoteRepository.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/NoteRepository.kt index e2c7b68..a4edeac 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/repositories/NoteRepository.kt +++ b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/NoteRepository.kt @@ -1,4 +1,4 @@ -package be.simplenotes.domain.usecases.repositories +package be.simplenotes.persistance.repositories import be.simplenotes.types.ExportedNote import be.simplenotes.types.Note diff --git a/simplenotes-domain/src/main/kotlin/usecases/repositories/UserRepository.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/UserRepository.kt similarity index 87% rename from simplenotes-domain/src/main/kotlin/usecases/repositories/UserRepository.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/UserRepository.kt index a4def8f..f0abf52 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/repositories/UserRepository.kt +++ b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/repositories/UserRepository.kt @@ -1,4 +1,4 @@ -package be.simplenotes.domain.usecases.repositories +package be.simplenotes.persistance.repositories import be.simplenotes.types.PersistedUser import be.simplenotes.types.User diff --git a/simplenotes-persistance/src/main/kotlin/users/UserRepositoryImpl.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/users/UserRepositoryImpl.kt similarity index 95% rename from simplenotes-persistance/src/main/kotlin/users/UserRepositoryImpl.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/users/UserRepositoryImpl.kt index 1a33f57..b99c830 100644 --- a/simplenotes-persistance/src/main/kotlin/users/UserRepositoryImpl.kt +++ b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/users/UserRepositoryImpl.kt @@ -2,8 +2,8 @@ package be.simplenotes.persistance.users import be.simplenotes.types.PersistedUser import be.simplenotes.types.User -import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.persistance.converters.UserConverter +import be.simplenotes.persistance.repositories.UserRepository import me.liuwj.ktorm.database.Database import me.liuwj.ktorm.dsl.* import me.liuwj.ktorm.entity.any diff --git a/simplenotes-persistance/src/main/kotlin/users/Users.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/users/Users.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/users/Users.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/users/Users.kt diff --git a/simplenotes-persistance/src/main/kotlin/utils/DataSourceConfigUtils.kt b/simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/utils/DataSourceConfigUtils.kt similarity index 100% rename from simplenotes-persistance/src/main/kotlin/utils/DataSourceConfigUtils.kt rename to simplenotes-persistance/src/main/kotlin/be/simplenotes/persistance/utils/DataSourceConfigUtils.kt diff --git a/simplenotes-persistance/src/main/kotlin/module-info.java b/simplenotes-persistance/src/main/kotlin/module-info.java new file mode 100644 index 0000000..da397b3 --- /dev/null +++ b/simplenotes-persistance/src/main/kotlin/module-info.java @@ -0,0 +1,18 @@ +module simplenotes.persistance { + requires kotlin.stdlib; + + exports be.simplenotes.persistance to simplenotes.app; + exports be.simplenotes.persistance.repositories to simplenotes.domain; + + requires simplenotes.types; + + requires ktorm.core; + requires java.sql; + requires simplenotes.config; + requires kotlin.stdlib.jdk7; + requires java.compiler; + requires org.mapstruct; + requires org.flywaydb.core; + requires com.zaxxer.hikari; + requires koin.core; +} diff --git a/simplenotes-persistance/src/test/kotlin/Empty.kt b/simplenotes-persistance/src/test/kotlin/Empty.kt deleted file mode 100644 index b98b168..0000000 --- a/simplenotes-persistance/src/test/kotlin/Empty.kt +++ /dev/null @@ -1 +0,0 @@ -package be.simplenotes.persistance diff --git a/simplenotes-persistance/src/test/kotlin/converters/NoteConverterTest.kt b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/converters/NoteConverterTest.kt similarity index 100% rename from simplenotes-persistance/src/test/kotlin/converters/NoteConverterTest.kt rename to simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/converters/NoteConverterTest.kt index 18dfc8e..1711494 100644 --- a/simplenotes-persistance/src/test/kotlin/converters/NoteConverterTest.kt +++ b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/converters/NoteConverterTest.kt @@ -1,7 +1,7 @@ package be.simplenotes.persistance.converters -import be.simplenotes.types.* import be.simplenotes.persistance.notes.NoteEntity +import be.simplenotes.types.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested diff --git a/simplenotes-persistance/src/test/kotlin/converters/UserConverterTest.kt b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/converters/UserConverterTest.kt similarity index 100% rename from simplenotes-persistance/src/test/kotlin/converters/UserConverterTest.kt rename to simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/converters/UserConverterTest.kt diff --git a/simplenotes-persistance/src/test/kotlin/notes/NoteRepositoryImplTest.kt b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImplTest.kt similarity index 98% rename from simplenotes-persistance/src/test/kotlin/notes/NoteRepositoryImplTest.kt rename to simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImplTest.kt index 31c6bbb..73198b6 100644 --- a/simplenotes-persistance/src/test/kotlin/notes/NoteRepositoryImplTest.kt +++ b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/notes/NoteRepositoryImplTest.kt @@ -1,13 +1,14 @@ package be.simplenotes.persistance.notes -import be.simplenotes.types.* -import be.simplenotes.domain.usecases.repositories.NoteRepository -import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.persistance.DbMigrations import be.simplenotes.persistance.converters.NoteConverter import be.simplenotes.persistance.migrationModule import be.simplenotes.persistance.persistanceModule import be.simplenotes.config.DataSourceConfig +import be.simplenotes.persistance.repositories.NoteRepository +import be.simplenotes.persistance.repositories.UserRepository +import be.simplenotes.types.* +import be.simplenotes.types.* import me.liuwj.ktorm.database.Database import me.liuwj.ktorm.dsl.eq import me.liuwj.ktorm.entity.filter diff --git a/simplenotes-persistance/src/test/kotlin/users/UserRepositoryImplTest.kt b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/users/UserRepositoryImplTest.kt similarity index 98% rename from simplenotes-persistance/src/test/kotlin/users/UserRepositoryImplTest.kt rename to simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/users/UserRepositoryImplTest.kt index 286eb6c..cd9909c 100644 --- a/simplenotes-persistance/src/test/kotlin/users/UserRepositoryImplTest.kt +++ b/simplenotes-persistance/src/test/kotlin/be/simplenotes/persistance/users/UserRepositoryImplTest.kt @@ -1,7 +1,7 @@ package be.simplenotes.persistance.users import be.simplenotes.types.User -import be.simplenotes.domain.usecases.repositories.UserRepository +import be.simplenotes.persistance.repositories.UserRepository import be.simplenotes.persistance.DbMigrations import be.simplenotes.persistance.migrationModule import be.simplenotes.persistance.persistanceModule diff --git a/simplenotes-search/pom.xml b/simplenotes-search/pom.xml index 1e777c3..966bce0 100644 --- a/simplenotes-search/pom.xml +++ b/simplenotes-search/pom.xml @@ -21,11 +21,7 @@ simplenotes-types 1.0-SNAPSHOT - - be.simplenotes - simplenotes-domain - 1.0-SNAPSHOT - + org.apache.lucene lucene-core diff --git a/simplenotes-search/src/main/kotlin/Constants.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/Constants.kt similarity index 100% rename from simplenotes-search/src/main/kotlin/Constants.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/Constants.kt diff --git a/simplenotes-search/src/main/kotlin/Extractors.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/Extractors.kt similarity index 100% rename from simplenotes-search/src/main/kotlin/Extractors.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/Extractors.kt diff --git a/simplenotes-search/src/main/kotlin/FieldConverters.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/FieldConverters.kt similarity index 100% rename from simplenotes-search/src/main/kotlin/FieldConverters.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/FieldConverters.kt diff --git a/simplenotes-search/src/main/kotlin/LuceneDsl.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/LuceneDsl.kt similarity index 77% rename from simplenotes-search/src/main/kotlin/LuceneDsl.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/LuceneDsl.kt index ae5c2cc..0a5827e 100644 --- a/simplenotes-search/src/main/kotlin/LuceneDsl.kt +++ b/simplenotes-search/src/main/kotlin/be/simplenotes/search/LuceneDsl.kt @@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory private val logger = LoggerFactory.getLogger("be.simplenotes.search.dsl") -fun IndexSearcher.query(receiver: LuceneDsl.() -> Unit): List { +internal fun IndexSearcher.query(receiver: LuceneDsl.() -> Unit): List { val indexSearcher = this val builder = BooleanQuery.Builder() val dsl = LuceneDsl() @@ -23,7 +23,7 @@ fun IndexSearcher.query(receiver: LuceneDsl.() -> Unit): List { return topDocs.scoreDocs.map { indexSearcher.doc(it.doc) } } -class LuceneDsl { +internal class LuceneDsl { val clauses = mutableListOf() var count: Int = 10 @@ -38,10 +38,10 @@ class LuceneDsl { } } -fun LuceneDsl.or(booleanExpression: () -> BooleanExpression) { +internal fun LuceneDsl.or(booleanExpression: () -> BooleanExpression) { addBooleanClause(booleanExpression()) } -infix fun String.eq(query: String?) = BooleanExpression(this, query) +internal infix fun String.eq(query: String?) = BooleanExpression(this, query) -data class BooleanExpression(val term: String, val query: String?) +internal data class BooleanExpression(val term: String, val query: String?) diff --git a/simplenotes-search/src/main/kotlin/NoteSearcherImpl.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/NoteSearcherImpl.kt similarity index 93% rename from simplenotes-search/src/main/kotlin/NoteSearcherImpl.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/NoteSearcherImpl.kt index 8444e5d..a0debab 100644 --- a/simplenotes-search/src/main/kotlin/NoteSearcherImpl.kt +++ b/simplenotes-search/src/main/kotlin/be/simplenotes/search/NoteSearcherImpl.kt @@ -1,8 +1,6 @@ package be.simplenotes.search import be.simplenotes.types.PersistedNote -import be.simplenotes.domain.usecases.search.NoteSearcher -import be.simplenotes.domain.usecases.search.SearchTerms import be.simplenotes.search.utils.rmdir import org.apache.lucene.analysis.standard.StandardAnalyzer import org.apache.lucene.document.Document @@ -16,7 +14,7 @@ import java.io.File import java.nio.file.Path import java.util.* -class NoteSearcherImpl(basePath: Path = Path.of("/tmp", "lucene")) : NoteSearcher { +internal class NoteSearcherImpl(basePath: Path = Path.of("/tmp", "lucene")) : NoteSearcher { private val baseFile = basePath.toFile() private val logger = LoggerFactory.getLogger(javaClass) diff --git a/simplenotes-search/src/main/kotlin/SeachModule.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/SeachModule.kt similarity index 75% rename from simplenotes-search/src/main/kotlin/SeachModule.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/SeachModule.kt index d86f399..5fd12e9 100644 --- a/simplenotes-search/src/main/kotlin/SeachModule.kt +++ b/simplenotes-search/src/main/kotlin/be/simplenotes/search/SeachModule.kt @@ -1,6 +1,5 @@ package be.simplenotes.search -import be.simplenotes.domain.usecases.search.NoteSearcher import org.koin.dsl.module import java.nio.file.Path diff --git a/simplenotes-domain/src/main/kotlin/usecases/search/SearchUseCase.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/SearchUseCase.kt similarity index 92% rename from simplenotes-domain/src/main/kotlin/usecases/search/SearchUseCase.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/SearchUseCase.kt index ed6be90..3a76f01 100644 --- a/simplenotes-domain/src/main/kotlin/usecases/search/SearchUseCase.kt +++ b/simplenotes-search/src/main/kotlin/be/simplenotes/search/SearchUseCase.kt @@ -1,4 +1,4 @@ -package be.simplenotes.domain.usecases.search +package be.simplenotes.search import be.simplenotes.types.PersistedNote import be.simplenotes.types.PersistedNoteMetadata diff --git a/simplenotes-search/src/main/kotlin/utils/PathUtils.kt b/simplenotes-search/src/main/kotlin/be/simplenotes/search/utils/PathUtils.kt similarity index 100% rename from simplenotes-search/src/main/kotlin/utils/PathUtils.kt rename to simplenotes-search/src/main/kotlin/be/simplenotes/search/utils/PathUtils.kt diff --git a/simplenotes-search/src/main/kotlin/module-info.java b/simplenotes-search/src/main/kotlin/module-info.java new file mode 100644 index 0000000..a77fcb0 --- /dev/null +++ b/simplenotes-search/src/main/kotlin/module-info.java @@ -0,0 +1,10 @@ +module simplenotes.search { + requires kotlin.stdlib; + requires simplenotes.types; + + exports be.simplenotes.search to simplenotes.app, simplenotes.domain; + + requires lucene; + requires slf4j.api; + requires koin.core; +} diff --git a/simplenotes-search/src/test/kotlin/NoteSearcherImplTest.kt b/simplenotes-search/src/test/kotlin/be/simplenotes/search/NoteSearcherImplTest.kt similarity index 98% rename from simplenotes-search/src/test/kotlin/NoteSearcherImplTest.kt rename to simplenotes-search/src/test/kotlin/be/simplenotes/search/NoteSearcherImplTest.kt index 8d67f8c..9945fd8 100644 --- a/simplenotes-search/src/test/kotlin/NoteSearcherImplTest.kt +++ b/simplenotes-search/src/test/kotlin/be/simplenotes/search/NoteSearcherImplTest.kt @@ -3,7 +3,6 @@ package be.simplenotes.search import be.simplenotes.types.NoteMetadata import be.simplenotes.types.PersistedNote import be.simplenotes.types.PersistedNoteMetadata -import be.simplenotes.domain.usecases.search.SearchTerms import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.AfterAll diff --git a/simplenotes-search/src/test/kotlin/TagsFieldConverterTest.kt b/simplenotes-search/src/test/kotlin/be/simplenotes/search/TagsFieldConverterTest.kt similarity index 100% rename from simplenotes-search/src/test/kotlin/TagsFieldConverterTest.kt rename to simplenotes-search/src/test/kotlin/be/simplenotes/search/TagsFieldConverterTest.kt diff --git a/simplenotes-types/src/main/kotlin/Note.kt b/simplenotes-types/src/main/kotlin/be/simplenotes/types/Note.kt similarity index 100% rename from simplenotes-types/src/main/kotlin/Note.kt rename to simplenotes-types/src/main/kotlin/be/simplenotes/types/Note.kt diff --git a/simplenotes-types/src/main/kotlin/User.kt b/simplenotes-types/src/main/kotlin/be/simplenotes/types/User.kt similarity index 100% rename from simplenotes-types/src/main/kotlin/User.kt rename to simplenotes-types/src/main/kotlin/be/simplenotes/types/User.kt diff --git a/simplenotes-types/src/main/kotlin/module-info.java b/simplenotes-types/src/main/kotlin/module-info.java new file mode 100644 index 0000000..8026035 --- /dev/null +++ b/simplenotes-types/src/main/kotlin/module-info.java @@ -0,0 +1,6 @@ +module simplenotes.types { + requires kotlin.stdlib; + requires kotlinx.serialization.core.jvm; + + exports be.simplenotes.types; +}