From 95dc840b965fe8f3f554f53afa6e092308baa420 Mon Sep 17 00:00:00 2001 From: Illia Kovalov Date: Sun, 21 Jul 2024 20:57:47 +0200 Subject: [PATCH] 107-comments-crud: closes #107 --- .../com.github.ikovalyov.model/Article.kt | 30 ++--- .../com.github.ikovalyov.model/Comment.kt | 23 ++-- .../markers/IEditable.kt | 7 +- .../kotlin/com/github/ikovalyov/Api.kt | 11 +- .../model/service/TemplateService.kt | 2 +- .../model/service/UserService.kt | 4 +- .../com.github.ikovalyov/routes/Index.kt | 33 ++++-- .../application/api/ArticlesController.kt | 12 +- .../application/api/CommentsController.kt | 63 +++++++++++ .../application/api/TagsController.kt | 2 +- .../application/api/TemplateController.kt | 2 +- .../application/api/UserRolesController.kt | 4 +- .../application/api/UsersApiController.kt | 2 +- ...rticleConverter.kt => ArticleConverter.kt} | 40 +------ .../dynamodb/converter/CommentConverter.kt | 27 +++++ .../repository/AbstractKeyValueRepository.kt | 5 +- .../dynamodb/repository/ArticlesRepository.kt | 50 +++++++- .../repository/ConfigurationsRepository.kt | 5 +- .../dynamodb/repository/CrudRepository.kt | 18 +-- .../dynamodb/repository/RecordsRepository.kt | 5 +- .../dynamodb/repository/TagsRepository.kt | 5 +- .../repository/TemplatesRepository.kt | 5 +- .../dynamodb/repository/UsersRepository.kt | 20 ++-- .../repository/articles/CommentsRepository.kt | 37 ++++++ .../dynamodb/repository/repositories.md | 6 + .../{ => users}/UserRolesRepository.kt | 7 +- .../infrastructure/service/UserService.kt | 2 - .../application/api/ArticlesControllerTest.kt | 107 ++++++++++++++++++ .../repository/UserRolesRepositoryTest.kt | 40 ------- 29 files changed, 401 insertions(+), 173 deletions(-) create mode 100644 src/jvmMain/kotlin/com/github/ikovalyov/application/api/CommentsController.kt rename src/jvmMain/kotlin/com/github/ikovalyov/infrastructure/dynamodb/converter/{DynamodbArticleConverter.kt => ArticleConverter.kt} (54%) create mode 100644 src/jvmMain/kotlin/com/github/ikovalyov/infrastructure/dynamodb/converter/CommentConverter.kt create mode 100644 src/jvmMain/kotlin/com/github/ikovalyov/infrastructure/dynamodb/repository/articles/CommentsRepository.kt create mode 100644 src/jvmMain/kotlin/com/github/ikovalyov/infrastructure/dynamodb/repository/repositories.md rename src/jvmMain/kotlin/com/github/ikovalyov/infrastructure/dynamodb/repository/{ => users}/UserRolesRepository.kt (92%) create mode 100644 src/jvmTest/kotlin/com/github/ikovalyov/application/api/ArticlesControllerTest.kt delete mode 100644 src/jvmTest/kotlin/com/github/ikovalyov/infrastructure/dynamodb/repository/UserRolesRepositoryTest.kt diff --git a/src/commonMain/kotlin/com.github.ikovalyov.model/Article.kt b/src/commonMain/kotlin/com.github.ikovalyov.model/Article.kt index f7929761..5a205245 100644 --- a/src/commonMain/kotlin/com.github.ikovalyov.model/Article.kt +++ b/src/commonMain/kotlin/com.github.ikovalyov.model/Article.kt @@ -5,7 +5,6 @@ package com.github.ikovalyov.model import com.benasher44.uuid.Uuid import com.benasher44.uuid.uuidFrom import com.github.ikovalyov.model.markers.IEditable -import com.github.ikovalyov.model.security.User import com.github.ikovalyov.model.serializer.UuidSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers @@ -13,18 +12,7 @@ import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json @Serializable -data class Article( - override val id: Uuid, - val name: String, - val abstract: String, - val body: String, - val author: User, - val tags: List?, - val meta: List?, - val template: Template?, // Template uuid - val userList: List, - val templateList: List