From ea5576de08a912df3a430f02a4e5bc6adbdd7310 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Wed, 4 Dec 2024 21:50:39 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=84=A4=EC=A0=95=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B6=84=EB=A6=AC=20=EB=B0=8F=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api-repo/build.gradle.kts | 26 +- .../com/few/api/repo/config/ApiRepoConfig.kt | 16 -- .../article/support/ArticleMainCardMapper.kt | 44 ---- .../dao/member/command/InsertMemberCommand.kt | 8 - .../member/command/UpdateMemberTypeCommand.kt | 8 - .../repo/common/ExceptionTranslator.kt | 2 +- .../api => }/repo/common/NativeSQLLogger.kt | 2 +- .../repo/common/PerformanceListener.kt | 2 +- .../api => }/repo/common/SlowQueryEvent.kt | 2 +- .../few/api => }/repo/config/JooqConfig.kt | 8 +- .../src/main/kotlin/repo/config/RepoConfig.kt | 13 + .../repo/datasource/DataSourceConfig.kt | 8 +- .../few/api => }/repo/flyway/FlywayConfig.kt | 16 +- .../api/repo/RepoTestContainerInitializer.kt | 28 --- .../api/repo/dao/article/ArticleDaoTest.kt | 156 ------------ .../few/api/repo/dao/member/MemberDaoTest.kt | 121 ---------- .../member/support/CommonJsonMapperTest.kt | 51 ---- .../api/repo/dao/problem/ProblemDaoTest.kt | 66 ------ .../problem/support/ContentsJsonMapperTest.kt | 60 ----- .../api/repo/dao/workbook/WorkbookDaoTest.kt | 52 ---- .../few/api/repo/explain/ExplainGenerator.kt | 78 ------ .../explain/InsertUpdateExplainGenerator.kt | 25 -- .../few/api/repo/explain/ResultGenerator.kt | 27 --- .../article/ArticleDaoExplainGenerateTest.kt | 149 ------------ .../ArticleMainCardDaoExplainGenerateTest.kt | 112 --------- .../ArticleViewCountDaoExplainGenerateTest.kt | 104 -------- .../ArticleViewHisDaoExplainGenerateTest.kt | 63 ----- .../member/MemberDaoExplainGenerateTest.kt | 166 ------------- .../problem/ProblemDaoExplainGenerateTest.kt | 138 ----------- .../SubscriptionDaoExplainGenerateTest.kt | 218 ----------------- .../WorkbookDaoExplainGenerateTest.kt | 135 ----------- .../com/few/api/repo/jooq/JooqTestConfig.kt | 11 - .../com/few/api/repo/jooq/JooqTestSpec.kt | 13 - .../com/few/api/repo/jooq/_SampleJooqTest.kt | 196 --------------- .../src/test/resources/application-test.yml | 26 -- .../src/test/resources/docker-compose.yml | 14 -- .../test/resources/mysql-init.d/00_init.sql | 12 - api/build.gradle.kts | 16 +- .../{AspectConfig.kt => ApiAspectConfig.kt} | 2 +- .../{AsyncConfig.kt => ApiAsyncConfig.kt} | 2 +- .../kotlin/com/few/api/config/ApiConfig.kt | 21 +- ...t => ApiDatabaseAccessThreadPoolConfig.kt} | 10 +- .../com/few/api/config/ApiLocalCacheConfig.kt | 8 +- .../ApiMessageSourceAccessor.kt} | 4 +- ...rceConfig.kt => ApiMessageSourceConfig.kt} | 20 +- .../com/few/api/config/ApiThreadPoolConfig.kt | 9 +- .../properties/ApiThreadPoolProperties.kt | 31 +++ .../config/properties/ThreadPoolProperties.kt | 31 --- .../admin/controller}/AdminController.kt | 30 +-- .../controller}/request/AddArticleRequest.kt | 2 +- .../controller}/request/AddWorkbookRequest.kt | 2 +- .../request/ConvertContentRequest.kt | 2 +- .../controller}/request/ImageSourceRequest.kt | 2 +- .../controller}/request/MapArticleRequest.kt | 2 +- .../response/AddArticleResponse.kt | 4 +- .../response/AddWorkbookResponse.kt | 2 +- .../response/ConvertContentResponse.kt | 2 +- .../response/ImageSourceResponse.kt | 2 +- .../admin/repo}/document/DocumentDao.kt | 4 +- .../command/InsertDocumentIfoCommand.kt | 2 +- .../api/domain/admin/repo}/image/ImageDao.kt | 4 +- .../image/command/InsertImageIfoCommand.kt | 2 +- .../AdminArticleMainCardService.kt} | 27 ++- .../admin}/service/ConvertDocumentService.kt | 12 +- .../{document => }/service/GetUrlService.kt | 16 +- .../AppendWorkbookToArticleMainCardInDto.kt | 2 +- .../{document => }/service/dto/GetUrlInDto.kt | 2 +- .../service/dto/GetUrlOutDto.kt | 2 +- .../dto/InitializeArticleMainCardInDto.kt | 2 +- .../usecase/AddArticleUseCase.kt | 57 +++-- .../usecase/AddWorkbookUseCase.kt | 12 +- .../usecase/ConvertContentUseCase.kt | 27 +-- .../usecase/MapArticleUseCase.kt | 16 +- .../{document => }/usecase/PutImageUseCase.kt | 24 +- .../usecase/dto/AddArticleUseCaseIn.kt | 2 +- .../usecase/dto/AddArticleUseCaseOut.kt | 2 +- .../usecase/dto/AddWorkbookUseCaseIn.kt | 2 +- .../usecase/dto/AddWorkbookUseCaseOut.kt | 2 +- .../usecase/dto/ConvertContentUseCaseIn.kt | 2 +- .../usecase/dto/ConvertContentUseCaseOut.kt | 2 +- .../usecase/dto/MapArticleUseCaseIn.kt | 2 +- .../usecase/dto/PutImageUseCaseIn.kt | 2 +- .../usecase/dto/PutImageUseCaseOut.kt | 2 +- .../utils/ObjectPathGenerator.kt | 2 +- .../article/controller}/ArticleController.kt | 28 +-- .../request/ReadArticleByEmailRequest.kt | 2 +- .../response/ReadArticleResponse.kt | 2 +- .../response/ReadArticlesResponse.kt | 2 +- .../article/email}/SendArticleEmailService.kt | 8 +- .../email}/dto/SendArticleEmailArgs.kt | 4 +- .../article/event/ReadArticleEventListener.kt | 2 +- .../article/event/dto/ReadArticleEvent.kt | 2 +- .../handler/ArticleViewHisAsyncHandler.kt | 21 +- .../handler/ArticleViewCountHandler.kt | 5 +- .../api/domain/article/repo}/ArticleDao.kt | 16 +- .../article/repo}/ArticleMainCardDao.kt | 12 +- .../article/repo}/ArticleViewCountDao.kt | 48 ++-- .../domain/article/repo}/ArticleViewHisDao.kt | 6 +- .../ArticleMainCardExcludeWorkbookCommand.kt | 2 +- .../repo}/command/ArticleViewCountCommand.kt | 2 +- .../repo}/command/ArticleViewHisCommand.kt | 2 +- .../command/InsertFullArticleRecordCommand.kt | 2 +- .../UpdateArticleMainCardWorkbookCommand.kt | 2 +- .../repo}/query/ArticleViewCountQuery.kt | 4 +- .../repo}/query/ArticleViewHisCountQuery.kt | 2 +- .../SelectAritlceIdByWorkbookIdAndDayQuery.kt | 2 +- .../repo}/query/SelectArticleContentQuery.kt | 2 +- .../SelectArticleIdByWorkbookIdAndDayQuery.kt | 2 +- .../repo}/query/SelectArticleRecordQuery.kt | 2 +- .../query/SelectArticlesOrderByViewsQuery.kt | 4 +- .../repo}/query/SelectRankByViewsQuery.kt | 2 +- .../query/SelectWorkBookArticleRecordQuery.kt | 2 +- ...SelectWorkbookMappedArticleRecordsQuery.kt | 2 +- .../repo}/record/ArticleContentRecord.kt | 2 +- .../article/repo}/record/ArticleIdRecord.kt | 2 +- .../repo}/record/ArticleMainCardRecord.kt | 2 +- .../record/SelectArticleContentsRecord.kt | 2 +- .../repo}/record/SelectArticleRecord.kt | 2 +- .../repo}/record/SelectArticleViewsRecord.kt | 2 +- .../record/SelectWorkBookArticleRecord.kt | 2 +- .../SelectWorkBookMappedArticleRecord.kt | 2 +- .../repo/support/ArticleMainCardMapper.kt | 77 ++++++ .../article/repo}/support/CommonJsonMapper.kt | 2 +- .../article/service/ArticleLogService.kt | 8 +- .../article/service/ArticleMemberService.kt | 4 +- .../service/BrowseArticleProblemsService.kt | 6 +- .../service/ReadArticleWriterRecordService.kt | 4 +- .../article/usecase/BrowseArticlesUseCase.kt | 20 +- .../usecase/ReadArticleByEmailUseCase.kt | 2 +- .../article/usecase/ReadArticleUseCase.kt | 8 +- .../dto/ReadArticleByEmailUseCaseIn.kt | 4 +- .../ApiBatchSendArticleEmailService.kt | 13 +- .../article/dto/WorkBookSubscriberItem.kt | 2 +- .../reader/WorkBookSubscriberReader.kt | 22 +- .../writer/WorkBookSubscriberWriter.kt | 37 +-- .../writer/model/ReceiveLastArticleRecord.kt | 2 +- .../model/ReceiveLastArticleRecordFilter.kt | 4 +- .../writer/model/UpdateProgressRecord.kt | 2 +- .../model/UpdateProgressRecordFilter.kt | 4 +- .../service/BrowseArticleContentsService.kt | 6 +- .../service/BrowseMemberEmailService.kt | 2 +- .../BrowseMemberReceiveArticlesService.kt | 2 +- .../BrowseWorkbookLastDayColService.kt | 2 +- .../writer/support/MailSendRecorder.kt | 15 +- .../support/MailServiceArgsGenerator.kt | 18 +- .../batch/controller}/BatchController.kt | 6 +- .../batch/log/ApiBatchCallExecutionService.kt | 4 +- .../batch/log/ApiBatchServiceLogAspect.kt | 10 +- .../ExternalIntegrationException.kt | 12 +- .../common/exception}/InsertException.kt | 12 +- .../common/exception}/NotFoundException.kt | 12 +- .../lock/{LockAspect.kt => ApiLockAspect.kt} | 14 +- .../common/lock/{LockFor.kt => ApiLockFor.kt} | 4 +- ...LockIdentifier.kt => ApiLockIdentifier.kt} | 2 +- .../common/repo/client/ApiRepoClient.kt} | 10 +- .../common/repo/client}/dto/RepoAlterArgs.kt | 2 +- .../repo/event/ApiLocalCacheEventListener.kt | 4 +- .../repo/event/ApiSlowQueryEventListener.kt} | 14 +- .../few/api/domain/common/vo}/CategoryType.kt | 6 +- .../support => domain/common/vo}/DayCode.kt | 5 +- .../common/vo}/EmailLogEventType.kt | 5 +- .../few/api/domain/common/vo}/MemberType.kt | 5 +- .../api/domain/common/vo}/SendEventType.kt | 6 +- .../support => domain/common/vo}/SendType.kt | 5 +- .../common/vo}/ViewCategory.kt | 2 +- .../common/vo}/WorkBookCategory.kt | 6 +- .../common/vo}/WorkBookStatus.kt | 2 +- .../common/web/config/ApiWebConfigurer.kt | 18 ++ .../web/config/converter/DayCodeConverter.kt | 4 +- .../converter/EmailLogEventTypeConverter.kt | 4 +- .../web/config/converter/SendTypeConverter.kt | 4 +- .../web/config/converter/ViewConverter.kt | 4 +- .../converter/WorkBookCategoryConverter.kt | 4 +- .../log/controller}/ApiLogController.kt | 15 +- .../log/controller}/request/ApiLogRequest.kt | 2 +- .../controller}/request/EmailLogRequest.kt | 2 +- .../domain/log/dto/AddEmailLogUseCaseIn.kt | 2 +- .../com/few/api/domain/log/repo}/LogIfoDao.kt | 4 +- .../log/repo}/SendArticleEventHistoryDao.kt | 8 +- .../log/repo}/command/InsertEventCommand.kt | 2 +- .../log/repo}/command/InsertLogCommand.kt | 2 +- ...SelectEventByMessageIdAndEventTypeQuery.kt | 2 +- .../record/SendArticleEventHistoryRecord.kt | 2 +- .../log/{ => usecase}/AddApiLogUseCase.kt | 6 +- .../log/{ => usecase}/AddEmailLogUseCase.kt | 14 +- .../member/controller}/MemberController.kt | 16 +- .../controller}/request/SaveMemberRequest.kt | 2 +- .../controller}/request/TokenRequest.kt | 2 +- .../response/SaveMemberResponse.kt | 2 +- .../controller}/response/TokenResponse.kt | 2 +- .../member/email}/SendAuthEmailService.kt | 8 +- .../member/email}/dto/SendAuthEmailArgs.kt | 4 +- .../exception}/NotValidTokenException.kt | 12 +- .../domain/member/repo}/MemberCacheManager.kt | 6 +- .../few/api/domain/member/repo}/MemberDao.kt | 30 +-- .../repo}/command/DeleteMemberCommand.kt | 2 +- .../repo/command/InsertMemberCommand.kt | 8 + .../command/UpdateDeletedMemberTypeCommand.kt | 4 +- .../repo/command/UpdateMemberTypeCommand.kt | 8 + .../repo}/query/BrowseWorkbookWritersQuery.kt | 2 +- ...tMemberByEmailNotConsiderDeletedAtQuery.kt | 2 +- .../repo}/query/SelectMemberByEmailQuery.kt | 2 +- .../repo}/query/SelectMemberEmailQuery.kt | 2 +- .../member/repo}/query/SelectWriterQuery.kt | 2 +- .../member/repo}/query/SelectWritersQuery.kt | 2 +- .../repo}/record/MemberEmailAndTypeRecord.kt | 4 +- .../record/MemberIdAndIsDeletedRecord.kt | 2 +- .../member/repo}/record/MemberRecord.kt | 2 +- .../member/repo}/record/WriterRecord.kt | 2 +- .../record/WriterRecordMappedWorkbook.kt | 2 +- .../member/repo}/support/WriterDescription.kt | 2 +- .../support/WriterDescriptionJsonMapper.kt | 2 +- .../MemberSubscriptionService.kt | 8 +- .../dto/DeleteSubscriptionDto.kt | 2 +- .../member/usecase/DeleteMemberUseCase.kt | 8 +- .../member/usecase/SaveMemberUseCase.kt | 14 +- .../api/domain/member/usecase/TokenUseCase.kt | 18 +- .../member/usecase/dto/SaveMemberTxCaseIn.kt | 2 +- .../usecase/transaction/SaveMemberTxCase.kt | 13 +- .../problem/controller}/ProblemController.kt | 20 +- .../request/CheckProblemRequest.kt | 2 +- .../response/BrowseProblemsResponse.kt | 2 +- .../response/CheckProblemResponse.kt | 2 +- .../response/ReadProblemResponse.kt | 2 +- .../api/domain/problem/repo}/ProblemDao.kt | 22 +- .../domain/problem/repo}/SubmitHistoryDao.kt | 8 +- .../repo}/command/InsertProblemsCommand.kt | 4 +- .../command/InsertSubmitHistoryCommand.kt | 2 +- .../repo}/query/SelectProblemAnswerQuery.kt | 2 +- .../query/SelectProblemIdByArticleIdsQuery.kt | 2 +- .../problem/repo}/query/SelectProblemQuery.kt | 2 +- .../query/SelectProblemsByArticleIdQuery.kt | 2 +- .../query/SelectSubmittedProblemIdsQuery.kt | 2 +- .../record/ProblemIdAndArticleIdRecord.kt | 2 +- .../problem/repo}/record/ProblemIdsRecord.kt | 2 +- .../repo}/record/SelectProblemAnswerRecord.kt | 2 +- .../repo}/record/SelectProblemRecord.kt | 2 +- .../repo}/record/SubmittedProblemIdsRecord.kt | 2 +- .../domain/problem/repo}/support/Contents.kt | 2 +- .../repo}/support/ContentsJsonMapper.kt | 2 +- ...cleService.kt => ProblemArticleService.kt} | 6 +- ...rvice.kt => ProblemSubscriptionService.kt} | 6 +- .../problem/usecase/BrowseProblemsUseCase.kt | 6 +- .../usecase/BrowseUndoneProblemsUseCase.kt | 22 +- .../problem/usecase/CheckProblemUseCase.kt | 12 +- .../problem/usecase/ReadProblemUseCase.kt | 8 +- .../client/ApiSubscriptionClient.kt} | 10 +- .../client}/dto/WorkbookSubscriptionArgs.kt | 2 +- .../controller}/SubscriptionController.kt | 24 +- .../request/UnsubscribeAllRequest.kt | 2 +- .../request/UnsubscribeWorkbookRequest.kt | 2 +- .../request/UpdateSubscriptionDayRequest.kt | 2 +- .../request/UpdateSubscriptionTimeRequest.kt | 2 +- .../response/SubscribeWorkbooksResponse.kt | 2 +- ...ubscriptionAfterCompletionEventListener.kt | 2 +- .../WorkbookSubscriptionEventListener.kt | 2 +- .../SendWorkbookArticleAsyncHandler.kt | 26 +- .../WorkbookSubscriptionClientAsyncHandler.kt | 14 +- .../SubscribeIllegalArgumentException.kt | 12 +- .../subscription/repo}/SubscriptionDao.kt | 8 +- .../BulkUpdateSubscriptionSendDayCommand.kt | 2 +- .../BulkUpdateSubscriptionSendTimeCommand.kt | 2 +- .../InsertWorkbookSubscriptionCommand.kt | 4 +- .../command/UpdateArticleProgressCommand.kt | 2 +- ...UpdateDeletedAtInAllSubscriptionCommand.kt | 2 +- ...eDeletedAtInWorkbookSubscriptionCommand.kt | 2 +- .../UpdateLastArticleProgressCommand.kt | 2 +- .../CountAllWorkbooksSubscriptionQuery.kt | 2 +- .../query/CountWorkbookMappedArticlesQuery.kt | 2 +- ...llMemberWorkbookActiveSubscriptionQuery.kt | 2 +- ...MemberWorkbookInActiveSubscriptionQuery.kt | 2 +- ...ionConditionAndNotConsiderDeletedAQuery.kt | 2 +- .../SelectAllSubscriptionSendStatusQuery.kt | 2 +- ...criptionStatusNotConsiderDeletedAtQuery.kt | 2 +- .../repo}/query/SelectSubscriptionQuery.kt | 2 +- .../SelectSubscriptionSendStatusQuery.kt | 2 +- .../CountAllSubscriptionStatusRecord.kt | 2 +- .../MemberWorkbookSubscriptionStatusRecord.kt | 2 +- .../record/SubscriptionProgressRecord.kt | 2 +- .../repo}/record/SubscriptionSendStatus.kt | 2 +- .../record/SubscriptionSendStatusRecord.kt | 2 +- .../repo}/record/SubscriptionTimeRecord.kt | 2 +- .../record/WorkbookSubscriptionStatus.kt | 2 +- .../service/SubscriptionArticleService.kt | 6 +- .../service/SubscriptionEmailService.kt | 4 +- .../service/SubscriptionLogService.kt | 6 +- .../service/SubscriptionMemberService.kt | 10 +- .../service/SubscriptionWorkbookService.kt | 8 +- .../service/dto/InsertMemberInDto.kt | 2 +- .../service/dto/SendArticleInDto.kt | 2 +- .../BrowseSubscribeWorkbooksUseCase.kt | 14 +- .../usecase/SubscribeWorkbookUseCase.kt | 25 +- .../usecase/UnsubscribeAllUseCase.kt | 4 +- .../usecase/UnsubscribeWorkbookUseCase.kt | 4 +- .../usecase/UpdateSubscriptionDayUseCase.kt | 4 +- .../usecase/UpdateSubscriptionTimeUseCase.kt | 4 +- .../dto/BrowseSubscribeWorkbooksUseCaseIn.kt | 2 +- .../dto/BrowseSubscribeWorkbooksUseCaseOut.kt | 4 +- .../dto/UpdateSubscriptionDayUseCaseIn.kt | 2 +- .../controller}/WorkBookArticleController.kt | 12 +- .../response/ReadWorkBookArticleResponse.kt | 4 +- .../usecase/ReadWorkBookArticleUseCase.kt | 11 +- .../controller}/WorkBookController.kt | 19 +- .../response/BrowseWorkBooksResponse.kt | 2 +- .../response/ReadWorkBookResponse.kt | 2 +- .../workbook/repo}/WorkBookCacheManager.kt | 6 +- .../api/domain/workbook/repo}/WorkbookDao.kt | 28 +-- .../repo}/command/InsertWorkBookCommand.kt | 2 +- .../command/MapWorkBookToArticleCommand.kt | 2 +- ...WorkBookQueryWithSubscriptionCountQuery.kt | 2 +- .../query/SelectAllWorkbookTitleQuery.kt | 2 +- .../query/SelectWorkBookLastArticleIdQuery.kt | 2 +- .../repo}/query/SelectWorkBookRecordQuery.kt | 2 +- .../repo}/record/SelectWorkBookRecord.kt | 2 +- ...lectWorkBookRecordWithSubscriptionCount.kt | 2 +- .../repo}/record/WorkbookTitleRecord.kt | 2 +- .../service/WorkbookArticleService.kt | 4 +- .../workbook/service/WorkbookMemberService.kt | 6 +- .../service/WorkbookSubscribeService.kt | 6 +- .../usecase/BrowseWorkbooksUseCase.kt | 10 +- .../workbook/usecase/ReadWorkbookUseCase.kt | 8 +- .../usecase/dto/BrowseWorkbooksUseCaseIn.kt | 4 +- .../properties/NotSetPropertyException.kt | 3 - .../CorsConfigurationSourceProperties.kt | 22 -- .../api/security/config/WebSecurityConfig.kt | 223 ------------------ .../exception/AccessTokenInvalidException.kt | 5 - .../api/web/support/ApiResponseGenerator.kt | 112 --------- .../resources/application-security-local.yml | 21 -- ...local.yml => application-thread-local.yml} | 26 +- ...ent-prd.yml => application-thread-prd.yml} | 26 +- api/src/main/resources/application.yml | 15 +- .../messages/{ => api}/article.properties | 0 .../messages/{ => api}/document.properties | 0 .../messages/{ => api}/external.properties | 0 .../messages/{ => api}/image.properties | 0 .../messages/{ => api}/member.properties | 0 .../messages/{ => api}/problem.properties | 0 .../messages/{ => api}/submit.properties | 0 .../messages/{ => api}/subscribe.properties | 0 .../messages/{ => api}/workbook.properties | 0 .../ControllerTestContainerInitializer.kt | 2 +- .../web/controller/ControllerTestSpec.kt | 8 +- .../controller/TestTokenUserDetailsService.kt | 6 +- .../web/controller/description/Description.kt | 2 +- .../helper/ApiDefinitionExtension.kt | 2 +- .../helper/PayloadDocumentationExtension.kt | 2 +- .../admin/controller}/AdminControllerTest.kt | 17 +- .../controller}/ArticleControllerTest.kt | 10 +- .../article/usecase/ReadArticleUseCaseTest.kt | 6 +- .../log/controller}/ApiLogControllerTest.kt | 12 +- .../controller}/MemberControllerTest.kt | 12 +- .../member/usecase/SaveMemberUseCaseTest.kt | 14 +- .../domain/member/usecase/TokenUseCaseTest.kt | 20 +- .../controller}/ProblemControllerTest.kt | 10 +- .../usecase/BrowseProblemsUseCaseTest.kt | 4 +- .../BrowseUndoneProblemsUseCaseTest.kt | 38 +-- .../usecase/CheckProblemUseCaseTest.kt | 6 +- .../problem/usecase/ReadProblemUseCaseTest.kt | 10 +- .../controller}/SubscriptionControllerTest.kt | 20 +- .../BrowseSubscribeWorkbooksUseCaseTest.kt | 12 +- .../usecase/SubscribeWorkbookUseCaseTest.kt | 8 +- .../usecase/UnsubscribeAllUseCaseTest.kt | 2 +- .../usecase/UnsubscribeWorkbookUseCaseTest.kt | 3 +- .../WorkBookArticleControllerTest.kt | 10 +- .../controller}/WorkBookControllerTest.kt | 14 +- .../usecase/BrowseWorkbooksUseCaseTest.kt | 10 +- .../usecase/ReadWorkbookUseCaseTest.kt | 6 +- api/src/test/resources/application-test.yml | 47 ++-- batch/build.gradle.kts | 30 --- .../com/few/batch/config/BatchConfig.kt | 22 -- .../data/common/code/BatchCategoryType.kt | 29 --- .../batch/data/common/code/BatchDayCode.kt | 140 ----------- .../batch/data/common/code/BatchMemberType.kt | 18 -- .../data/common/code/BatchSendEventType.kt | 24 -- .../batch/data/common/code/BatchSendType.kt | 9 - .../ReceiveLastArticleRecordFilterTest.kt | 31 --- .../model/UpdateProgressRecordFilterTest.kt | 36 --- build.gradle.kts | 9 +- buildSrc/src/main/kotlin/DependencyVersion.kt | 6 +- .../com/few/data/common/code/DayCode.kt | 141 ----------- .../com/few/data/common/code/SendType.kt | 10 - .../kotlin/com/few/data/config/DataConfig.kt | 16 -- .../src/main/kotlin/data/config/DataConfig.kt | 13 + email/build.gradle.kts | 6 +- .../kotlin/com/few/email/config/MailConfig.kt | 17 -- .../porperty/AwsEmailProviderProperties.kt | 10 - .../few/email/sender => email}/EmailSender.kt | 5 +- .../sender/dto => email}/SendMailArgs.kt | 2 +- .../main/kotlin/email/config/MailConfig.kt | 14 ++ .../few => }/email/config/MailSenderConfig.kt | 8 +- .../few => }/email/config/ThymeleafConfig.kt | 2 +- .../properties/AwsEmailProviderProperties.kt | 7 + .../ArticleAwsSESEmailSendProvider.kt | 2 +- .../provider/AwsSESEmailSendProvider.kt | 2 +- .../provider/EmailSendProvider.kt | 2 +- .../provider/JavaEmailSendProvider.kt | 2 +- .../few/email/service/SendAEmailTestSpec.kt | 9 - .../article/SendArticleEmailServiceTest.kt | 128 ---------- email/src/test/resources/application-test.yml | 16 -- email/src/test/resources/templates/test.html | 126 ---------- security/build.gradle.kts | 18 ++ .../src/main/kotlin/security}/AuthToken.kt | 2 +- .../main/kotlin/security}/AuthorityUtils.kt | 2 +- .../src/main/kotlin/security/Encryptor.kt | 4 +- .../src/main/kotlin/security/IdEncryptor.kt | 12 +- .../src/main/kotlin/security}/Roles.kt | 2 +- .../main/kotlin/security}/TokenAuditHolder.kt | 4 +- .../src/main/kotlin/security/TokenClaim.kt | 7 + .../main/kotlin/security}/TokenGenerator.kt | 20 +- .../main/kotlin/security}/TokenResolver.kt | 16 +- .../main/kotlin/security}/TokenUserDetails.kt | 3 +- .../main/kotlin/security}/UserAuthority.kt | 2 +- .../authentication/token/TokenAuthProvider.kt | 3 +- .../token/TokenUserDetailsService.kt | 25 +- .../kotlin/security/config/SecurityConfig.kt | 13 + .../SecurityAccessTokenInvalidException.kt | 5 + .../resources/application-security-local.yml | 13 + .../resources/application-security-prd.yml | 8 - settings.gradle.kts | 5 +- storage/build.gradle.kts | 6 - .../storage/GetPreSignedObjectUrlService.kt | 6 - .../com/few/storage/RemoveObjectService.kt | 5 - .../document/client/DocumentStoreClient.kt | 11 - .../service/GetPreSignedDocumentUrlService.kt | 7 - .../document/service/PutDocumentService.kt | 9 - .../storage/image/client/ImageStoreClient.kt | 15 -- .../service/GetPreSignedImageUrlService.kt | 7 - .../storage/image/service/PutImageService.kt | 9 - .../image/service/RemoveImageService.kt | 7 - .../storage/GetPreSignedObjectUrlProvider.kt | 6 + .../PutObjectProvider.kt} | 4 +- .../kotlin/storage/RemoveObjectProvider.kt | 5 + .../config/StorageClientConfig.kt} | 4 +- .../GetPreSignedDocumentUrlProvider.kt | 7 + .../storage/document/PutDocumentProvider.kt | 9 + .../document/client/DocumentStoreClient.kt | 11 + .../document/client/S3DocumentStoreClient.kt | 10 +- .../document/client/dto/DocumentObjectArgs.kt | 2 +- .../client/dto/DocumentWriteResponse.kt | 2 +- .../client/util/DocumentArgsGenerator.kt | 8 +- .../document/config/DocumentStorageConfig.kt | 11 +- .../document/config/S3DocumentStoreConfig.kt | 10 +- .../s3/S3GetPreSignedDocumentUrlProvider.kt} | 12 +- .../provider/s3/S3PutDocumentProvider.kt} | 14 +- .../image/GetPreSignedImageUrlProvider.kt | 7 + .../kotlin/storage/image/PutImageProvider.kt | 9 + .../storage/image/RemoveImageProvider.kt | 7 + .../storage/image/client/ImageStoreClient.kt | 15 ++ .../image/client/S3ImageStoreClient.kt | 4 +- .../image/client/dto/ImageObjectArgs.kt | 2 +- .../image/client/dto/ImageWriteResponse.kt | 2 +- .../image/client/util/ImageArgsGenerator.kt | 8 +- .../image/config/ImageStorageConfig.kt | 11 +- .../image/config/S3ImageStoreConfig.kt | 6 +- .../image/config/properties}/CdnProperty.kt | 2 +- .../s3/S3GetPreSignedImageUrlProvider.kt} | 12 +- .../image/provider/s3/S3PutImageProvider.kt} | 14 +- .../provider/s3/S3RemoveImageProvider.kt} | 12 +- web/build.gradle.kts | 14 ++ .../src/main/kotlin/web}/ApiResponse.kt | 10 +- .../main/kotlin/web/ApiResponseGenerator.kt | 62 +++++ .../src/main/kotlin/web}/MessageCode.kt | 10 +- .../src/main/kotlin/web}/UserArgument.kt | 2 +- .../main/kotlin/web}/UserArgumentDetails.kt | 4 +- ...erArgumentHandlerMethodArgumentResolver.kt | 8 +- .../kotlin/web/client}/DiscordBodyProperty.kt | 2 +- .../kotlin/web}/client/config/ClientConfig.kt | 6 +- .../kotlin/web}/config/ClonedTaskDecorator.kt | 2 +- web/src/main/kotlin/web/config/WebConfig.kt | 18 ++ .../main/kotlin/web/config/WebConfigurer.kt | 17 +- .../main/kotlin/web/filter/MDCLogFilter.kt | 4 +- .../web/handler/ControllerExceptionHandler.kt | 41 +--- .../kotlin}/web/handler/ExceptionMessage.kt | 2 +- .../kotlin}/web/handler/LoggingHandler.kt | 3 +- .../config/AbstractDelegatedSecurityConfig.kt | 60 +++++ .../config/LocalDelegatedSecurityConfig.kt | 115 +++++++++ .../config/ProdDelegatedSecurityConfig.kt | 114 +++++++++ .../web/security/config/WebSecurityConfig.kt | 31 +++ .../CorsConfigurationSourceProperties.kt | 22 ++ .../WebTokenInvalidExceptionHandlerFilter.kt | 14 +- .../filter/token/AccessTokenResolver.kt | 14 +- .../filter/token/TokenAuthenticationFilter.kt | 12 +- .../handler/DelegatedAccessDeniedHandler.kt | 4 +- .../DelegatedAuthenticationEntryPoint.kt | 2 +- .../main/resources/application-web-local.yml | 17 ++ .../main/resources/application-web-prd.yml | 17 ++ 486 files changed, 2043 insertions(+), 4792 deletions(-) delete mode 100644 api-repo/src/main/kotlin/com/few/api/repo/config/ApiRepoConfig.kt delete mode 100644 api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/ArticleMainCardMapper.kt delete mode 100644 api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/InsertMemberCommand.kt delete mode 100644 api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateMemberTypeCommand.kt rename api-repo/src/main/kotlin/{com/few/api => }/repo/common/ExceptionTranslator.kt (93%) rename api-repo/src/main/kotlin/{com/few/api => }/repo/common/NativeSQLLogger.kt (93%) rename api-repo/src/main/kotlin/{com/few/api => }/repo/common/PerformanceListener.kt (96%) rename api-repo/src/main/kotlin/{com/few/api => }/repo/common/SlowQueryEvent.kt (63%) rename api-repo/src/main/kotlin/{com/few/api => }/repo/config/JooqConfig.kt (87%) create mode 100644 api-repo/src/main/kotlin/repo/config/RepoConfig.kt rename api-repo/src/main/kotlin/{com/few/api => }/repo/datasource/DataSourceConfig.kt (78%) rename api-repo/src/main/kotlin/{com/few/api => }/repo/flyway/FlywayConfig.kt (79%) delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/RepoTestContainerInitializer.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/article/ArticleDaoTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/member/MemberDaoTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/member/support/CommonJsonMapperTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/problem/ProblemDaoTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapperTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/dao/workbook/WorkbookDaoTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/ExplainGenerator.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/InsertUpdateExplainGenerator.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/ResultGenerator.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleMainCardDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewCountDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewHisDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/member/MemberDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/problem/ProblemDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/subscription/SubscriptionDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/explain/workbook/WorkbookDaoExplainGenerateTest.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestConfig.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestSpec.kt delete mode 100644 api-repo/src/test/kotlin/com/few/api/repo/jooq/_SampleJooqTest.kt delete mode 100644 api-repo/src/test/resources/application-test.yml delete mode 100644 api-repo/src/test/resources/docker-compose.yml delete mode 100644 api-repo/src/test/resources/mysql-init.d/00_init.sql rename api/src/main/kotlin/com/few/api/config/{AspectConfig.kt => ApiAspectConfig.kt} (90%) rename api/src/main/kotlin/com/few/api/config/{AsyncConfig.kt => ApiAsyncConfig.kt} (89%) rename api/src/main/kotlin/com/few/api/config/{DatabaseAccessThreadPoolConfig.kt => ApiDatabaseAccessThreadPoolConfig.kt} (81%) rename api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt => api/src/main/kotlin/com/few/api/config/ApiLocalCacheConfig.kt (94%) rename api/src/main/kotlin/com/few/api/{exception/support/MessageSourceAccessor.kt => config/ApiMessageSourceAccessor.kt} (90%) rename api/src/main/kotlin/com/few/api/config/{MessageSourceConfig.kt => ApiMessageSourceConfig.kt} (62%) create mode 100644 api/src/main/kotlin/com/few/api/config/properties/ApiThreadPoolProperties.kt delete mode 100644 api/src/main/kotlin/com/few/api/config/properties/ThreadPoolProperties.kt rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/AdminController.kt (82%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/request/AddArticleRequest.kt (95%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/request/AddWorkbookRequest.kt (89%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/request/ConvertContentRequest.kt (70%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/request/ImageSourceRequest.kt (69%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/request/MapArticleRequest.kt (86%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/response/AddArticleResponse.kt (57%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/response/AddWorkbookResponse.kt (53%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/response/ConvertContentResponse.kt (68%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/response/ImageSourceResponse.kt (67%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao => api/src/main/kotlin/com/few/api/domain/admin/repo}/document/DocumentDao.kt (82%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao => api/src/main/kotlin/com/few/api/domain/admin/repo}/document/command/InsertDocumentIfoCommand.kt (69%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao => api/src/main/kotlin/com/few/api/domain/admin/repo}/image/ImageDao.kt (83%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao => api/src/main/kotlin/com/few/api/domain/admin/repo}/image/command/InsertImageIfoCommand.kt (71%) rename api/src/main/kotlin/com/few/api/domain/admin/{document/service/ArticleMainCardService.kt => service/AdminArticleMainCardService.kt} (69%) rename {storage/src/main/kotlin/com/few/storage/document => api/src/main/kotlin/com/few/api/domain/admin}/service/ConvertDocumentService.kt (70%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/service/GetUrlService.kt (67%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/service/dto/AppendWorkbookToArticleMainCardInDto.kt (65%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/service/dto/GetUrlInDto.kt (83%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/service/dto/GetUrlOutDto.kt (55%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/service/dto/InitializeArticleMainCardInDto.kt (87%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/AddArticleUseCase.kt (68%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/AddWorkbookUseCase.kt (67%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/ConvertContentUseCase.kt (65%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/MapArticleUseCase.kt (53%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/PutImageUseCase.kt (74%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/AddArticleUseCaseIn.kt (90%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/AddArticleUseCaseOut.kt (52%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/AddWorkbookUseCaseIn.kt (74%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/AddWorkbookUseCaseOut.kt (53%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/ConvertContentUseCaseIn.kt (70%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/ConvertContentUseCaseOut.kt (68%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/MapArticleUseCaseIn.kt (66%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/PutImageUseCaseIn.kt (68%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/usecase/dto/PutImageUseCaseOut.kt (66%) rename api/src/main/kotlin/com/few/api/domain/admin/{document => }/utils/ObjectPathGenerator.kt (94%) rename api/src/main/kotlin/com/few/api/{web/controller/article => domain/article/controller}/ArticleController.kt (85%) rename api/src/main/kotlin/com/few/api/{web/controller/article => domain/article/controller}/request/ReadArticleByEmailRequest.kt (65%) rename api/src/main/kotlin/com/few/api/{web/controller/article => domain/article/controller}/response/ReadArticleResponse.kt (90%) rename api/src/main/kotlin/com/few/api/{web/controller/article => domain/article/controller}/response/ReadArticlesResponse.kt (65%) rename {email/src/main/kotlin/com/few/email/service/article => api/src/main/kotlin/com/few/api/domain/article/email}/SendArticleEmailService.kt (88%) rename {email/src/main/kotlin/com/few/email/service/article => api/src/main/kotlin/com/few/api/domain/article/email}/dto/SendArticleEmailArgs.kt (94%) rename api/src/main/kotlin/com/few/api/domain/article/{ => event}/handler/ArticleViewHisAsyncHandler.kt (66%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/ArticleDao.kt (95%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/ArticleMainCardDao.kt (89%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/ArticleViewCountDao.kt (81%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/ArticleViewHisDao.kt (85%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/command/ArticleMainCardExcludeWorkbookCommand.kt (88%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/command/ArticleViewCountCommand.kt (56%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/command/ArticleViewHisCommand.kt (63%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/command/InsertFullArticleRecordCommand.kt (79%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/command/UpdateArticleMainCardWorkbookCommand.kt (79%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/ArticleViewCountQuery.kt (50%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/ArticleViewHisCountQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt (67%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectArticleContentQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectArticleIdByWorkbookIdAndDayQuery.kt (67%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectArticleRecordQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectArticlesOrderByViewsQuery.kt (51%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectRankByViewsQuery.kt (57%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectWorkBookArticleRecordQuery.kt (68%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/query/SelectWorkbookMappedArticleRecordsQuery.kt (63%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/ArticleContentRecord.kt (82%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/ArticleIdRecord.kt (56%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/ArticleMainCardRecord.kt (93%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/SelectArticleContentsRecord.kt (66%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/SelectArticleRecord.kt (86%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/SelectArticleViewsRecord.kt (64%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/SelectWorkBookArticleRecord.kt (86%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/record/SelectWorkBookMappedArticleRecord.kt (85%) create mode 100644 api/src/main/kotlin/com/few/api/domain/article/repo/support/ArticleMainCardMapper.kt rename {api-repo/src/main/kotlin/com/few/api/repo/dao/article => api/src/main/kotlin/com/few/api/domain/article/repo}/support/CommonJsonMapper.kt (87%) rename batch/src/main/kotlin/com/few/batch/service/article/BatchSendArticleEmailService.kt => api/src/main/kotlin/com/few/api/domain/batch/article/ApiBatchSendArticleEmailService.kt (75%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/dto/WorkBookSubscriberItem.kt (96%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/reader/WorkBookSubscriberReader.kt (74%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/WorkBookSubscriberWriter.kt (81%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/model/ReceiveLastArticleRecord.kt (83%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/model/ReceiveLastArticleRecordFilter.kt (80%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/model/UpdateProgressRecord.kt (75%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/model/UpdateProgressRecordFilter.kt (84%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/service/BrowseArticleContentsService.kt (91%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/service/BrowseMemberEmailService.kt (92%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/service/BrowseMemberReceiveArticlesService.kt (97%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/service/BrowseWorkbookLastDayColService.kt (95%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/support/MailSendRecorder.kt (77%) rename {batch/src/main/kotlin/com/few/batch/service => api/src/main/kotlin/com/few/api/domain/batch}/article/writer/support/MailServiceArgsGenerator.kt (80%) rename api/src/main/kotlin/com/few/api/{web/controller/batch => domain/batch/controller}/BatchController.kt (79%) rename batch/src/main/kotlin/com/few/batch/log/BatchCallExecutionService.kt => api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchCallExecutionService.kt (86%) rename batch/src/main/kotlin/com/few/batch/log/BatchServiceLogAspect.kt => api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchServiceLogAspect.kt (75%) rename api/src/main/kotlin/com/few/api/{exception/common => domain/common/exception}/ExternalIntegrationException.kt (57%) rename api/src/main/kotlin/com/few/api/{exception/common => domain/common/exception}/InsertException.kt (56%) rename api/src/main/kotlin/com/few/api/{exception/common => domain/common/exception}/NotFoundException.kt (56%) rename api/src/main/kotlin/com/few/api/domain/common/lock/{LockAspect.kt => ApiLockAspect.kt} (90%) rename api/src/main/kotlin/com/few/api/domain/common/lock/{LockFor.kt => ApiLockFor.kt} (63%) rename api/src/main/kotlin/com/few/api/domain/common/lock/{LockIdentifier.kt => ApiLockIdentifier.kt} (84%) rename api/src/main/kotlin/com/few/api/{client/repo/RepoClient.kt => domain/common/repo/client/ApiRepoClient.kt} (88%) rename api/src/main/kotlin/com/few/api/{client/repo => domain/common/repo/client}/dto/RepoAlterArgs.kt (61%) rename api-repo/src/main/kotlin/com/few/api/repo/common/LocalCacheEventLogger.kt => api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiLocalCacheEventListener.kt (75%) rename api/src/main/kotlin/com/few/api/{client/repo/event/SlowQueryEventListener.kt => domain/common/repo/event/ApiSlowQueryEventListener.kt} (62%) rename {data/src/main/kotlin/com/few/data/common/code => api/src/main/kotlin/com/few/api/domain/common/vo}/CategoryType.kt (86%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/DayCode.kt (98%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/EmailLogEventType.kt (84%) rename {data/src/main/kotlin/com/few/data/common/code => api/src/main/kotlin/com/few/api/domain/common/vo}/MemberType.kt (78%) rename {data/src/main/kotlin/com/few/data/common/code => api/src/main/kotlin/com/few/api/domain/common/vo}/SendEventType.kt (75%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/SendType.kt (72%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/ViewCategory.kt (88%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/WorkBookCategory.kt (82%) rename api/src/main/kotlin/com/few/api/{web/support => domain/common/vo}/WorkBookStatus.kt (88%) create mode 100644 api/src/main/kotlin/com/few/api/domain/common/web/config/ApiWebConfigurer.kt rename api/src/main/kotlin/com/few/api/{ => domain/common}/web/config/converter/DayCodeConverter.kt (68%) rename api/src/main/kotlin/com/few/api/{ => domain/common}/web/config/converter/EmailLogEventTypeConverter.kt (76%) rename api/src/main/kotlin/com/few/api/{ => domain/common}/web/config/converter/SendTypeConverter.kt (69%) rename api/src/main/kotlin/com/few/api/{ => domain/common}/web/config/converter/ViewConverter.kt (69%) rename api/src/main/kotlin/com/few/api/{ => domain/common}/web/config/converter/WorkBookCategoryConverter.kt (70%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/log/controller}/ApiLogController.kt (79%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/log/controller}/request/ApiLogRequest.kt (51%) rename api/src/main/kotlin/com/few/api/{web/controller/admin => domain/log/controller}/request/EmailLogRequest.kt (85%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/LogIfoDao.kt (82%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/SendArticleEventHistoryDao.kt (89%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/command/InsertEventCommand.kt (78%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/command/InsertLogCommand.kt (56%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/query/SelectEventByMessageIdAndEventTypeQuery.kt (71%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/log => api/src/main/kotlin/com/few/api/domain/log/repo}/record/SendArticleEventHistoryRecord.kt (79%) rename api/src/main/kotlin/com/few/api/domain/log/{ => usecase}/AddApiLogUseCase.kt (72%) rename api/src/main/kotlin/com/few/api/domain/log/{ => usecase}/AddEmailLogUseCase.kt (76%) rename api/src/main/kotlin/com/few/api/{web/controller/member => domain/member/controller}/MemberController.kt (86%) rename api/src/main/kotlin/com/few/api/{web/controller/member => domain/member/controller}/request/SaveMemberRequest.kt (76%) rename api/src/main/kotlin/com/few/api/{web/controller/member => domain/member/controller}/request/TokenRequest.kt (52%) rename api/src/main/kotlin/com/few/api/{web/controller/member => domain/member/controller}/response/SaveMemberResponse.kt (53%) rename api/src/main/kotlin/com/few/api/{web/controller/member => domain/member/controller}/response/TokenResponse.kt (67%) rename {email/src/main/kotlin/com/few/email/service/member => api/src/main/kotlin/com/few/api/domain/member/email}/SendAuthEmailService.kt (81%) rename {email/src/main/kotlin/com/few/email/service/member => api/src/main/kotlin/com/few/api/domain/member/email}/dto/SendAuthEmailArgs.kt (81%) rename api/src/main/kotlin/com/few/api/{exception/member => domain/member/exception}/NotValidTokenException.kt (56%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/MemberCacheManager.kt (85%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/MemberDao.kt (91%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/command/DeleteMemberCommand.kt (55%) create mode 100644 api/src/main/kotlin/com/few/api/domain/member/repo/command/InsertMemberCommand.kt rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/command/UpdateDeletedMemberTypeCommand.kt (50%) create mode 100644 api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateMemberTypeCommand.kt rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/BrowseWorkbookWritersQuery.kt (62%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt (64%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/SelectMemberByEmailQuery.kt (57%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/SelectMemberEmailQuery.kt (57%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/SelectWriterQuery.kt (55%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/query/SelectWritersQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/record/MemberEmailAndTypeRecord.kt (50%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/record/MemberIdAndIsDeletedRecord.kt (66%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/record/MemberRecord.kt (80%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/record/WriterRecord.kt (74%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/record/WriterRecordMappedWorkbook.kt (76%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/support/WriterDescription.kt (71%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/member => api/src/main/kotlin/com/few/api/domain/member/repo}/support/WriterDescriptionJsonMapper.kt (92%) rename api/src/main/kotlin/com/few/api/domain/member/{subscription => service}/MemberSubscriptionService.kt (65%) rename api/src/main/kotlin/com/few/api/domain/member/{subscription => service}/dto/DeleteSubscriptionDto.kt (66%) rename api/src/main/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/ProblemController.kt (86%) rename api/src/main/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/request/CheckProblemRequest.kt (73%) rename api/src/main/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/response/BrowseProblemsResponse.kt (63%) rename api/src/main/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/response/CheckProblemResponse.kt (67%) rename api/src/main/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/response/ReadProblemResponse.kt (79%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/ProblemDao.kt (83%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/SubmitHistoryDao.kt (84%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/command/InsertProblemsCommand.kt (64%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/command/InsertSubmitHistoryCommand.kt (75%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/query/SelectProblemAnswerQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/query/SelectProblemIdByArticleIdsQuery.kt (62%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/query/SelectProblemQuery.kt (55%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/query/SelectProblemsByArticleIdQuery.kt (60%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/query/SelectSubmittedProblemIdsQuery.kt (68%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/record/ProblemIdAndArticleIdRecord.kt (66%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/record/ProblemIdsRecord.kt (57%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/record/SelectProblemAnswerRecord.kt (70%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/record/SelectProblemRecord.kt (72%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/record/SubmittedProblemIdsRecord.kt (60%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/support/Contents.kt (72%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/problem => api/src/main/kotlin/com/few/api/domain/problem/repo}/support/ContentsJsonMapper.kt (92%) rename api/src/main/kotlin/com/few/api/domain/problem/service/{ArticleService.kt => ProblemArticleService.kt} (76%) rename api/src/main/kotlin/com/few/api/domain/problem/service/{SubscriptionService.kt => ProblemSubscriptionService.kt} (79%) rename api/src/main/kotlin/com/few/api/{client/subscription/SubscriptionClient.kt => domain/subscription/client/ApiSubscriptionClient.kt} (85%) rename api/src/main/kotlin/com/few/api/{client/subscription => domain/subscription/client}/dto/WorkbookSubscriptionArgs.kt (73%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/SubscriptionController.kt (88%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/request/UnsubscribeAllRequest.kt (50%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/request/UnsubscribeWorkbookRequest.kt (52%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/request/UpdateSubscriptionDayRequest.kt (74%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/request/UpdateSubscriptionTimeRequest.kt (67%) rename api/src/main/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/response/SubscribeWorkbooksResponse.kt (95%) rename api/src/main/kotlin/com/few/api/domain/subscription/{ => event}/handler/SendWorkbookArticleAsyncHandler.kt (83%) rename api/src/main/kotlin/com/few/api/domain/subscription/{ => event}/handler/WorkbookSubscriptionClientAsyncHandler.kt (71%) rename api/src/main/kotlin/com/few/api/{exception/subscribe => domain/subscription/exception}/SubscribeIllegalArgumentException.kt (57%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/SubscriptionDao.kt (98%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/BulkUpdateSubscriptionSendDayCommand.kt (70%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/BulkUpdateSubscriptionSendTimeCommand.kt (75%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/InsertWorkbookSubscriptionCommand.kt (71%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/UpdateArticleProgressCommand.kt (63%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/UpdateDeletedAtInAllSubscriptionCommand.kt (66%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt (71%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/command/UpdateLastArticleProgressCommand.kt (72%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/CountAllWorkbooksSubscriptionQuery.kt (61%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/CountWorkbookMappedArticlesQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt (75%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt (80%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt (87%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectAllSubscriptionSendStatusQuery.kt (67%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt (81%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectSubscriptionQuery.kt (63%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/query/SelectSubscriptionSendStatusQuery.kt (58%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/CountAllSubscriptionStatusRecord.kt (69%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/MemberWorkbookSubscriptionStatusRecord.kt (75%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/SubscriptionProgressRecord.kt (62%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/SubscriptionSendStatus.kt (76%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/SubscriptionSendStatusRecord.kt (74%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/SubscriptionTimeRecord.kt (80%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/subscription => api/src/main/kotlin/com/few/api/domain/subscription/repo}/record/WorkbookSubscriptionStatus.kt (68%) rename api/src/main/kotlin/com/few/api/{web/controller/workbook/article => domain/workbook/article/controller}/WorkBookArticleController.kt (83%) rename api/src/main/kotlin/com/few/api/{web/controller/workbook/article => domain/workbook/article/controller}/response/ReadWorkBookArticleResponse.kt (86%) rename api/src/main/kotlin/com/few/api/{web/controller/workbook => domain/workbook/controller}/WorkBookController.kt (86%) rename api/src/main/kotlin/com/few/api/{web/controller/workbook => domain/workbook/controller}/response/BrowseWorkBooksResponse.kt (87%) rename api/src/main/kotlin/com/few/api/{web/controller/workbook => domain/workbook/controller}/response/ReadWorkBookResponse.kt (95%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/WorkBookCacheManager.kt (76%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/WorkbookDao.kt (88%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/command/InsertWorkBookCommand.kt (76%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/command/MapWorkBookToArticleCommand.kt (69%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt (76%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/query/SelectAllWorkbookTitleQuery.kt (61%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/query/SelectWorkBookLastArticleIdQuery.kt (60%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/query/SelectWorkBookRecordQuery.kt (55%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/record/SelectWorkBookRecord.kt (83%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/record/SelectWorkBookRecordWithSubscriptionCount.kt (86%) rename {api-repo/src/main/kotlin/com/few/api/repo/dao/workbook => api/src/main/kotlin/com/few/api/domain/workbook/repo}/record/WorkbookTitleRecord.kt (63%) delete mode 100644 api/src/main/kotlin/com/few/api/exception/properties/NotSetPropertyException.kt delete mode 100644 api/src/main/kotlin/com/few/api/security/config/CorsConfigurationSourceProperties.kt delete mode 100644 api/src/main/kotlin/com/few/api/security/config/WebSecurityConfig.kt delete mode 100644 api/src/main/kotlin/com/few/api/security/exception/AccessTokenInvalidException.kt delete mode 100644 api/src/main/kotlin/com/few/api/web/support/ApiResponseGenerator.kt delete mode 100644 api/src/main/resources/application-security-local.yml rename api/src/main/resources/{application-client-local.yml => application-thread-local.yml} (65%) rename api/src/main/resources/{application-client-prd.yml => application-thread-prd.yml} (74%) rename api/src/main/resources/messages/{ => api}/article.properties (100%) rename api/src/main/resources/messages/{ => api}/document.properties (100%) rename api/src/main/resources/messages/{ => api}/external.properties (100%) rename api/src/main/resources/messages/{ => api}/image.properties (100%) rename api/src/main/resources/messages/{ => api}/member.properties (100%) rename api/src/main/resources/messages/{ => api}/problem.properties (100%) rename api/src/main/resources/messages/{ => api}/submit.properties (100%) rename api/src/main/resources/messages/{ => api}/subscribe.properties (100%) rename api/src/main/resources/messages/{ => api}/workbook.properties (100%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/ControllerTestContainerInitializer.kt (95%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/ControllerTestSpec.kt (95%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/TestTokenUserDetailsService.kt (77%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/description/Description.kt (95%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/helper/ApiDefinitionExtension.kt (88%) rename api/src/test/kotlin/com/few/api/{ => config}/web/controller/helper/PayloadDocumentationExtension.kt (95%) rename api/src/test/kotlin/com/few/api/{web/controller/admin => domain/admin/controller}/AdminControllerTest.kt (96%) rename api/src/test/kotlin/com/few/api/{web/controller/article => domain/article/controller}/ArticleControllerTest.kt (98%) rename api/src/test/kotlin/com/few/api/{web/controller/admin => domain/log/controller}/ApiLogControllerTest.kt (83%) rename api/src/test/kotlin/com/few/api/{web/controller/member => domain/member/controller}/MemberControllerTest.kt (95%) rename api/src/test/kotlin/com/few/api/{web/controller/problem => domain/problem/controller}/ProblemControllerTest.kt (97%) rename api/src/test/kotlin/com/few/api/{web/controller/subscription => domain/subscription/controller}/SubscriptionControllerTest.kt (97%) rename api/src/test/kotlin/com/few/api/{web/controller/workbook/article => domain/workbook/article/controller}/WorkBookArticleControllerTest.kt (95%) rename api/src/test/kotlin/com/few/api/{web/controller/workbook => domain/workbook/controller}/WorkBookControllerTest.kt (97%) delete mode 100644 batch/build.gradle.kts delete mode 100644 batch/src/main/kotlin/com/few/batch/config/BatchConfig.kt delete mode 100644 batch/src/main/kotlin/com/few/batch/data/common/code/BatchCategoryType.kt delete mode 100644 batch/src/main/kotlin/com/few/batch/data/common/code/BatchDayCode.kt delete mode 100644 batch/src/main/kotlin/com/few/batch/data/common/code/BatchMemberType.kt delete mode 100644 batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendEventType.kt delete mode 100644 batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendType.kt delete mode 100644 batch/src/test/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilterTest.kt delete mode 100644 batch/src/test/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilterTest.kt delete mode 100644 data/src/main/kotlin/com/few/data/common/code/DayCode.kt delete mode 100644 data/src/main/kotlin/com/few/data/common/code/SendType.kt delete mode 100644 data/src/main/kotlin/com/few/data/config/DataConfig.kt create mode 100644 data/src/main/kotlin/data/config/DataConfig.kt delete mode 100644 email/src/main/kotlin/com/few/email/config/MailConfig.kt delete mode 100644 email/src/main/kotlin/com/few/email/config/porperty/AwsEmailProviderProperties.kt rename email/src/main/kotlin/{com/few/email/sender => email}/EmailSender.kt (86%) rename email/src/main/kotlin/{com/few/email/sender/dto => email}/SendMailArgs.kt (81%) create mode 100644 email/src/main/kotlin/email/config/MailConfig.kt rename email/src/main/kotlin/{com/few => }/email/config/MailSenderConfig.kt (94%) rename email/src/main/kotlin/{com/few => }/email/config/ThymeleafConfig.kt (97%) create mode 100644 email/src/main/kotlin/email/config/properties/AwsEmailProviderProperties.kt rename email/src/main/kotlin/{com/few/email/sender => email}/provider/ArticleAwsSESEmailSendProvider.kt (92%) rename email/src/main/kotlin/{com/few/email/sender => email}/provider/AwsSESEmailSendProvider.kt (98%) rename email/src/main/kotlin/{com/few/email/sender => email}/provider/EmailSendProvider.kt (83%) rename email/src/main/kotlin/{com/few/email/sender => email}/provider/JavaEmailSendProvider.kt (96%) delete mode 100644 email/src/test/kotlin/com/few/email/service/SendAEmailTestSpec.kt delete mode 100644 email/src/test/kotlin/com/few/email/service/article/SendArticleEmailServiceTest.kt delete mode 100644 email/src/test/resources/application-test.yml delete mode 100644 email/src/test/resources/templates/test.html create mode 100644 security/build.gradle.kts rename {api/src/main/kotlin/com/few/api/security/token => security/src/main/kotlin/security}/AuthToken.kt (70%) rename {api/src/main/kotlin/com/few/api/security/authentication/authority => security/src/main/kotlin/security}/AuthorityUtils.kt (91%) rename api/src/main/kotlin/com/few/api/config/crypto/Encryption.kt => security/src/main/kotlin/security/Encryptor.kt (54%) rename api/src/main/kotlin/com/few/api/config/crypto/IdEncryption.kt => security/src/main/kotlin/security/IdEncryptor.kt (90%) rename {api/src/main/kotlin/com/few/api/security/authentication/authority => security/src/main/kotlin/security}/Roles.kt (83%) rename {api/src/main/kotlin/com/few/api/security/context => security/src/main/kotlin/security}/TokenAuditHolder.kt (89%) create mode 100644 security/src/main/kotlin/security/TokenClaim.kt rename {api/src/main/kotlin/com/few/api/security/token => security/src/main/kotlin/security}/TokenGenerator.kt (81%) rename {api/src/main/kotlin/com/few/api/security/token => security/src/main/kotlin/security}/TokenResolver.kt (80%) rename {api/src/main/kotlin/com/few/api/security/authentication/token => security/src/main/kotlin/security}/TokenUserDetails.kt (94%) rename {api/src/main/kotlin/com/few/api/security/authentication/authority => security/src/main/kotlin/security}/UserAuthority.kt (77%) rename {api/src/main/kotlin/com/few/api => security/src/main/kotlin}/security/authentication/token/TokenAuthProvider.kt (97%) rename {api/src/main/kotlin/com/few/api => security/src/main/kotlin}/security/authentication/token/TokenUserDetailsService.kt (59%) create mode 100644 security/src/main/kotlin/security/config/SecurityConfig.kt create mode 100644 security/src/main/kotlin/security/exception/SecurityAccessTokenInvalidException.kt create mode 100644 security/src/main/resources/application-security-local.yml rename {api => security}/src/main/resources/application-security-prd.yml (55%) delete mode 100644 storage/src/main/kotlin/com/few/storage/GetPreSignedObjectUrlService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/RemoveObjectService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/document/client/DocumentStoreClient.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/document/service/GetPreSignedDocumentUrlService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/document/service/PutDocumentService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/image/client/ImageStoreClient.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/image/service/GetPreSignedImageUrlService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/image/service/PutImageService.kt delete mode 100644 storage/src/main/kotlin/com/few/storage/image/service/RemoveImageService.kt create mode 100644 storage/src/main/kotlin/storage/GetPreSignedObjectUrlProvider.kt rename storage/src/main/kotlin/{com/few/storage/PutObjectService.kt => storage/PutObjectProvider.kt} (55%) create mode 100644 storage/src/main/kotlin/storage/RemoveObjectProvider.kt rename storage/src/main/kotlin/{com/few/storage/config/ClientConfig.kt => storage/config/StorageClientConfig.kt} (97%) create mode 100644 storage/src/main/kotlin/storage/document/GetPreSignedDocumentUrlProvider.kt create mode 100644 storage/src/main/kotlin/storage/document/PutDocumentProvider.kt create mode 100644 storage/src/main/kotlin/storage/document/client/DocumentStoreClient.kt rename storage/src/main/kotlin/{com/few => }/storage/document/client/S3DocumentStoreClient.kt (85%) rename storage/src/main/kotlin/{com/few => }/storage/document/client/dto/DocumentObjectArgs.kt (97%) rename storage/src/main/kotlin/{com/few => }/storage/document/client/dto/DocumentWriteResponse.kt (78%) rename storage/src/main/kotlin/{com/few => }/storage/document/client/util/DocumentArgsGenerator.kt (75%) rename storage/src/main/kotlin/{com/few => }/storage/document/config/DocumentStorageConfig.kt (51%) rename storage/src/main/kotlin/{com/few => }/storage/document/config/S3DocumentStoreConfig.kt (85%) rename storage/src/main/kotlin/{com/few/storage/document/service/s3/S3GetPreSignedDocumentUrlService.kt => storage/document/provider/s3/S3GetPreSignedDocumentUrlProvider.kt} (58%) rename storage/src/main/kotlin/{com/few/storage/document/service/s3/S3PutDocumentService.kt => storage/document/provider/s3/S3PutDocumentProvider.kt} (58%) create mode 100644 storage/src/main/kotlin/storage/image/GetPreSignedImageUrlProvider.kt create mode 100644 storage/src/main/kotlin/storage/image/PutImageProvider.kt create mode 100644 storage/src/main/kotlin/storage/image/RemoveImageProvider.kt create mode 100644 storage/src/main/kotlin/storage/image/client/ImageStoreClient.kt rename storage/src/main/kotlin/{com/few => }/storage/image/client/S3ImageStoreClient.kt (96%) rename storage/src/main/kotlin/{com/few => }/storage/image/client/dto/ImageObjectArgs.kt (97%) rename storage/src/main/kotlin/{com/few => }/storage/image/client/dto/ImageWriteResponse.kt (79%) rename storage/src/main/kotlin/{com/few => }/storage/image/client/util/ImageArgsGenerator.kt (83%) rename storage/src/main/kotlin/{com/few => }/storage/image/config/ImageStorageConfig.kt (52%) rename storage/src/main/kotlin/{com/few => }/storage/image/config/S3ImageStoreConfig.kt (89%) rename storage/src/main/kotlin/{com/few/storage/image/service/support => storage/image/config/properties}/CdnProperty.kt (80%) rename storage/src/main/kotlin/{com/few/storage/image/service/s3/S3GetPreSignedImageUrlService.kt => storage/image/provider/s3/S3GetPreSignedImageUrlProvider.kt} (59%) rename storage/src/main/kotlin/{com/few/storage/image/service/s3/S3PutImageService.kt => storage/image/provider/s3/S3PutImageProvider.kt} (59%) rename storage/src/main/kotlin/{com/few/storage/image/service/s3/S3RemoveImageService.kt => storage/image/provider/s3/S3RemoveImageProvider.kt} (61%) create mode 100644 web/build.gradle.kts rename {api/src/main/kotlin/com/few/api/web/support => web/src/main/kotlin/web}/ApiResponse.kt (69%) create mode 100644 web/src/main/kotlin/web/ApiResponseGenerator.kt rename {api/src/main/kotlin/com/few/api/web/support => web/src/main/kotlin/web}/MessageCode.kt (60%) rename {api/src/main/kotlin/com/few/api/web/support/method => web/src/main/kotlin/web}/UserArgument.kt (74%) rename {api/src/main/kotlin/com/few/api/web/support/method => web/src/main/kotlin/web}/UserArgumentDetails.kt (72%) rename {api/src/main/kotlin/com/few/api/web/support/method => web/src/main/kotlin/web}/UserArgumentHandlerMethodArgumentResolver.kt (89%) rename {api/src/main/kotlin/com/few/api/client/config/properties => web/src/main/kotlin/web/client}/DiscordBodyProperty.kt (78%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/client/config/ClientConfig.kt (80%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/config/ClonedTaskDecorator.kt (93%) create mode 100644 web/src/main/kotlin/web/config/WebConfig.kt rename api/src/main/kotlin/com/few/api/web/config/WebConfig.kt => web/src/main/kotlin/web/config/WebConfigurer.kt (69%) rename api/src/main/kotlin/com/few/api/web/filter/MDCFilter.kt => web/src/main/kotlin/web/filter/MDCLogFilter.kt (94%) rename api/src/main/kotlin/com/few/api/web/handler/ApiControllerExceptionHandler.kt => web/src/main/kotlin/web/handler/ControllerExceptionHandler.kt (72%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin}/web/handler/ExceptionMessage.kt (96%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin}/web/handler/LoggingHandler.kt (99%) create mode 100644 web/src/main/kotlin/web/security/config/AbstractDelegatedSecurityConfig.kt create mode 100644 web/src/main/kotlin/web/security/config/LocalDelegatedSecurityConfig.kt create mode 100644 web/src/main/kotlin/web/security/config/ProdDelegatedSecurityConfig.kt create mode 100644 web/src/main/kotlin/web/security/config/WebSecurityConfig.kt create mode 100644 web/src/main/kotlin/web/security/config/properties/CorsConfigurationSourceProperties.kt rename api/src/main/kotlin/com/few/api/security/filter/exception/TokenInvalidExceptionHandlerFilter.kt => web/src/main/kotlin/web/security/exception/WebTokenInvalidExceptionHandlerFilter.kt (72%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/security/filter/token/AccessTokenResolver.kt (72%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/security/filter/token/TokenAuthenticationFilter.kt (80%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/security/handler/DelegatedAccessDeniedHandler.kt (95%) rename {api/src/main/kotlin/com/few/api => web/src/main/kotlin/web}/security/handler/DelegatedAuthenticationEntryPoint.kt (95%) create mode 100644 web/src/main/resources/application-web-local.yml create mode 100644 web/src/main/resources/application-web-prd.yml diff --git a/api-repo/build.gradle.kts b/api-repo/build.gradle.kts index c534c20cf..13ee42b0b 100644 --- a/api-repo/build.gradle.kts +++ b/api-repo/build.gradle.kts @@ -8,7 +8,7 @@ tasks.getByName("jar") { dependencies { /** module */ - api(project(":data")) + implementation(project(":data")) /** mysql */ implementation("com.mysql:mysql-connector-j") @@ -17,27 +17,11 @@ dependencies { api("org.springframework.boot:spring-boot-starter-jooq") jooqCodegen("org.jooq:jooq-meta-extensions:${DependencyVersion.JOOQ}") + /** Local Cache **/ + api("org.ehcache:ehcache:${DependencyVersion.EHCACHE}") + api("org.springframework.boot:spring-boot-starter-cache") + /** flyway */ implementation("org.flywaydb:flyway-core:${DependencyVersion.FLYWAY}") implementation("org.flywaydb:flyway-mysql") - - /** test container */ - implementation(platform("org.testcontainers:testcontainers-bom:${DependencyVersion.TEST_CONTAINER}")) - testImplementation("org.testcontainers:mysql") - - /** Local Cache **/ - implementation("org.ehcache:ehcache:${DependencyVersion.EHCACHE}") - implementation("org.springframework.boot:spring-boot-starter-cache") -} - -tasks { - test { - useJUnitPlatform() - } - - register("generateExplainDocs") { - useJUnitPlatform { - includeTags("explain") - } - } } \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/config/ApiRepoConfig.kt b/api-repo/src/main/kotlin/com/few/api/repo/config/ApiRepoConfig.kt deleted file mode 100644 index 9449ee1a5..000000000 --- a/api-repo/src/main/kotlin/com/few/api/repo/config/ApiRepoConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.few.api.repo.config - -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan(basePackages = [ApiRepoConfig.BASE_PACKAGE]) -class ApiRepoConfig { - companion object { - const val BASE_PACKAGE = "com.few.api.repo" - const val SERVICE_NAME = "few" - const val MODULE_NAME = "few-api-repo" - const val BEAN_NAME_PREFIX = "fewApiRepo" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME - } -} \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/ArticleMainCardMapper.kt b/api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/ArticleMainCardMapper.kt deleted file mode 100644 index 68acf9d9d..000000000 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/ArticleMainCardMapper.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.few.api.repo.dao.article.support - -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.module.kotlin.readValue -import com.few.api.repo.dao.article.command.WorkbookCommand -import com.few.api.repo.dao.article.record.ArticleMainCardRecord -import com.few.api.repo.dao.article.record.WorkbookRecord -import org.jooq.JSON -import org.jooq.RecordMapper -import org.jooq.Record -import org.springframework.stereotype.Component -import java.net.URL -import java.time.LocalDateTime - -@Component -class ArticleMainCardMapper( - private val objectMapper: ObjectMapper, -) : RecordMapper { - override fun map(record: Record) = ArticleMainCardRecord( - articleId = record.get(ArticleMainCardRecord::articleId.name, Long::class.java), - articleTitle = record.get(ArticleMainCardRecord::articleTitle.name, String::class.java), - mainImageUrl = record.get(ArticleMainCardRecord::mainImageUrl.name, URL::class.java), - categoryCd = record.get(ArticleMainCardRecord::categoryCd.name, Byte::class.java), - createdAt = record.get(ArticleMainCardRecord::createdAt.name, LocalDateTime::class.java), - writerId = record.get(ArticleMainCardRecord::writerId.name, Long::class.java), - writerEmail = record.get(ArticleMainCardRecord::writerEmail.name, String::class.java), - writerName = record.get(ArticleMainCardRecord::writerName.name, String::class.java), - writerUrl = record.get(ArticleMainCardRecord::writerUrl.name, URL::class.java), - writerImgUrl = record.get(ArticleMainCardRecord::writerImgUrl.name, URL::class.java), - workbooks = record.get(ArticleMainCardRecord::workbooks.name, JSON::class.java)?.data()?.let { - if ("{}".equals(it)) { - emptyList() - } else { - val workbookRecords = objectMapper.readValue>(it) - workbookRecords.filter { w -> w.id != null && w.title != null } - .toList() - } - } ?: run { - emptyList() - } - ) - - fun toJsonStr(workbooks: List) = objectMapper.writeValueAsString(workbooks) -} \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/InsertMemberCommand.kt b/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/InsertMemberCommand.kt deleted file mode 100644 index db7b860b6..000000000 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/InsertMemberCommand.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.few.api.repo.dao.member.command - -import com.few.data.common.code.MemberType - -data class InsertMemberCommand( - val email: String, - val memberType: MemberType, -) \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateMemberTypeCommand.kt b/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateMemberTypeCommand.kt deleted file mode 100644 index 21b6e6ef8..000000000 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateMemberTypeCommand.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.few.api.repo.dao.member.command - -import com.few.data.common.code.MemberType - -data class UpdateMemberTypeCommand( - val id: Long, - val memberType: MemberType, -) \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/common/ExceptionTranslator.kt b/api-repo/src/main/kotlin/repo/common/ExceptionTranslator.kt similarity index 93% rename from api-repo/src/main/kotlin/com/few/api/repo/common/ExceptionTranslator.kt rename to api-repo/src/main/kotlin/repo/common/ExceptionTranslator.kt index 9adbf8cc1..6626b90b2 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/common/ExceptionTranslator.kt +++ b/api-repo/src/main/kotlin/repo/common/ExceptionTranslator.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.common +package repo.common import org.jooq.ExecuteContext import org.jooq.ExecuteListener diff --git a/api-repo/src/main/kotlin/com/few/api/repo/common/NativeSQLLogger.kt b/api-repo/src/main/kotlin/repo/common/NativeSQLLogger.kt similarity index 93% rename from api-repo/src/main/kotlin/com/few/api/repo/common/NativeSQLLogger.kt rename to api-repo/src/main/kotlin/repo/common/NativeSQLLogger.kt index 982f8309d..20ba1f239 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/common/NativeSQLLogger.kt +++ b/api-repo/src/main/kotlin/repo/common/NativeSQLLogger.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.common +package repo.common import io.github.oshai.kotlinlogging.KotlinLogging import org.jooq.ExecuteContext diff --git a/api-repo/src/main/kotlin/com/few/api/repo/common/PerformanceListener.kt b/api-repo/src/main/kotlin/repo/common/PerformanceListener.kt similarity index 96% rename from api-repo/src/main/kotlin/com/few/api/repo/common/PerformanceListener.kt rename to api-repo/src/main/kotlin/repo/common/PerformanceListener.kt index 5b015332f..ce468e414 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/common/PerformanceListener.kt +++ b/api-repo/src/main/kotlin/repo/common/PerformanceListener.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.common +package repo.common import io.github.oshai.kotlinlogging.KotlinLogging import org.jooq.ExecuteContext diff --git a/api-repo/src/main/kotlin/com/few/api/repo/common/SlowQueryEvent.kt b/api-repo/src/main/kotlin/repo/common/SlowQueryEvent.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/common/SlowQueryEvent.kt rename to api-repo/src/main/kotlin/repo/common/SlowQueryEvent.kt index 4460d6918..0e504ded2 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/common/SlowQueryEvent.kt +++ b/api-repo/src/main/kotlin/repo/common/SlowQueryEvent.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.common +package repo.common data class SlowQueryEvent( val slowQuery: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/config/JooqConfig.kt b/api-repo/src/main/kotlin/repo/config/JooqConfig.kt similarity index 87% rename from api-repo/src/main/kotlin/com/few/api/repo/config/JooqConfig.kt rename to api-repo/src/main/kotlin/repo/config/JooqConfig.kt index 7fbed665a..fbd776ea2 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/config/JooqConfig.kt +++ b/api-repo/src/main/kotlin/repo/config/JooqConfig.kt @@ -1,8 +1,5 @@ -package com.few.api.repo.config +package repo.config -import com.few.api.repo.common.ExceptionTranslator -import com.few.api.repo.common.NativeSQLLogger -import com.few.api.repo.common.PerformanceListener import org.jooq.SQLDialect import org.jooq.impl.DataSourceConnectionProvider import org.jooq.impl.DefaultConfiguration @@ -11,6 +8,9 @@ import org.springframework.context.ApplicationEventPublisher import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator +import repo.common.ExceptionTranslator +import repo.common.NativeSQLLogger +import repo.common.PerformanceListener import javax.sql.DataSource @Configuration diff --git a/api-repo/src/main/kotlin/repo/config/RepoConfig.kt b/api-repo/src/main/kotlin/repo/config/RepoConfig.kt new file mode 100644 index 000000000..9a9e20ef9 --- /dev/null +++ b/api-repo/src/main/kotlin/repo/config/RepoConfig.kt @@ -0,0 +1,13 @@ +package repo.config + +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration + +@Configuration +@ComponentScan(basePackages = [RepoConfig.BASE_PACKAGE]) +class RepoConfig { + companion object { + const val BASE_PACKAGE = "repo" + const val BEAN_NAME_PREFIX = "repo" + } +} \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/datasource/DataSourceConfig.kt b/api-repo/src/main/kotlin/repo/datasource/DataSourceConfig.kt similarity index 78% rename from api-repo/src/main/kotlin/com/few/api/repo/datasource/DataSourceConfig.kt rename to api-repo/src/main/kotlin/repo/datasource/DataSourceConfig.kt index b5f96cf9e..6e6150575 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/datasource/DataSourceConfig.kt +++ b/api-repo/src/main/kotlin/repo/datasource/DataSourceConfig.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.datasource +package repo.datasource -import com.few.api.repo.config.ApiRepoConfig +import repo.config.RepoConfig import com.zaxxer.hikari.HikariDataSource import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.boot.jdbc.DataSourceBuilder @@ -14,8 +14,8 @@ import javax.sql.DataSource class DataSourceConfig { companion object { - const val API_DATASOURCE = ApiRepoConfig.BEAN_NAME_PREFIX + "DataSource" - const val API_TX = ApiRepoConfig.BEAN_NAME_PREFIX + "TransactionManager" + const val API_DATASOURCE = RepoConfig.BEAN_NAME_PREFIX + "DataSource" + const val API_TX = RepoConfig.BEAN_NAME_PREFIX + "TransactionManager" } @Bean(name = [API_DATASOURCE]) diff --git a/api-repo/src/main/kotlin/com/few/api/repo/flyway/FlywayConfig.kt b/api-repo/src/main/kotlin/repo/flyway/FlywayConfig.kt similarity index 79% rename from api-repo/src/main/kotlin/com/few/api/repo/flyway/FlywayConfig.kt rename to api-repo/src/main/kotlin/repo/flyway/FlywayConfig.kt index 8dab33194..489259fb2 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/flyway/FlywayConfig.kt +++ b/api-repo/src/main/kotlin/repo/flyway/FlywayConfig.kt @@ -1,7 +1,7 @@ -package com.few.api.repo.flyway +package repo.flyway -import com.few.api.repo.config.ApiRepoConfig -import com.few.api.repo.datasource.DataSourceConfig +import repo.config.RepoConfig +import repo.datasource.DataSourceConfig import org.flywaydb.core.Flyway import org.flywaydb.core.api.configuration.FluentConfiguration import org.springframework.beans.factory.annotation.Qualifier @@ -18,7 +18,7 @@ import javax.sql.DataSource @Configuration @Import(DataSourceConfig::class) class FlywayConfig { - @Bean(name = [ApiRepoConfig.BEAN_NAME_PREFIX + "Flyway"]) + @Bean(name = [RepoConfig.BEAN_NAME_PREFIX + "Flyway"]) fun flyway( configuration: org.flywaydb.core.api.configuration.Configuration?, ): Flyway { @@ -26,27 +26,27 @@ class FlywayConfig { } @Profile("!new") - @Bean(name = [ApiRepoConfig.BEAN_NAME_PREFIX + "FlywayValidateInitializer"]) + @Bean(name = [RepoConfig.BEAN_NAME_PREFIX + "FlywayValidateInitializer"]) fun flywayValidateInitializer( flyway: Flyway?, ): FlywayMigrationInitializer { return FlywayMigrationInitializer(flyway) { obj: Flyway -> obj.validate() } } - @Bean(name = [ApiRepoConfig.BEAN_NAME_PREFIX + "FlywayMigrationInitializer"]) + @Bean(name = [RepoConfig.BEAN_NAME_PREFIX + "FlywayMigrationInitializer"]) fun flywayMigrationInitializer( flyway: Flyway?, ): FlywayMigrationInitializer { return FlywayMigrationInitializer(flyway) { obj: Flyway -> obj.migrate() } } - @Bean(name = [ApiRepoConfig.BEAN_NAME_PREFIX + "FlywayProperties"]) + @Bean(name = [RepoConfig.BEAN_NAME_PREFIX + "FlywayProperties"]) @ConfigurationProperties(prefix = "spring.flyway") fun flywayProperties(): FlywayProperties { return FlywayProperties() } - @Bean(name = [ApiRepoConfig.BEAN_NAME_PREFIX + "FlywayConfiguration"]) + @Bean(name = [RepoConfig.BEAN_NAME_PREFIX + "FlywayConfiguration"]) fun configuration( @Qualifier(DataSourceConfig.API_DATASOURCE) dataSource: DataSource?, ): org.flywaydb.core.api.configuration.Configuration { diff --git a/api-repo/src/test/kotlin/com/few/api/repo/RepoTestContainerInitializer.kt b/api-repo/src/test/kotlin/com/few/api/repo/RepoTestContainerInitializer.kt deleted file mode 100644 index f187895b2..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/RepoTestContainerInitializer.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.few.api.repo - -import io.github.oshai.kotlinlogging.KotlinLogging -import org.springframework.context.ApplicationContextInitializer -import org.springframework.context.ConfigurableApplicationContext -import org.testcontainers.containers.DockerComposeContainer -import java.io.File - -class RepoTestContainerInitializer : ApplicationContextInitializer { - private val log = KotlinLogging.logger {} - - companion object { - private const val MYSQL = "mysql" - private const val MYSQL_PORT = 3306 - - private val dockerCompose = - DockerComposeContainer(File("src/test/resources/docker-compose.yml")) - .withExposedService(MYSQL, MYSQL_PORT) - } - - override fun initialize(applicationContext: ConfigurableApplicationContext) { - log.debug { "===== set up test containers =====" } - - dockerCompose.start() - - log.debug { "===== success set up test containers =====" } - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/article/ArticleDaoTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/article/ArticleDaoTest.kt deleted file mode 100644 index b9ed9f971..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/article/ArticleDaoTest.kt +++ /dev/null @@ -1,156 +0,0 @@ -package com.few.api.repo.dao.article - -import com.few.api.repo.dao.article.query.SelectArticleRecordQuery -import com.few.api.repo.dao.article.query.SelectWorkBookArticleRecordQuery -import com.few.api.repo.dao.article.query.SelectWorkbookMappedArticleRecordsQuery -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.ArticleIfo -import jooq.jooq_dsl.tables.ArticleMst -import jooq.jooq_dsl.tables.MappingWorkbookArticle -import org.jooq.DSLContext -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.transaction.annotation.Transactional -import java.net.URL - -class ArticleDaoTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var articleDao: ArticleDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(ArticleMst.ARTICLE_MST).execute() - dslContext.deleteFrom(ArticleIfo.ARTICLE_IFO).execute() - dslContext.insertInto(ArticleMst.ARTICLE_MST) - .set(ArticleMst.ARTICLE_MST.ID, 1L) - .set(ArticleMst.ARTICLE_MST.MEMBER_ID, 1L) - .set(ArticleMst.ARTICLE_MST.MAIN_IMAGE_URL, "http://localhost:8080/image1.jpg") - .set(ArticleMst.ARTICLE_MST.TITLE, "this is title1") - .set(ArticleMst.ARTICLE_MST.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .execute() - dslContext.insertInto(ArticleIfo.ARTICLE_IFO) - .set(ArticleIfo.ARTICLE_IFO.ARTICLE_MST_ID, 1L) - .set(ArticleIfo.ARTICLE_IFO.CONTENT, "this is content1") - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - @Transactional - fun `아티클 Id를 통해 아티클 정보를 조회합니다`() { - // given - val query = SelectArticleRecordQuery(1L) - - // when - val result = query.let { - articleDao.selectArticleRecord(it) - } - - // then - assertNotNull(result!!) - assertEquals(1L, result.articleId) - assertEquals(1L, result.writerId) - assertEquals(URL("http://localhost:8080/image1.jpg"), result.mainImageURL) - assertEquals("this is title1", result.title) - assertEquals("this is content1", result.content) - assertEquals(CategoryType.fromCode(0)!!.code, result.category) - } - - @Test - @Transactional - fun `학습지 Id와 아티클 Id를 통해 학습지에서의 아티클 Day가 포함된 아티클 정보를 조회합니다`() { - // given - setMappingWorkbookArticleData(1) - val query = SelectWorkBookArticleRecordQuery(1L, 1L) - - // when - val result = query.let { - articleDao.selectWorkBookArticleRecord(it) - } - - // then - assertNotNull(result!!) - assertEquals(1L, result.articleId) - assertEquals(1L, result.writerId) - assertEquals(URL("http://localhost:8080/image1.jpg"), result.mainImageURL) - assertEquals("this is title1", result.title) - assertEquals("this is content1", result.content) - assertEquals(CategoryType.fromCode(0)!!.code, result.category) - assertEquals(1L, result.day) - } - - @Test - @Transactional - fun `학습지에 속한 아티클 정보를 조회합니다`() { - // given - val totalCount = 5 - setMappingWorkbookArticleData(totalCount) - val query = SelectWorkbookMappedArticleRecordsQuery(1L) - - // when - val result = query.let { - articleDao.selectWorkbookMappedArticleRecords(it) - } - - // then - assertNotNull(result) - assertEquals(totalCount, result.size) - for (i in result.indices) { - assertEquals(i + 1L, result[i].articleId) - assertEquals(1L, result[i].writerId) - assertEquals(URL("http://localhost:8080/image${i + 1}.jpg"), result[i].mainImageURL) - assertEquals("this is title${i + 1}", result[i].title) - assertEquals("this is content${i + 1}", result[i].content) - assertEquals(CategoryType.fromCode(0)!!.code, result[i].category) - } - } - - private fun setMappingWorkbookArticleData(count: Int) { - log.debug { "===== start setMappingWorkbookArticleData =====" } - dslContext.deleteFrom(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE).execute() - for (i in 1..count) { - setMappingWorkbookArticle(1L, i.toLong(), i) - } - for (i in 2..count) { - setArticleMST(i.toLong()) - setArticleInfo(i.toLong()) - } - log.debug { "===== finish setMappingWorkbookArticleData =====" } - } - - private fun setMappingWorkbookArticle(workbookId: Long, articleId: Long, day: Int) { - dslContext.insertInto(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.WORKBOOK_ID, workbookId) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.ARTICLE_ID, articleId) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.DAY_COL, day) - .execute() - } - - private fun setArticleMST(id: Long) { - dslContext.insertInto(ArticleMst.ARTICLE_MST) - .set(ArticleMst.ARTICLE_MST.ID, id) - .set(ArticleMst.ARTICLE_MST.MEMBER_ID, 1L) - .set(ArticleMst.ARTICLE_MST.MAIN_IMAGE_URL, "http://localhost:8080/image$id.jpg") - .set(ArticleMst.ARTICLE_MST.TITLE, "this is title$id") - .set(ArticleMst.ARTICLE_MST.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .execute() - } - - private fun setArticleInfo(id: Long) { - dslContext.insertInto(ArticleIfo.ARTICLE_IFO) - .set(ArticleIfo.ARTICLE_IFO.ARTICLE_MST_ID, id) - .set(ArticleIfo.ARTICLE_IFO.CONTENT, "this is content$id") - .execute() - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/member/MemberDaoTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/member/MemberDaoTest.kt deleted file mode 100644 index 042af219a..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/member/MemberDaoTest.kt +++ /dev/null @@ -1,121 +0,0 @@ -package com.few.api.repo.dao.member - -import com.few.api.repo.dao.member.query.SelectWriterQuery -import com.few.api.repo.dao.member.query.SelectWritersQuery -import com.few.api.repo.dao.member.support.WriterDescription -import com.few.api.repo.dao.member.support.WriterDescriptionJsonMapper -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.MemberType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.Member -import junit.framework.TestCase.assertEquals -import junit.framework.TestCase.assertNotNull -import org.jooq.DSLContext -import org.jooq.JSON -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.transaction.annotation.Transactional -import java.net.URL -import java.util.stream.LongStream -import kotlin.streams.toList - -class MemberDaoTest : JooqTestSpec() { - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var memberDao: MemberDao - - @Autowired - private lateinit var writerDescriptionJsonMapper: WriterDescriptionJsonMapper - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Member.MEMBER).execute() - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.ID, 1) - .set(Member.MEMBER.EMAIL, "member@gmail.com") - .set(Member.MEMBER.TYPE_CD, MemberType.NORMAL.code) - .execute() - - val writerDescription = writerDescriptionJsonMapper.toJson( - WriterDescription( - "few2", - URL("http://localhost:8080/writers/url2"), - URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742") - ) - ) - - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.ID, 2) - .set(Member.MEMBER.EMAIL, "writer2@gmail.com") - .set(Member.MEMBER.TYPE_CD, MemberType.WRITER.code) - .set(Member.MEMBER.DESCRIPTION, JSON.valueOf(writerDescription)) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - @Transactional - fun `Id로 작가를 조회합니다`() { - // given - val query = SelectWriterQuery(2L) - - // when - val result = query.let { - memberDao.selectWriter(it) - } - - assertNotNull(result!!) - assertEquals(2L, result.writerId) - assertEquals("few2", result.name) - assertEquals(URL("http://localhost:8080/writers/url2"), result.url) - } - - @Test - @Transactional - fun `Id 목록으로 작가를 조회합니다`() { - // given - val addCount = 5 - setMoreWriters(addCount) - val query = LongStream.range(2L, 2L + (addCount + 1)).toList().let { - SelectWritersQuery(it) - } - - // when - val results = query.let { - memberDao.selectWriters(it) - } - - // then - assertNotNull(results) - assertEquals(addCount + 1, results.size) - for (i in 0 until addCount) { - assertEquals(2L + i, results[i].writerId) - assertEquals("few${i + 2}", results[i].name) - assertEquals(URL("http://localhost:8080/writers/url${i + 2}"), results[i].url) - } - } - - fun setMoreWriters(count: Int) { - for (i in 3 until 3 + count) { - val writerDescription = writerDescriptionJsonMapper.toJson( - WriterDescription( - "few$i", - URL("http://localhost:8080/writers/url$i"), - URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742") - ) - ) - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.ID, i.toLong()) - .set(Member.MEMBER.EMAIL, "writer$i@gmail.com") - .set(Member.MEMBER.TYPE_CD, MemberType.WRITER.code) - .set(Member.MEMBER.DESCRIPTION, JSON.valueOf(writerDescription)) - .execute() - } - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/member/support/CommonJsonMapperTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/member/support/CommonJsonMapperTest.kt deleted file mode 100644 index e5a0ac059..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/member/support/CommonJsonMapperTest.kt +++ /dev/null @@ -1,51 +0,0 @@ -package com.few.api.repo.dao.member.support - -import com.fasterxml.jackson.databind.ObjectMapper -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test - -import java.net.URL - -class CommonJsonMapperTest { - - private var writerDescriptionJsonMapper: WriterDescriptionJsonMapper = WriterDescriptionJsonMapper(ObjectMapper()) - - @Test - fun `WriterDescription을 Json 형식으로 변환합니다`() { - // Given - val writerDescription = WriterDescription( - name = "writer", - url = URL("http://localhost:8080/writers/url"), - imageUrl = URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742") - ) - - // When - val json = writerDescriptionJsonMapper.toJson(writerDescription) - - // Then - assertNotNull(json) - assertTrue(json.isNotBlank()) - assertTrue(json.contains("writer")) - assertTrue(json.contains("http://localhost:8080/writers/url")) - } - - @Test - fun `Json 형식의 WriterDescription을 WriterDescription으로 변환합니다`() { - // Given - val json = """ - { - "name": "writer", - "url": "http://localhost:8080/writers/url", - "imageUrl": "https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742" - } - """.trimIndent() - - // When - val writerDescription = writerDescriptionJsonMapper.toObject(json) - - // Then - assertNotNull(writerDescription) - assertEquals("writer", writerDescription.name) - assertEquals(URL("http://localhost:8080/writers/url"), writerDescription.url) - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/ProblemDaoTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/ProblemDaoTest.kt deleted file mode 100644 index aafd01254..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/ProblemDaoTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -package com.few.api.repo.dao.problem - -import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery -import com.few.api.repo.dao.problem.support.Content -import com.few.api.repo.dao.problem.support.Contents -import com.few.api.repo.dao.problem.support.ContentsJsonMapper -import com.few.api.repo.jooq.JooqTestSpec -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.Problem -import org.jooq.DSLContext -import org.jooq.JSON -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -class ProblemDaoTest : JooqTestSpec() { - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var problemDao: ProblemDao - - @Autowired - private lateinit var contentsJsonMapper: ContentsJsonMapper - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Problem.PROBLEM).execute() - val contents = Contents( - listOf( - Content(1, "content1"), - Content(2, "content2") - ) - ).let { - contentsJsonMapper.toJson(it) - } - dslContext.insertInto(Problem.PROBLEM) - .set(Problem.PROBLEM.ID, 1) - .set(Problem.PROBLEM.ARTICLE_ID, 1) - .set(Problem.PROBLEM.TITLE, "problem title") - .set(Problem.PROBLEM.CONTENTS, JSON.valueOf(contents)) - .set(Problem.PROBLEM.ANSWER, "1") - .set(Problem.PROBLEM.EXPLANATION, "explanation") - .set(Problem.PROBLEM.CREATOR_ID, 1) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun `아티클 Id로 문제를 조회합니다`() { - // given - val query = SelectProblemsByArticleIdQuery(1L) - - // when - val result = problemDao.selectProblemsByArticleId(query) - - // then - assertNotNull(result!!) - assertEquals(1, result.problemIds.size) - assertEquals(1, result.problemIds[0]) - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapperTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapperTest.kt deleted file mode 100644 index 8e6cbc754..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapperTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.few.api.repo.dao.problem.support - -import com.fasterxml.jackson.databind.ObjectMapper -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test - -class ContentsJsonMapperTest { - - private var contentsJsonMapper: ContentsJsonMapper = ContentsJsonMapper(ObjectMapper()) - - @Test - fun `Contents를 Json 형식으로 변환합니다`() { - // Given - val contents = Contents( - contents = listOf( - Content(1L, "this is number one"), - Content(2L, "this is number two") - ) - ) - - // When - val json = contentsJsonMapper.toJson(contents) - - // Then - assertNotNull(json) - assertTrue(json.isNotBlank()) - assertTrue(json.contains("this is number one")) - assertTrue(json.contains("this is number two")) - } - - @Test - fun `Json 형식의 Contents를 Contents으로 변환합니다`() { - // Given - val json = """ - { - "contents": [ - { - "number": 1, - "content": "this is number one" - }, - { - "number": 2, - "content": "this is number two" - } - ] - } - """.trimIndent() - - // When - val contents = contentsJsonMapper.toObject(json) - - // Then - assertNotNull(contents) - assertEquals(2, contents.contents.size) - assertEquals(1L, contents.contents[0].number) - assertEquals("this is number one", contents.contents[0].content) - assertEquals(2L, contents.contents[1].number) - assertEquals("this is number two", contents.contents[1].content) - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/dao/workbook/WorkbookDaoTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/dao/workbook/WorkbookDaoTest.kt deleted file mode 100644 index 749a948be..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/dao/workbook/WorkbookDaoTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.few.api.repo.dao.workbook - -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import jooq.jooq_dsl.tables.Workbook -import org.jooq.DSLContext -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import java.net.URL - -class WorkbookDaoTest : JooqTestSpec() { - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var workbookDao: WorkbookDao - - @BeforeEach - fun setUp() { - dslContext.deleteFrom(Workbook.WORKBOOK).execute() - dslContext.insertInto(Workbook.WORKBOOK) - .set(Workbook.WORKBOOK.ID, 1) - .set(Workbook.WORKBOOK.TITLE, "title1") - .set(Workbook.WORKBOOK.MAIN_IMAGE_URL, "http://localhost:8080/image1.jpg") - .set(Workbook.WORKBOOK.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .set(Workbook.WORKBOOK.DESCRIPTION, "description1") - .execute() - } - - @Test - fun `워크북 ID로 워크북을 조회합니다`() { - // given - val query = SelectWorkBookRecordQuery(1L) - - // when - val result = query.let { - workbookDao.selectWorkBook(it) - } - - // then - assertNotNull(result!!) - assertEquals(1L, result.id) - assertEquals("title1", result.title) - assertEquals(URL("http://localhost:8080/image1.jpg"), result.mainImageUrl) - assertEquals(0, result.category) - assertEquals("description1", result.description) - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/ExplainGenerator.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/ExplainGenerator.kt deleted file mode 100644 index 2ea54043f..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/ExplainGenerator.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.few.api.repo.explain - -import org.jooq.DSLContext -import org.jooq.Query - -class ExplainGenerator { - companion object { - /** - * Execute EXPLAIN and EXPLAIN ANALYZE FORMAT=TREE - */ - fun execute(dslContext: DSLContext, query: Query): String { - val sql = query.sql - val values = query.bindValues - mapSqlAndValues(sql, values).let { - val explain = StringBuilder() - explain.append("EXPLAIN $it\n") - explain.append("\n") - dslContext.fetch("EXPLAIN $it").let { - explain.append(it) - } - explain.append("\n\n") - explain.append("EXPLAIN ANALYZE FORMAT=TREE $it\n") - explain.append("\n") - dslContext.fetch("EXPLAIN ANALYZE FORMAT=TREE $it").let { - it.forEach { record -> - explain.append(record[0].toString()) - } - } - return explain.toString() - } - } - - /** - * Execute EXPLAIN - */ - fun explain(dslContext: DSLContext, query: Query): String { - val sql = query.sql - val values = query.bindValues - mapSqlAndValues(sql, values).let { - val explain = StringBuilder() - explain.append("EXPLAIN $it\n") - explain.append("\n") - dslContext.fetch("EXPLAIN $it").let { - explain.append(it) - } - return explain.toString() - } - } - - /** - * Execute EXPLAIN ANALYZE FORMAT=TREE - */ - fun analyzeFormatTree(dslContext: DSLContext, query: Query): String { - val sql = query.sql - val values = query.bindValues - mapSqlAndValues(sql, values).let { - val explain = StringBuilder() - explain.append("EXPLAIN ANALYZE FORMAT=TREE $it\n") - explain.append("\n") - dslContext.fetch("EXPLAIN ANALYZE FORMAT=TREE $it").let { - it.forEach { record -> - explain.append(record[0].toString()) - } - } - return explain.toString() - } - } - - private fun mapSqlAndValues(sql: String, values: List) = - values.foldIndexed(sql) { index, acc, value -> - if (value is String) { - acc.replaceFirst("?", "'$value'") - } else { - acc.replaceFirst("?", "$value") - } - } - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/InsertUpdateExplainGenerator.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/InsertUpdateExplainGenerator.kt deleted file mode 100644 index 6dce1fed3..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/InsertUpdateExplainGenerator.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.few.api.repo.explain - -import org.jooq.DSLContext -import org.jooq.JSON -import org.jooq.impl.DSL - -class InsertUpdateExplainGenerator { - companion object { - fun execute(dslContext: DSLContext, sql: String, values: List): String { - return dslContext.explain( - DSL.query( - values.foldIndexed(sql) { index, acc, value -> - if (value is JSON) { - value.toString().replace("\"", "\\\"").let { - return@foldIndexed acc.replaceFirst("?", "\"$it\"") - } - } else { - acc.replaceFirst("?", "\"$value\"") - } - } - ) - ).toString() - } - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/ResultGenerator.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/ResultGenerator.kt deleted file mode 100644 index be9f0e18f..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/ResultGenerator.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.few.api.repo.explain - -import org.jooq.Query -import java.io.File - -class ResultGenerator { - - companion object { - fun execute(query: Query, explain: String, fileName: String) { - File("src/test/resources/explain").let { dir -> - if (!dir.exists()) { - dir.mkdirs() - } - - File(dir, "$fileName.txt").let { file -> - if (file.exists()) { - file.delete() - } - file.createNewFile() - file.appendText(query.toString()) - file.appendText("\n\n") - file.appendText(explain) - } - } - } - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleDaoExplainGenerateTest.kt deleted file mode 100644 index ac2c99967..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleDaoExplainGenerateTest.kt +++ /dev/null @@ -1,149 +0,0 @@ -package com.few.api.repo.explain.article - -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.command.InsertFullArticleRecordCommand -import com.few.api.repo.dao.article.query.SelectArticleIdByWorkbookIdAndDayQuery -import com.few.api.repo.dao.article.query.SelectArticleRecordQuery -import com.few.api.repo.dao.article.query.SelectWorkBookArticleRecordQuery -import com.few.api.repo.dao.article.query.SelectWorkbookMappedArticleRecordsQuery -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.ArticleIfo -import jooq.jooq_dsl.tables.ArticleMst -import jooq.jooq_dsl.tables.MappingWorkbookArticle -import org.jooq.DSLContext -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import java.net.URL - -@Tag("explain") -class ArticleDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var articleDao: ArticleDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(ArticleMst.ARTICLE_MST).execute() - dslContext.deleteFrom(ArticleIfo.ARTICLE_IFO).execute() - dslContext.deleteFrom(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE).execute() - dslContext.insertInto(ArticleMst.ARTICLE_MST) - .set(ArticleMst.ARTICLE_MST.ID, 1L) - .set(ArticleMst.ARTICLE_MST.MEMBER_ID, 1L) - .set(ArticleMst.ARTICLE_MST.MAIN_IMAGE_URL, "http://localhost:8080/image1.jpg") - .set(ArticleMst.ARTICLE_MST.TITLE, "this is title1") - .set(ArticleMst.ARTICLE_MST.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .execute() - dslContext.insertInto(ArticleIfo.ARTICLE_IFO) - .set(ArticleIfo.ARTICLE_IFO.ARTICLE_MST_ID, 1L) - .set(ArticleIfo.ARTICLE_IFO.CONTENT, "this is content1") - .execute() - dslContext.insertInto(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.WORKBOOK_ID, 1L) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.ARTICLE_ID, 1L) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.DAY_COL, 0) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectArticleRecordQueryExplain() { - val query = SelectArticleRecordQuery(1L).let { - articleDao.selectArticleRecordQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectArticleRecordQueryExplain") - } - - @Test - fun selectWorkBookArticleRecordQueryExplain() { - val query = SelectWorkBookArticleRecordQuery(1L, 1L).let { - articleDao.selectWorkBookArticleRecordQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWorkBookArticleRecordQueryExplain") - } - - @Test - fun selectWorkbookMappedArticleRecordsQueryExplain() { - val query = SelectWorkbookMappedArticleRecordsQuery(1L).let { - articleDao.selectWorkbookMappedArticleRecordsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWorkbookMappedArticleRecordsQueryExplain") - } - - @Test - fun insertArticleMstCommandExplain() { - val command = InsertFullArticleRecordCommand( - 100L, - URL("http://localhost:8080/image1.jpg"), - "this is title1", - CategoryType.fromCode(0)!!.code, - "this is content1" - ).let { - articleDao.insertArticleMstCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertArticleMstCommandExplain") - } - - @Test - fun insertArticleIfoCommandExplain() { - val command = InsertFullArticleRecordCommand( - 100L, - URL("http://localhost:8080/image1.jpg"), - "this is title1", - CategoryType.fromCode(0)!!.code, - "this is content1" - ).let { - articleDao.insertArticleIfoCommand(1L, it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertArticleIfoCommandExplain") - } - - @Test - fun selectArticleIdByWorkbookIdAndDayQueryExplain() { - val query = SelectArticleIdByWorkbookIdAndDayQuery(1L, 1).let { - articleDao.selectArticleIdByWorkbookIdAndDayQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectArticleIdByWorkbookIdAndDayQueryExplain") - } - - @Test - fun selectArticleContentsQueryExplain() { - val query = setOf(1L).let { - articleDao.selectArticleContentsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectArticleContentsQueryExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleMainCardDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleMainCardDaoExplainGenerateTest.kt deleted file mode 100644 index 1a4a58ce6..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleMainCardDaoExplainGenerateTest.kt +++ /dev/null @@ -1,112 +0,0 @@ -package com.few.api.repo.explain.article - -import com.few.api.repo.dao.article.ArticleMainCardDao -import com.few.api.repo.dao.article.command.ArticleMainCardExcludeWorkbookCommand -import com.few.api.repo.dao.article.command.UpdateArticleMainCardWorkbookCommand -import com.few.api.repo.dao.article.command.WorkbookCommand -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.ArticleMainCard -import org.jooq.DSLContext -import org.jooq.JSON -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import java.net.URL -import java.time.LocalDateTime - -@Tag("explain") -class ArticleMainCardDaoExplainGenerateTest : JooqTestSpec() { - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var articleMainCardDao: ArticleMainCardDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(ArticleMainCard.ARTICLE_MAIN_CARD).execute() - dslContext.insertInto(ArticleMainCard.ARTICLE_MAIN_CARD) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.ID, 1L) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.TITLE, "this is title1") - .set( - ArticleMainCard.ARTICLE_MAIN_CARD.MAIN_IMAGE_URL, - "http://localhost:8080/image1.jpg" - ) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.CREATED_AT, LocalDateTime.now()) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.WRITER_ID, 1L) - .set(ArticleMainCard.ARTICLE_MAIN_CARD.WRITER_EMAIL, "writer@gmail.com") - .set( - ArticleMainCard.ARTICLE_MAIN_CARD.WRITER_DESCRIPTION, - JSON.valueOf("{ \"name\": \"writer\", \"url\": \"http://localhost:8080/writer\", \"imgUrl\": \"http://localhost:8080/writer.jpg\" }") - ) - .set( - ArticleMainCard.ARTICLE_MAIN_CARD.WORKBOOKS, - JSON.valueOf("[{\"id\": 1, \"title\": \"title\"}]") - ) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectArticleMainCardsRecordQueryExplain() { - val query = articleMainCardDao.selectArticleMainCardsRecordQuery(setOf(1L)) - - val explain = ExplainGenerator.execute(dslContext, query) - ResultGenerator.execute(query, explain, "selectArticleMainCardsRecordQueryExplain") - } - - @Test - fun insertArticleMainCardCommandExplain() { - val command = ArticleMainCardExcludeWorkbookCommand( - articleId = 2L, - articleTitle = "this is title2", - mainImageUrl = URL("http://localhost:8080/image2.jpg"), - categoryCd = CategoryType.fromCode(0)!!.code, - createdAt = LocalDateTime.now(), - writerId = 1L, - writerEmail = "writer@gmail.com", - writerName = "writer", - writerUrl = URL("http://localhost:8080/writer"), - writerImgUrl = URL("http://localhost:8080/writer.jpg") - ).let { - articleMainCardDao.insertArticleMainCardCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertArticleMainCardCommandExplain") - } - - @Test - fun updateArticleMainCardSetWorkbookCommandExplain() { - val command = UpdateArticleMainCardWorkbookCommand( - articleId = 1L, - workbooks = listOf( - WorkbookCommand( - id = 1L, - title = "workbook1" - ), - WorkbookCommand( - id = 2L, - title = "workbook2" - ) - ) - ).let { - articleMainCardDao.updateArticleMainCardSetWorkbookCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateArticleMainCardSetWorkbookCommandExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewCountDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewCountDaoExplainGenerateTest.kt deleted file mode 100644 index dd7cfc3d5..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewCountDaoExplainGenerateTest.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.few.api.repo.explain.article - -import com.few.api.repo.dao.article.ArticleViewCountDao -import com.few.api.repo.dao.article.command.ArticleViewCountCommand -import com.few.api.repo.dao.article.query.ArticleViewCountQuery -import com.few.api.repo.dao.article.query.SelectArticlesOrderByViewsQuery -import com.few.api.repo.dao.article.query.SelectRankByViewsQuery -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.ArticleViewCount -import org.jooq.DSLContext -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -@Tag("explain") -class ArticleViewCountDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var articleViewCountDao: ArticleViewCountDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(ArticleViewCount.ARTICLE_VIEW_COUNT).execute() - dslContext.insertInto(ArticleViewCount.ARTICLE_VIEW_COUNT) - .set(ArticleViewCount.ARTICLE_VIEW_COUNT.ARTICLE_ID, 1L) - .set(ArticleViewCount.ARTICLE_VIEW_COUNT.VIEW_COUNT, 1) - .set(ArticleViewCount.ARTICLE_VIEW_COUNT.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectArticleViewCountQueryExplain() { - val query = ArticleViewCountCommand(1L).let { - articleViewCountDao.selectArticleViewCountQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - ResultGenerator.execute(query, explain, "selectArticleViewCountQueryExplain") - } - - @Test - fun upsertArticleViewCountQueryExplain() { - val command = ArticleViewCountQuery( - articleId = 1L, - categoryType = CategoryType.fromCode(0)!! - ).let { - articleViewCountDao.upsertArticleViewCountQuery(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "upsertArticleViewCountQueryExplain") - } - - @Test - fun insertArticleViewCountToZeroQueryExplain() { - val command = ArticleViewCountQuery( - articleId = 1L, - categoryType = CategoryType.fromCode(0)!! - ).let { - articleViewCountDao.insertArticleViewCountToZeroQuery(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertArticleViewCountToZeroQueryExplain") - } - - @Test - fun selectRankByViewsQueryExplain() { - val query = SelectRankByViewsQuery(1L).let { - articleViewCountDao.selectRankByViewsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - ResultGenerator.execute(query, explain, "selectRankByViewsQueryExplain") - } - - @Test - fun selectArticlesOrderByViewsQueryExplain() { - val query = SelectArticlesOrderByViewsQuery( - offset = 0, - category = CategoryType.fromCode(0)!! - ).let { - articleViewCountDao.selectArticlesOrderByViewsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - ResultGenerator.execute(query, explain, "selectArticlesOrderByViewsQueryExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewHisDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewHisDaoExplainGenerateTest.kt deleted file mode 100644 index 11b526e93..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/article/ArticleViewHisDaoExplainGenerateTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.few.api.repo.explain.article - -import com.few.api.repo.dao.article.ArticleViewHisDao -import com.few.api.repo.dao.article.command.ArticleViewHisCommand -import com.few.api.repo.dao.article.query.ArticleViewHisCountQuery -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.* -import org.jooq.DSLContext -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -@Tag("explain") -class ArticleViewHisDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var articleViewHisDao: ArticleViewHisDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(ArticleViewHis.ARTICLE_VIEW_HIS).execute() - dslContext.insertInto(ArticleViewHis.ARTICLE_VIEW_HIS) - .set(ArticleViewHis.ARTICLE_VIEW_HIS.ARTICLE_MST_ID, 1L) - .set(ArticleViewHis.ARTICLE_VIEW_HIS.MEMBER_ID, 1L) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun countArticleViewsQueryExplain() { - val query = ArticleViewHisCountQuery(1L).let { - articleViewHisDao.countArticleViewsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - ResultGenerator.execute(query, explain, "selectArticleViewCountQueryExplain") - } - - @Test - fun insertArticleViewHisCommandExplain() { - val command = ArticleViewHisCommand( - articleId = 1L, - memberId = 1L - ).let { - articleViewHisDao.insertArticleViewHisCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertArticleViewHisCommandExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/member/MemberDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/member/MemberDaoExplainGenerateTest.kt deleted file mode 100644 index cd2315063..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/member/MemberDaoExplainGenerateTest.kt +++ /dev/null @@ -1,166 +0,0 @@ -package com.few.api.repo.explain.member - -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.DeleteMemberCommand -import com.few.api.repo.dao.member.command.InsertMemberCommand -import com.few.api.repo.dao.member.command.UpdateDeletedMemberTypeCommand -import com.few.api.repo.dao.member.command.UpdateMemberTypeCommand -import com.few.api.repo.dao.member.query.* -import com.few.api.repo.dao.member.support.WriterDescriptionJsonMapper -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.MemberType -import io.github.oshai.kotlinlogging.KotlinLogging -import org.jooq.DSLContext -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -@Tag("explain") -class MemberDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var memberDao: MemberDao - - @Autowired - private lateinit var writerDescriptionJsonMapper: WriterDescriptionJsonMapper - - @Test - fun selectWriterQueryExplain() { - val query = SelectWriterQuery(1).let { - memberDao.selectWriterQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWriterQueryExplain") - } - - @Test - fun selectWritersQueryExplain() { - val query = listOf(2L, 3L).let { - memberDao.selectWritersQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWritersQueryExplain") - } - - @Test - fun selectWritersQueryExplainByWorkbookIds() { - val query = BrowseWorkbookWritersQuery(listOf(2L, 3L)).let { - memberDao.selectWritersQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWritersQueryExplainByWorkbookIds") - } - - @Test - fun selectMemberByEmailQueryExplain() { - val query = SelectMemberByEmailQuery("member@gmail.com").let { - memberDao.selectMemberByEmailQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectMemberByEmailQueryExplainExplain") - } - - @Test - fun selectMemberByEmailNotConsiderDeletedAtQueryExplain() { - val query = SelectMemberByEmailNotConsiderDeletedAtQuery("test@gmail.com").let { - memberDao.selectMemberByEmailQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectMemberByEmailNotConsiderDeletedAtQueryExplain") - } - - @Test - fun insertMemberCommandExplain() { - val command = InsertMemberCommand( - email = "test100@gmail.com", - memberType = MemberType.NORMAL - ).let { - memberDao.insertMemberCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertMemberCommandExplain") - } - - @Test - fun selectMemberEmailQueryExplain() { - val query = SelectMemberEmailQuery(1).let { - memberDao.selectMemberEmailQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectMemberEmailQueryExplain") - } - - @Test - fun selectMemberIdAndTypeQueryExplain() { - val query = 1L.let { - memberDao.selectMemberIdAndTypeQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectMemberIdAndTypeQueryExplain") - } - - @Test - fun updateMemberTypeCommandExplain() { - val command = UpdateMemberTypeCommand( - id = 1, - memberType = MemberType.WRITER - ).let { - memberDao.updateMemberTypeCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateMemberTypeCommandExplain") - } - - @Test - fun updateDeletedMemberTypeCommandExplain() { - val command = UpdateDeletedMemberTypeCommand( - id = 1, - memberType = MemberType.WRITER - ).let { - memberDao.updateMemberTypeCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateDeletedMemberTypeCommandExplain") - } - - @Test - fun deleteMemberCommandExplain() { - val command = DeleteMemberCommand( - memberId = 1 - ).let { - memberDao.deleteMemberCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "deleteMemberCommandExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/problem/ProblemDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/problem/ProblemDaoExplainGenerateTest.kt deleted file mode 100644 index 454d3d5b8..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/problem/ProblemDaoExplainGenerateTest.kt +++ /dev/null @@ -1,138 +0,0 @@ -package com.few.api.repo.explain.problem - -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.SubmitHistoryDao -import com.few.api.repo.dao.problem.command.InsertProblemsCommand -import com.few.api.repo.dao.problem.command.InsertSubmitHistoryCommand -import com.few.api.repo.dao.problem.query.SelectProblemAnswerQuery -import com.few.api.repo.dao.problem.query.SelectProblemQuery -import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery -import com.few.api.repo.dao.problem.support.Content -import com.few.api.repo.dao.problem.support.Contents -import com.few.api.repo.dao.problem.support.ContentsJsonMapper -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.* -import org.jooq.DSLContext -import org.jooq.JSON -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -@Tag("explain") -class ProblemDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var problemDao: ProblemDao - - @Autowired - private lateinit var submitHistoryDao: SubmitHistoryDao - - @Autowired - private lateinit var contentsJsonMapper: ContentsJsonMapper - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Problem.PROBLEM).execute() - val contents = Contents( - listOf( - Content(1, "content1"), - Content(2, "content2") - ) - ).let { - contentsJsonMapper.toJson(it) - } - dslContext.insertInto(Problem.PROBLEM) - .set(Problem.PROBLEM.ID, 1) - .set(Problem.PROBLEM.ARTICLE_ID, 1) - .set(Problem.PROBLEM.TITLE, "problem title") - .set(Problem.PROBLEM.CONTENTS, JSON.valueOf(contents)) - .set(Problem.PROBLEM.ANSWER, "1") - .set(Problem.PROBLEM.EXPLANATION, "explanation") - .set(Problem.PROBLEM.CREATOR_ID, 1) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectProblemContentsQueryExplain() { - val query = SelectProblemQuery(1L).let { - problemDao.selectProblemContentsQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectProblemContentsQueryExplain") - } - - @Test - fun selectProblemAnswerQueryExplain() { - val query = SelectProblemAnswerQuery(1L).let { - problemDao.selectProblemAnswerQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectProblemAnswerQueryExplain") - } - - @Test - fun selectProblemsByArticleIdQueryExplain() { - val query = SelectProblemsByArticleIdQuery(1L).let { - problemDao.selectProblemsByArticleIdQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectProblemsByArticleIdQueryExplain") - } - - @Test - fun insertProblemCommandExplain() { - val command = InsertProblemsCommand( - articleId = 1L, - createrId = 1, - title = "problem title", - contents = Contents( - listOf( - Content(1, "content1"), - Content(2, "content2") - ) - ), - answer = "1", - explanation = "explanation" - ).let { - problemDao.insertProblemCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertProblemCommandExplain") - } - - @Test - fun insertSubmitCommandExplain() { - val command = InsertSubmitHistoryCommand( - memberId = 1L, - problemId = 1L, - submitAns = "1", - isSolved = true - ).let { - submitHistoryDao.insertSubmitCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertSubmitCommandExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/subscription/SubscriptionDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/subscription/SubscriptionDaoExplainGenerateTest.kt deleted file mode 100644 index 824b38bf0..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/subscription/SubscriptionDaoExplainGenerateTest.kt +++ /dev/null @@ -1,218 +0,0 @@ -package com.few.api.repo.explain.subscription - -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.* -import com.few.api.repo.dao.subscription.query.* -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.* -import org.jooq.DSLContext -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired - -@Tag("explain") -class SubscriptionDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var subscriptionDao: SubscriptionDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Subscription.SUBSCRIPTION).execute() - dslContext.deleteFrom(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE).execute() - dslContext.insertInto(Subscription.SUBSCRIPTION) - .set(Subscription.SUBSCRIPTION.MEMBER_ID, 1L) - .set(Subscription.SUBSCRIPTION.TARGET_WORKBOOK_ID, 1L) - .set(Subscription.SUBSCRIPTION.PROGRESS, 0) - .execute() - dslContext.insertInto(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.WORKBOOK_ID, 1L) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.ARTICLE_ID, 1L) - .set(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.DAY_COL, 1) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectTopWorkbookSubscriptionStatusQuery() { - val query = SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery( - memberId = 1L, - workbookId = 1L - ).let { - subscriptionDao.selectTopWorkbookSubscriptionStatusQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectTopWorkbookSubscriptionStatusQueryExplain") - } - - @Test - fun selectAllWorkbookInActiveSubscriptionStatusQueryExplain() { - val query = SelectAllMemberWorkbookInActiveSubscriptionQuery( - memberId = 1L, - unsubOpinion = "receive.all" - ).let { - subscriptionDao.selectAllWorkbookInActiveSubscriptionStatusQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectAllWorkbookInActiveSubscriptionStatusQueryExplain") - } - - @Test - fun selectAllWorkbookActiveSubscriptionStatusQueryExplain() { - val query = SelectAllMemberWorkbookActiveSubscriptionQuery( - memberId = 1L - ).let { - subscriptionDao.selectAllWorkbookActiveSubscriptionStatusQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectAllWorkbookActiveSubscriptionStatusQueryExplain") - } - - @Test - fun countWorkbookMappedArticlesQueryExplain() { - val query = CountWorkbookMappedArticlesQuery( - workbookId = 1L - ).let { - subscriptionDao.countWorkbookMappedArticlesQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "countWorkbookMappedArticlesQueryExplain") - } - - @Test - fun insertWorkbookSubscriptionCommandExplain() { - val command = InsertWorkbookSubscriptionCommand( - memberId = 1L, - workbookId = 1L - ).let { - subscriptionDao.insertWorkbookSubscriptionCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "insertWorkbookSubscriptionCommandExplain") - } - - @Test - fun updateDeletedAtInAllSubscriptionCommandExplain() { - val command = UpdateDeletedAtInAllSubscriptionCommand( - memberId = 1L, - opinion = "test" - ).let { - subscriptionDao.updateDeletedAtInAllSubscriptionCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateDeletedAtInAllSubscriptionCommandExplain") - } - - @Test - fun countAllWorkbookSubscriptionQueryExplain() { - val query = subscriptionDao.countAllWorkbookSubscriptionQuery() - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "countAllWorkbookSubscriptionQueryExplain") - } - - @Test - fun reSubscribeWorkBookSubscriptionCommandExplain() { - val command = InsertWorkbookSubscriptionCommand( - memberId = 1L, - workbookId = 1L - ).let { - subscriptionDao.reSubscribeWorkBookSubscriptionCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "reSubscribeWorkBookSubscriptionCommandExplain") - } - - @Test - fun updateDeletedAtInWorkbookSubscriptionCommandExplain() { - val command = UpdateDeletedAtInWorkbookSubscriptionCommand( - memberId = 1L, - workbookId = 1L, - opinion = "test" - ).let { - subscriptionDao.updateDeletedAtInWorkbookSubscriptionCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateDeletedAtInWorkbookSubscriptionCommandExplain") - } - - @Test - fun updateArticleProgressCommandExplain() { - val command = UpdateArticleProgressCommand(1L, 1L) - .let { - subscriptionDao.updateArticleProgressCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateArticleProgressCommandExplain") - } - - @Test - fun updateLastArticleProgressCommandExplain() { - val command = UpdateLastArticleProgressCommand(1L, 1L) - .let { - subscriptionDao.updateLastArticleProgressCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "updateLastArticleProgressCommandExplain") - } - - @Test - fun selectAllSubscriptionSendStatusQueryExplain() { - val query = subscriptionDao.selectAllSubscriptionSendStatusQuery( - SelectAllSubscriptionSendStatusQuery( - memberId = 1L, - workbookIds = listOf(1L) - ) - ) - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectAllSubscriptionSendStatusQueryExplain") - } - - @Test - fun selectSubscriptionTimeRecordQueryExplain() { - val query = subscriptionDao.selectSubscriptionTimeRecordQuery( - SelectSubscriptionQuery( - memberId = 1L, - workbookId = 1L - ) - ) - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectSubscriptionTimeRecordQueryExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/explain/workbook/WorkbookDaoExplainGenerateTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/explain/workbook/WorkbookDaoExplainGenerateTest.kt deleted file mode 100644 index db176769b..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/explain/workbook/WorkbookDaoExplainGenerateTest.kt +++ /dev/null @@ -1,135 +0,0 @@ -package com.few.api.repo.explain.workbook - -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.command.InsertWorkBookCommand -import com.few.api.repo.dao.workbook.command.MapWorkBookToArticleCommand -import com.few.api.repo.dao.workbook.query.BrowseWorkBookQueryWithSubscriptionCountQuery -import com.few.api.repo.dao.workbook.query.SelectAllWorkbookTitleQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookLastArticleIdQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery -import com.few.api.repo.explain.ExplainGenerator -import com.few.api.repo.explain.InsertUpdateExplainGenerator -import com.few.api.repo.explain.ResultGenerator -import com.few.api.repo.jooq.JooqTestSpec -import com.few.data.common.code.CategoryType -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.* -import org.jooq.DSLContext -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Tag -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import java.net.URL - -@Tag("explain") -class WorkbookDaoExplainGenerateTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - @Autowired - private lateinit var workbookDao: WorkbookDao - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Workbook.WORKBOOK).execute() - dslContext.insertInto(Workbook.WORKBOOK) - .set(Workbook.WORKBOOK.ID, 1) - .set(Workbook.WORKBOOK.TITLE, "title1") - .set(Workbook.WORKBOOK.MAIN_IMAGE_URL, "http://localhost:8080/image1.jpg") - .set(Workbook.WORKBOOK.CATEGORY_CD, CategoryType.fromCode(0)!!.code) - .set(Workbook.WORKBOOK.DESCRIPTION, "description1") - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - fun selectWorkBookQueryExplain() { - val query = SelectWorkBookRecordQuery(1L).let { - workbookDao.selectWorkBookQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWorkBookQueryExplain") - } - - @Test - fun insertWorkBookCommandExplain() { - val command = InsertWorkBookCommand( - title = "title2", - mainImageUrl = URL("http://localhost:8080/image2.jpg"), - description = "description2", - category = CategoryType.fromCode(0)!!.name - ).let { - workbookDao.insertWorkBookCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - ResultGenerator.execute(command, explain, "insertWorkBookCommandExplain") - } - - @Test - fun browseWorkBookQueryNoConditionQueryExplain() { - val query = BrowseWorkBookQueryWithSubscriptionCountQuery(-1).let { - workbookDao.browseWorkBookQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "browseWorkBookQueryNoConditionQuery") - } - - @Test - fun browseWorkBookQueryCategoryConditionExplain() { - val query = BrowseWorkBookQueryWithSubscriptionCountQuery(CategoryType.fromCode(0)!!.code).let { - workbookDao.browseWorkBookQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "browseWorkBookQueryCategoryCondition") - } - - @Test - fun mapWorkBookToArticleCommandExplain() { - val command = MapWorkBookToArticleCommand( - workbookId = 1L, - articleId = 1L, - dayCol = 1 - ).let { - workbookDao.mapWorkBookToArticleCommand(it) - } - - val explain = InsertUpdateExplainGenerator.execute(dslContext, command.sql, command.bindValues) - - ResultGenerator.execute(command, explain, "mapWorkBookToArticleCommandExplain") - } - - @Test - fun selectWorkBookLastArticleIdQueryExplain() { - val query = SelectWorkBookLastArticleIdQuery(1L).let { - workbookDao.selectWorkBookLastArticleIdQuery(it) - } - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectWorkBookLastArticleIdQueryExplain") - } - - @Test - fun selectAllWorkbookTitleQueryExplain() { - val query = workbookDao.selectAllWorkbookTitleQuery( - SelectAllWorkbookTitleQuery( - listOf(1L) - ) - ) - - val explain = ExplainGenerator.execute(dslContext, query) - - ResultGenerator.execute(query, explain, "selectAllWorkbookTitleQueryExplain") - } -} \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestConfig.kt b/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestConfig.kt deleted file mode 100644 index 8b199b499..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestConfig.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.few.api.repo.jooq - -import com.few.api.repo.config.ApiRepoConfig -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.boot.test.context.TestConfiguration -import org.springframework.context.annotation.ComponentScan - -@TestConfiguration -@EnableAutoConfiguration -@ComponentScan(basePackages = [ApiRepoConfig.BASE_PACKAGE]) -class JooqTestConfig \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestSpec.kt b/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestSpec.kt deleted file mode 100644 index 6a11439a9..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/jooq/JooqTestSpec.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.few.api.repo.jooq - -import com.fasterxml.jackson.databind.ObjectMapper -import com.few.api.repo.RepoTestContainerInitializer -import com.few.api.repo.config.ApiRepoConfig -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.test.context.ActiveProfiles -import org.springframework.test.context.ContextConfiguration - -@ActiveProfiles("new", "test") -@SpringBootTest(classes = [ApiRepoConfig::class, ObjectMapper::class]) -@ContextConfiguration(initializers = [RepoTestContainerInitializer::class]) -abstract class JooqTestSpec \ No newline at end of file diff --git a/api-repo/src/test/kotlin/com/few/api/repo/jooq/_SampleJooqTest.kt b/api-repo/src/test/kotlin/com/few/api/repo/jooq/_SampleJooqTest.kt deleted file mode 100644 index 0f74bed48..000000000 --- a/api-repo/src/test/kotlin/com/few/api/repo/jooq/_SampleJooqTest.kt +++ /dev/null @@ -1,196 +0,0 @@ -package com.few.api.repo.jooq - -import io.github.oshai.kotlinlogging.KotlinLogging -import jooq.jooq_dsl.tables.Member -import org.jooq.DSLContext -import org.jooq.JSON -import org.jooq.exception.DataAccessException -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.dao.DuplicateKeyException -import org.springframework.test.annotation.Rollback -import org.springframework.transaction.annotation.Transactional -import java.time.LocalDateTime - -class _SampleJooqTest : JooqTestSpec() { - - private val log = KotlinLogging.logger {} - - @Autowired - private lateinit var dslContext: DSLContext - - companion object { - const val EMAIL = "test1@gmail.com" - const val TYPECD: Byte = 1 - } - - @BeforeEach - fun setUp() { - log.debug { "===== start setUp =====" } - dslContext.deleteFrom(Member.MEMBER).execute() - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.EMAIL, EMAIL) - .set(Member.MEMBER.TYPE_CD, TYPECD) - .execute() - log.debug { "===== finish setUp =====" } - } - - @Test - @Transactional - fun `새로운 정보를 저장합니다`() { - // given - val email = "test2@gmail.com" - val typeCd: Byte = 1 - - // when - val result = dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.EMAIL, email) - .set(Member.MEMBER.TYPE_CD, typeCd) - .execute() - - // then - assert(result > 0) - } - - @Disabled // TODO: 깃헙에서 테스트 실행시 assertThrows가 잡히지 않는 문제 - @Test - @Transactional - fun `이메일이 중복되는 경우 저장에 실패합니다`() { - // when & then - assertThrows { - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.EMAIL, EMAIL) - .set(Member.MEMBER.TYPE_CD, TYPECD) - .execute() - } - } - - @Test - @Transactional - fun `이메일 값을 입력하지 않은면 저장에 실패합니다`() { - // when & then - assertThrows { - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.TYPE_CD, TYPECD) - .execute() - } - } - - @Test - @Transactional - fun `타입 코드 값을 입력하지 않은면 저장에 실패합니다`() { - // when & then - assertThrows { - dslContext.insertInto(Member.MEMBER) - .set(Member.MEMBER.EMAIL, EMAIL) - .execute() - } - } - - @Test - fun `이메일 일치 조건을 통해 정보를 조회합니다`() { - // when - val result = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .fetchOne() - - // then - assert(result != null) - assert(result!!.email == EMAIL) - assert(result.typeCd == TYPECD) - assert(result.description.equals(JSON.json("{}"))) - assert(result.createdAt != null) - assert(result.deletedAt == null) - } - - @Test - fun `이메일 불일치 조건을 통해 유저를 조회합니다`() { - // when - val result = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.ne("test2@gmail.com")) - .and(Member.MEMBER.DELETED_AT.isNull()) - .fetch() - - // then - assert(result.isNotEmpty()) - } - - @Test - @Transactional - fun `이메일을 수정합니다`() { - // given - val newEmail = "test2@gmail.com" - - // when - val update = dslContext.update(Member.MEMBER) - .set(Member.MEMBER.EMAIL, newEmail) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .execute() - - val result = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.eq(newEmail)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .fetchOne() - - // then - assert(update > 0) - assert(result != null) - assert(result!!.email == newEmail) - } - - @Test - @Transactional - fun `타입 코드를 수정합니다`() { - // given - val newTypeCd: Byte = 2 - - // when - val update = dslContext.update(Member.MEMBER) - .set(Member.MEMBER.TYPE_CD, newTypeCd) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .execute() - - val result = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .fetchOne() - - // then - assert(update > 0) - assert(result != null) - assert(result!!.typeCd == newTypeCd) - } - - @Test - @Rollback(false) - @Transactional - fun `소프트 삭제를 수행합니다`() { - // given - val deleteTarget = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .fetchOne() - - // when - val softDelete = dslContext.update(Member.MEMBER) - .set(Member.MEMBER.DELETED_AT, LocalDateTime.now()) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .and(Member.MEMBER.DELETED_AT.isNull()) - .execute() - - val result = dslContext.selectFrom(Member.MEMBER) - .where(Member.MEMBER.EMAIL.eq(EMAIL)) - .fetchOne() - - // then - assert(deleteTarget != null) - assert(softDelete > 0) - assert(result != null) - } -} \ No newline at end of file diff --git a/api-repo/src/test/resources/application-test.yml b/api-repo/src/test/resources/application-test.yml deleted file mode 100644 index b4ab3f82f..000000000 --- a/api-repo/src/test/resources/application-test.yml +++ /dev/null @@ -1,26 +0,0 @@ -logging: - level: - org.jooq: DEBUG - org.springframework.jdbc: DEBUG - com.few.api.repo: DEBUG - org.testcontainers: INFO - -spring: - datasource: - hikari: - jdbcUrl: jdbc:mysql://localhost:33306/api?allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&allowMultiQueries=true - username: root - password: root - driver-class-name: com.mysql.cj.jdbc.Driver - pool-name: MAIN-POOL - minimum-idle: 4 - maximum-pool-size: 16 - connection-timeout: 30000 # 30 seconds - idle-timeout: 300000 # 5 minutes - max-lifetime: 1800000 # 30 minutes - connection-test-query: SELECT 1 - flyway: - locations: classpath:db/migration/entity - sql-migration-suffixes: sql - baseline-on-migrate: true - baseline-version: 0 diff --git a/api-repo/src/test/resources/docker-compose.yml b/api-repo/src/test/resources/docker-compose.yml deleted file mode 100644 index 105297097..000000000 --- a/api-repo/src/test/resources/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '3.7' - -services: - mysql: - image: mysql/mysql-server:8.0.27 - environment: - - MYSQL_ROOT_PASSWORD=root - - MYSQL_ROOT_HOST=% - - TZ=Asia/Seoul - command: [ "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--lower_case_table_names=1", "--max_connections=2048", "--wait_timeout=3600" ] - ports: - - "33306:3306" - volumes: - - ./mysql-init.d:/docker-entrypoint-initdb.d diff --git a/api-repo/src/test/resources/mysql-init.d/00_init.sql b/api-repo/src/test/resources/mysql-init.d/00_init.sql deleted file mode 100644 index 103b9b8bd..000000000 --- a/api-repo/src/test/resources/mysql-init.d/00_init.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE - USER 'few-test-local'@'localhost' IDENTIFIED BY 'few-test-local'; -CREATE - USER 'few-test-local'@'%' IDENTIFIED BY 'few-test-local'; - -GRANT ALL PRIVILEGES ON *.* TO - 'few-test-local'@'localhost'; -GRANT ALL PRIVILEGES ON *.* TO - 'few-test-local'@'%'; - -CREATE - DATABASE api DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/api/build.gradle.kts b/api/build.gradle.kts index dc1735a11..90a84333b 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -10,20 +10,16 @@ tasks.withType(BootJar::class.java) { dependencies { /** module */ implementation(project(":api-repo")) - implementation(project(":batch")) implementation(project(":email")) implementation(project(":storage")) + implementation(project(":web")) /** spring starter */ - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-aop") - /** jwt */ - implementation("io.jsonwebtoken:jjwt-api:${DependencyVersion.JWT}") - implementation("io.jsonwebtoken:jjwt-impl:${DependencyVersion.JWT}") - implementation("io.jsonwebtoken:jjwt-jackson:${DependencyVersion.JWT}") + /** jooq */ + jooqCodegen("org.jooq:jooq-meta-extensions:${DependencyVersion.JOOQ}") /** aspectj */ implementation("org.aspectj:aspectjweaver:1.9.5") @@ -33,6 +29,12 @@ dependencies { /** for convert to webp */ implementation("com.sksamuel.scrimage:scrimage-webp:${DependencyVersion.SCRIMAGE}") + /** commonmark - markdown to html */ + implementation("org.commonmark:commonmark:${DependencyVersion.COMMONMARK}") + + /** jsoup - html parser */ + implementation("org.jsoup:jsoup:1.15.3") + /** swagger & restdocs */ implementation("org.springdoc:springdoc-openapi-ui:${DependencyVersion.SPRINGDOC}") implementation("org.springframework.restdocs:spring-restdocs-webtestclient") diff --git a/api/src/main/kotlin/com/few/api/config/AspectConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiAspectConfig.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/config/AspectConfig.kt rename to api/src/main/kotlin/com/few/api/config/ApiAspectConfig.kt index ad3a4e76d..9cd3d5750 100644 --- a/api/src/main/kotlin/com/few/api/config/AspectConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiAspectConfig.kt @@ -5,4 +5,4 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy @Configuration @EnableAspectJAutoProxy -class AspectConfig \ No newline at end of file +class ApiAspectConfig \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/config/AsyncConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiAsyncConfig.kt similarity index 89% rename from api/src/main/kotlin/com/few/api/config/AsyncConfig.kt rename to api/src/main/kotlin/com/few/api/config/ApiAsyncConfig.kt index c88333103..657f6a277 100644 --- a/api/src/main/kotlin/com/few/api/config/AsyncConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiAsyncConfig.kt @@ -5,4 +5,4 @@ import org.springframework.scheduling.annotation.EnableAsync @Configuration @EnableAsync -class AsyncConfig \ No newline at end of file +class ApiAsyncConfig \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/config/ApiConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiConfig.kt index cf96f3cf5..176c8369f 100644 --- a/api/src/main/kotlin/com/few/api/config/ApiConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiConfig.kt @@ -1,31 +1,30 @@ package com.few.api.config -import com.few.api.repo.config.ApiRepoConfig -import com.few.batch.config.BatchConfig -import com.few.email.config.MailConfig -import com.few.storage.document.config.DocumentStorageConfig -import com.few.storage.image.config.ImageStorageConfig +import email.config.MailConfig +import repo.config.RepoConfig +import storage.document.config.DocumentStorageConfig +import storage.image.config.ImageStorageConfig import org.springframework.boot.context.properties.ConfigurationPropertiesScan import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import +import security.config.SecurityConfig +import web.config.WebConfig @Configuration @ComponentScan(basePackages = [ApiConfig.BASE_PACKAGE]) @Import( - ApiRepoConfig::class, - BatchConfig::class, + RepoConfig::class, MailConfig::class, ImageStorageConfig::class, - DocumentStorageConfig::class + DocumentStorageConfig::class, + WebConfig::class, + SecurityConfig::class ) @ConfigurationPropertiesScan(basePackages = [ApiConfig.BASE_PACKAGE]) class ApiConfig { companion object { const val BASE_PACKAGE = "com.few.api" - const val SERVICE_NAME = "few" - const val MODULE_NAME = "few-api" const val BEAN_NAME_PREFIX = "fewApi" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/config/DatabaseAccessThreadPoolConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiDatabaseAccessThreadPoolConfig.kt similarity index 81% rename from api/src/main/kotlin/com/few/api/config/DatabaseAccessThreadPoolConfig.kt rename to api/src/main/kotlin/com/few/api/config/ApiDatabaseAccessThreadPoolConfig.kt index 69cb08dcf..bdd490ede 100644 --- a/api/src/main/kotlin/com/few/api/config/DatabaseAccessThreadPoolConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiDatabaseAccessThreadPoolConfig.kt @@ -1,6 +1,6 @@ package com.few.api.config -import com.few.api.config.properties.ThreadPoolProperties +import com.few.api.config.properties.ApiThreadPoolProperties import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.context.annotation.Bean @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor @Configuration -class DatabaseAccessThreadPoolConfig { +class ApiDatabaseAccessThreadPoolConfig { private val log = KotlinLogging.logger {} companion object { @@ -16,9 +16,9 @@ class DatabaseAccessThreadPoolConfig { } @Bean - @ConfigurationProperties(prefix = "database.thread-pool") - fun databaseAccessThreadPoolProperties(): ThreadPoolProperties { - return ThreadPoolProperties() + @ConfigurationProperties(prefix = "thread-pool.database") + fun databaseAccessThreadPoolProperties(): ApiThreadPoolProperties { + return ApiThreadPoolProperties() } @Bean(DATABASE_ACCESS_POOL) diff --git a/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiLocalCacheConfig.kt similarity index 94% rename from api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt rename to api/src/main/kotlin/com/few/api/config/ApiLocalCacheConfig.kt index 9ee3a86ee..b8ed7839c 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiLocalCacheConfig.kt @@ -1,6 +1,5 @@ -package com.few.api.repo.config +package com.few.api.config -import com.few.api.repo.common.LocalCacheEventLogger import io.github.oshai.kotlinlogging.KotlinLogging import org.ehcache.config.builders.CacheConfigurationBuilder import org.ehcache.config.builders.ResourcePoolsBuilder @@ -14,10 +13,11 @@ import org.springframework.cache.annotation.EnableCaching import org.springframework.cache.jcache.JCacheCacheManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import com.few.api.domain.common.repo.event.ApiLocalCacheEventListener @Configuration @EnableCaching -class LocalCacheConfig { +class ApiLocalCacheConfig { private val log = KotlinLogging.logger {} companion object { @@ -36,7 +36,7 @@ class LocalCacheConfig { EventType.REMOVED, EventType.UPDATED ), - LocalCacheEventLogger::class.java + ApiLocalCacheEventListener::class.java ) val cacheManager = EhcacheCachingProvider().cacheManager diff --git a/api/src/main/kotlin/com/few/api/exception/support/MessageSourceAccessor.kt b/api/src/main/kotlin/com/few/api/config/ApiMessageSourceAccessor.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/exception/support/MessageSourceAccessor.kt rename to api/src/main/kotlin/com/few/api/config/ApiMessageSourceAccessor.kt index 24f26fdd0..ec36b5c07 100644 --- a/api/src/main/kotlin/com/few/api/exception/support/MessageSourceAccessor.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiMessageSourceAccessor.kt @@ -1,4 +1,4 @@ -package com.few.api.exception.support +package com.few.api.config import org.springframework.context.MessageSource import org.springframework.context.MessageSourceAware @@ -7,7 +7,7 @@ import org.springframework.stereotype.Component import java.util.* @Component -class MessageSourceAccessor : MessageSourceAware { +class ApiMessageSourceAccessor : MessageSourceAware { override fun setMessageSource(messageSource: MessageSource) { messageSourceAccessor = MessageSourceAccessor( messageSource, diff --git a/api/src/main/kotlin/com/few/api/config/MessageSourceConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiMessageSourceConfig.kt similarity index 62% rename from api/src/main/kotlin/com/few/api/config/MessageSourceConfig.kt rename to api/src/main/kotlin/com/few/api/config/ApiMessageSourceConfig.kt index 1f6843074..1f967246f 100644 --- a/api/src/main/kotlin/com/few/api/config/MessageSourceConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiMessageSourceConfig.kt @@ -6,7 +6,7 @@ import org.springframework.context.support.ReloadableResourceBundleMessageSource import java.nio.charset.StandardCharsets @Configuration -class MessageSourceConfig { +class ApiMessageSourceConfig { @Bean fun messageSource(): ReloadableResourceBundleMessageSource { val messageSource = ReloadableResourceBundleMessageSource() @@ -19,15 +19,15 @@ class MessageSourceConfig { companion object { private val MESSAGE_SOURCE_CLASSPATH_LIST = listOf( - "classpath:messages/article", - "classpath:messages/document", - "classpath:messages/external", - "classpath:messages/image", - "classpath:messages/member", - "classpath:messages/problem", - "classpath:messages/submit", - "classpath:messages/subscribe", - "classpath:messages/workbook" + "classpath:messages/api/article", + "classpath:messages/api/document", + "classpath:messages/api/external", + "classpath:messages/api/image", + "classpath:messages/api/member", + "classpath:messages/api/problem", + "classpath:messages/api/submit", + "classpath:messages/api/subscribe", + "classpath:messages/api/workbook" ) } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/config/ApiThreadPoolConfig.kt b/api/src/main/kotlin/com/few/api/config/ApiThreadPoolConfig.kt index 855e4826b..972d8bb1f 100644 --- a/api/src/main/kotlin/com/few/api/config/ApiThreadPoolConfig.kt +++ b/api/src/main/kotlin/com/few/api/config/ApiThreadPoolConfig.kt @@ -1,11 +1,12 @@ package com.few.api.config -import com.few.api.config.properties.ThreadPoolProperties +import com.few.api.config.properties.ApiThreadPoolProperties import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor +import web.config.ClonedTaskDecorator @Configuration class ApiThreadPoolConfig { @@ -17,9 +18,9 @@ class ApiThreadPoolConfig { } @Bean - @ConfigurationProperties(prefix = "discord.thread-pool") - fun disCordThreadPoolProperties(): ThreadPoolProperties { - return ThreadPoolProperties() + @ConfigurationProperties(prefix = "thread-pool.discord") + fun disCordThreadPoolProperties(): ApiThreadPoolProperties { + return ApiThreadPoolProperties() } @Bean(DISCORD_HOOK_EVENT_POOL) diff --git a/api/src/main/kotlin/com/few/api/config/properties/ApiThreadPoolProperties.kt b/api/src/main/kotlin/com/few/api/config/properties/ApiThreadPoolProperties.kt new file mode 100644 index 000000000..f500fa7e0 --- /dev/null +++ b/api/src/main/kotlin/com/few/api/config/properties/ApiThreadPoolProperties.kt @@ -0,0 +1,31 @@ +package com.few.api.config.properties + +import java.lang.IllegalStateException + +data class ApiThreadPoolProperties( + var corePoolSize: Int? = null, + var maxPoolSize: Int? = null, + var queueCapacity: Int? = null, + var waitForTasksToCompleteOnShutdown: Boolean? = null, + var awaitTerminationSeconds: Int? = null, +) { + fun getCorePoolSize(): Int { + return corePoolSize ?: throw IllegalStateException("core pool size") + } + + fun getMaxPoolSize(): Int { + return maxPoolSize ?: throw IllegalStateException("max pool size") + } + + fun getQueueCapacity(): Int { + return queueCapacity ?: throw IllegalStateException("queue capacity") + } + + fun getWaitForTasksToCompleteOnShutdown(): Boolean { + return waitForTasksToCompleteOnShutdown ?: throw IllegalStateException("waitForTasksToCompleteOnShutdown") + } + + fun getAwaitTerminationSeconds(): Int { + return awaitTerminationSeconds ?: throw IllegalStateException("awaitTerminationSeconds") + } +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/config/properties/ThreadPoolProperties.kt b/api/src/main/kotlin/com/few/api/config/properties/ThreadPoolProperties.kt deleted file mode 100644 index 5835f26c4..000000000 --- a/api/src/main/kotlin/com/few/api/config/properties/ThreadPoolProperties.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.few.api.config.properties - -import com.few.api.exception.properties.NotSetPropertyException - -data class ThreadPoolProperties( - var corePoolSize: Int? = null, - var maxPoolSize: Int? = null, - var queueCapacity: Int? = null, - var waitForTasksToCompleteOnShutdown: Boolean? = null, - var awaitTerminationSeconds: Int? = null, -) { - fun getCorePoolSize(): Int { - return corePoolSize ?: throw NotSetPropertyException("core pool size") - } - - fun getMaxPoolSize(): Int { - return maxPoolSize ?: throw NotSetPropertyException("max pool size") - } - - fun getQueueCapacity(): Int { - return queueCapacity ?: throw NotSetPropertyException("queue capacity") - } - - fun getWaitForTasksToCompleteOnShutdown(): Boolean { - return waitForTasksToCompleteOnShutdown ?: throw NotSetPropertyException("waitForTasksToCompleteOnShutdown") - } - - fun getAwaitTerminationSeconds(): Int { - return awaitTerminationSeconds ?: throw NotSetPropertyException("awaitTerminationSeconds") - } -} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/AdminController.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/AdminController.kt similarity index 82% rename from api/src/main/kotlin/com/few/api/web/controller/admin/AdminController.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/AdminController.kt index add687c65..578f0cf02 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/AdminController.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/AdminController.kt @@ -1,19 +1,16 @@ -package com.few.api.web.controller.admin +package com.few.api.domain.admin.controller -import com.few.api.domain.admin.document.usecase.* -import com.few.api.domain.admin.document.usecase.dto.* -import com.few.api.web.controller.admin.request.AddArticleRequest -import com.few.api.web.controller.admin.request.AddWorkbookRequest -import com.few.api.web.controller.admin.request.ConvertContentRequest -import com.few.api.web.controller.admin.request.MapArticleRequest -import com.few.api.web.controller.admin.response.AddArticleResponse -import com.few.api.web.controller.admin.response.AddWorkbookResponse -import com.few.api.web.controller.admin.response.ConvertContentResponse -import com.few.api.web.controller.admin.request.ImageSourceRequest -import com.few.api.web.controller.admin.response.ImageSourceResponse -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator -import com.few.api.web.support.MessageCode +import com.few.api.domain.admin.controller.request.AddArticleRequest +import com.few.api.domain.admin.controller.request.AddWorkbookRequest +import com.few.api.domain.admin.controller.request.ConvertContentRequest +import com.few.api.domain.admin.controller.request.MapArticleRequest +import com.few.api.domain.admin.controller.response.AddArticleResponse +import com.few.api.domain.admin.controller.response.AddWorkbookResponse +import com.few.api.domain.admin.controller.response.ConvertContentResponse +import com.few.api.domain.admin.controller.request.ImageSourceRequest +import com.few.api.domain.admin.controller.response.ImageSourceResponse +import com.few.api.domain.admin.usecase.* +import com.few.api.domain.admin.usecase.dto.* import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.validation.annotation.Validated @@ -21,6 +18,9 @@ import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController +import web.ApiResponse +import web.ApiResponseGenerator +import web.MessageCode @Validated @RestController diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/AddArticleRequest.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddArticleRequest.kt similarity index 95% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/AddArticleRequest.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddArticleRequest.kt index 6ec930635..e9fd4d565 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/AddArticleRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddArticleRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.admin.controller.request import jakarta.validation.constraints.NotBlank import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/AddWorkbookRequest.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddWorkbookRequest.kt similarity index 89% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/AddWorkbookRequest.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddWorkbookRequest.kt index 428ca9822..c1c32e3c6 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/AddWorkbookRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/AddWorkbookRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.admin.controller.request import jakarta.validation.constraints.NotBlank import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ConvertContentRequest.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/ConvertContentRequest.kt similarity index 70% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/ConvertContentRequest.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/request/ConvertContentRequest.kt index b1d6096ec..65b9bafdd 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ConvertContentRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/ConvertContentRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.admin.controller.request import org.springframework.web.multipart.MultipartFile diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ImageSourceRequest.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/ImageSourceRequest.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/ImageSourceRequest.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/request/ImageSourceRequest.kt index 10db77e9c..6182d33aa 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ImageSourceRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/ImageSourceRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.admin.controller.request import org.springframework.web.multipart.MultipartFile diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/MapArticleRequest.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/MapArticleRequest.kt similarity index 86% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/MapArticleRequest.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/request/MapArticleRequest.kt index e1947fc08..cfe218873 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/MapArticleRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/request/MapArticleRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.admin.controller.request import jakarta.validation.constraints.Min import jakarta.validation.constraints.NotBlank diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/response/AddArticleResponse.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddArticleResponse.kt similarity index 57% rename from api/src/main/kotlin/com/few/api/web/controller/admin/response/AddArticleResponse.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddArticleResponse.kt index 57c4f7bb0..c83a3ace3 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/response/AddArticleResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddArticleResponse.kt @@ -1,6 +1,6 @@ -package com.few.api.web.controller.admin.response +package com.few.api.domain.admin.controller.response -import com.few.api.domain.admin.document.usecase.dto.AddArticleUseCaseOut +import com.few.api.domain.admin.usecase.dto.AddArticleUseCaseOut data class AddArticleResponse( val articleId: Long, diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/response/AddWorkbookResponse.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddWorkbookResponse.kt similarity index 53% rename from api/src/main/kotlin/com/few/api/web/controller/admin/response/AddWorkbookResponse.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddWorkbookResponse.kt index cead5eb5a..c0f4b495a 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/response/AddWorkbookResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/AddWorkbookResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.response +package com.few.api.domain.admin.controller.response data class AddWorkbookResponse( val workbookId: Long, diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/response/ConvertContentResponse.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/ConvertContentResponse.kt similarity index 68% rename from api/src/main/kotlin/com/few/api/web/controller/admin/response/ConvertContentResponse.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/response/ConvertContentResponse.kt index fa4b890ce..d04107252 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/response/ConvertContentResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/ConvertContentResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.response +package com.few.api.domain.admin.controller.response import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/response/ImageSourceResponse.kt b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/ImageSourceResponse.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/web/controller/admin/response/ImageSourceResponse.kt rename to api/src/main/kotlin/com/few/api/domain/admin/controller/response/ImageSourceResponse.kt index 8ada1c269..bd5114705 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/response/ImageSourceResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/controller/response/ImageSourceResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.response +package com.few.api.domain.admin.controller.response import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/document/DocumentDao.kt b/api/src/main/kotlin/com/few/api/domain/admin/repo/document/DocumentDao.kt similarity index 82% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/document/DocumentDao.kt rename to api/src/main/kotlin/com/few/api/domain/admin/repo/document/DocumentDao.kt index 1b2951d57..61ba8d2b9 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/document/DocumentDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/repo/document/DocumentDao.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.document +package com.few.api.domain.admin.repo.document -import com.few.api.repo.dao.document.command.InsertDocumentIfoCommand +import com.few.api.domain.admin.repo.document.command.InsertDocumentIfoCommand import jooq.jooq_dsl.tables.DocumentIfo import org.jooq.DSLContext import org.springframework.stereotype.Repository diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/document/command/InsertDocumentIfoCommand.kt b/api/src/main/kotlin/com/few/api/domain/admin/repo/document/command/InsertDocumentIfoCommand.kt similarity index 69% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/document/command/InsertDocumentIfoCommand.kt rename to api/src/main/kotlin/com/few/api/domain/admin/repo/document/command/InsertDocumentIfoCommand.kt index 87e75e649..e16bfeb9b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/document/command/InsertDocumentIfoCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/repo/document/command/InsertDocumentIfoCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.document.command +package com.few.api.domain.admin.repo.document.command import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/image/ImageDao.kt b/api/src/main/kotlin/com/few/api/domain/admin/repo/image/ImageDao.kt similarity index 83% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/image/ImageDao.kt rename to api/src/main/kotlin/com/few/api/domain/admin/repo/image/ImageDao.kt index fc901525b..9db7fb551 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/image/ImageDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/repo/image/ImageDao.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.image +package com.few.api.domain.admin.repo.image -import com.few.api.repo.dao.image.command.InsertImageIfoCommand +import com.few.api.domain.admin.repo.image.command.InsertImageIfoCommand import jooq.jooq_dsl.tables.ImageIfo import org.jooq.DSLContext import org.springframework.stereotype.Repository diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/image/command/InsertImageIfoCommand.kt b/api/src/main/kotlin/com/few/api/domain/admin/repo/image/command/InsertImageIfoCommand.kt similarity index 71% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/image/command/InsertImageIfoCommand.kt rename to api/src/main/kotlin/com/few/api/domain/admin/repo/image/command/InsertImageIfoCommand.kt index 90442c2f4..d64bc68eb 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/image/command/InsertImageIfoCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/repo/image/command/InsertImageIfoCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.image.command +package com.few.api.domain.admin.repo.image.command import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/ArticleMainCardService.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/AdminArticleMainCardService.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/ArticleMainCardService.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/AdminArticleMainCardService.kt index a1fb700c5..f5afdcbc9 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/ArticleMainCardService.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/AdminArticleMainCardService.kt @@ -1,22 +1,23 @@ -package com.few.api.domain.admin.document.service - -import com.few.api.domain.admin.document.service.dto.AppendWorkbookToArticleMainCardInDto -import com.few.api.domain.admin.document.service.dto.InitializeArticleMainCardInDto -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.article.ArticleMainCardDao -import com.few.api.repo.dao.article.command.ArticleMainCardExcludeWorkbookCommand -import com.few.api.repo.dao.article.command.UpdateArticleMainCardWorkbookCommand -import com.few.api.repo.dao.article.command.WorkbookCommand -import com.few.api.repo.dao.article.record.ArticleMainCardRecord -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery +package com.few.api.domain.admin.service + +import com.few.api.domain.admin.service.dto.AppendWorkbookToArticleMainCardInDto +import com.few.api.domain.admin.service.dto.InitializeArticleMainCardInDto +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.article.repo.ArticleMainCardDao +import com.few.api.domain.article.repo.command.ArticleMainCardExcludeWorkbookCommand +import com.few.api.domain.article.repo.command.UpdateArticleMainCardWorkbookCommand +import com.few.api.domain.article.repo.command.WorkbookCommand +import com.few.api.domain.article.repo.record.ArticleMainCardRecord +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.query.SelectWorkBookRecordQuery import org.springframework.stereotype.Service @Service -class ArticleMainCardService( +class AdminArticleMainCardService( val articleMainCardDao: ArticleMainCardDao, val workbookDao: WorkbookDao, ) { + fun initialize(inDto: InitializeArticleMainCardInDto) { articleMainCardDao.insertArticleMainCard( ArticleMainCardExcludeWorkbookCommand( diff --git a/storage/src/main/kotlin/com/few/storage/document/service/ConvertDocumentService.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/ConvertDocumentService.kt similarity index 70% rename from storage/src/main/kotlin/com/few/storage/document/service/ConvertDocumentService.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/ConvertDocumentService.kt index f05d2c9e3..cd9f25c7a 100644 --- a/storage/src/main/kotlin/com/few/storage/document/service/ConvertDocumentService.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/ConvertDocumentService.kt @@ -1,4 +1,4 @@ -package com.few.storage.document.service +package com.few.api.domain.admin.service import org.commonmark.parser.Parser import org.commonmark.renderer.html.HtmlRenderer @@ -9,14 +9,14 @@ import org.springframework.stereotype.Service class ConvertDocumentService { companion object { - val parser = Parser.builder().build() - val htmlRenderer = HtmlRenderer.builder().build() - val ARTICLE = "
" + val parser = Parser.builder().build()!! + val htmlRenderer = HtmlRenderer.builder().build()!! + const val ARTICLE = "
" } fun mdToHtml(md: String): String { - val html = Jsoup.parse(ARTICLE) - val article = htmlRenderer.render(parser.parse(md)) + val html = Jsoup.parse(com.few.api.domain.admin.service.ConvertDocumentService.Companion.ARTICLE) + val article = com.few.api.domain.admin.service.ConvertDocumentService.Companion.htmlRenderer.render(com.few.api.domain.admin.service.ConvertDocumentService.Companion.parser.parse(md)) html.getElementsByTag("article").append(article) html.getElementsByTag("h1").forEach { it.attr("style", "font-size: 20px; line-height: 140%; font-weight: 600") diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/GetUrlService.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/GetUrlService.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/GetUrlService.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/GetUrlService.kt index 0479c3a9c..21829d21c 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/GetUrlService.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/GetUrlService.kt @@ -1,11 +1,11 @@ -package com.few.api.domain.admin.document.service +package com.few.api.domain.admin.service -import com.few.api.domain.admin.document.service.dto.GetUrlInDto -import com.few.api.domain.admin.document.service.dto.GetUrlOutDto -import com.few.api.domain.admin.document.service.dto.getPreSignedUrlServiceKey -import com.few.api.exception.common.ExternalIntegrationException -import com.few.storage.GetPreSignedObjectUrlService -import com.few.storage.image.service.support.CdnProperty +import com.few.api.domain.admin.service.dto.GetUrlInDto +import com.few.api.domain.admin.service.dto.GetUrlOutDto +import com.few.api.domain.admin.service.dto.getPreSignedUrlServiceKey +import com.few.api.domain.common.exception.ExternalIntegrationException +import storage.GetPreSignedObjectUrlProvider +import storage.image.config.properties.CdnProperty import org.springframework.context.annotation.Profile import org.springframework.stereotype.Service import java.net.URL @@ -18,7 +18,7 @@ interface GetUrlService { @Profile("local") @Service class GetLocalUrlService( - private val services: Map, + private val services: Map, ) : GetUrlService { override fun execute(query: GetUrlInDto): GetUrlOutDto { val service = services.keys.firstOrNull { key -> diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/AppendWorkbookToArticleMainCardInDto.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/AppendWorkbookToArticleMainCardInDto.kt similarity index 65% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/AppendWorkbookToArticleMainCardInDto.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/dto/AppendWorkbookToArticleMainCardInDto.kt index 6c5c2dcaa..13c0b70ef 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/AppendWorkbookToArticleMainCardInDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/AppendWorkbookToArticleMainCardInDto.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.service.dto +package com.few.api.domain.admin.service.dto data class AppendWorkbookToArticleMainCardInDto( val articleId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlInDto.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlInDto.kt similarity index 83% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlInDto.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlInDto.kt index 155605241..936b82c49 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlInDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlInDto.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.service.dto +package com.few.api.domain.admin.service.dto import java.util.* diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlOutDto.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlOutDto.kt similarity index 55% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlOutDto.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlOutDto.kt index 608d7f395..e3be0659f 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/GetUrlOutDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/GetUrlOutDto.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.service.dto +package com.few.api.domain.admin.service.dto import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/InitializeArticleMainCardInDto.kt b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/InitializeArticleMainCardInDto.kt similarity index 87% rename from api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/InitializeArticleMainCardInDto.kt rename to api/src/main/kotlin/com/few/api/domain/admin/service/dto/InitializeArticleMainCardInDto.kt index 76ce6870e..fa88ca67d 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/service/dto/InitializeArticleMainCardInDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/service/dto/InitializeArticleMainCardInDto.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.service.dto +package com.few.api.domain.admin.service.dto import java.net.URL import java.time.LocalDateTime diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddArticleUseCase.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/AddArticleUseCase.kt similarity index 68% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddArticleUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/AddArticleUseCase.kt index 1269e9b06..2eb4068c2 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddArticleUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/AddArticleUseCase.kt @@ -1,29 +1,28 @@ -package com.few.api.domain.admin.document.usecase +package com.few.api.domain.admin.usecase -import com.few.api.domain.admin.document.service.ArticleMainCardService -import com.few.api.domain.admin.document.usecase.dto.AddArticleUseCaseIn -import com.few.api.domain.admin.document.usecase.dto.AddArticleUseCaseOut -import com.few.api.domain.admin.document.service.GetUrlService -import com.few.api.domain.admin.document.service.dto.GetUrlInDto -import com.few.api.domain.admin.document.service.dto.InitializeArticleMainCardInDto -import com.few.api.domain.admin.document.utils.ObjectPathGenerator -import com.few.api.exception.common.ExternalIntegrationException -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.ArticleViewCountDao -import com.few.api.repo.dao.article.command.InsertFullArticleRecordCommand -import com.few.api.repo.dao.article.query.ArticleViewCountQuery -import com.few.api.repo.dao.document.DocumentDao -import com.few.api.repo.dao.document.command.InsertDocumentIfoCommand -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectMemberByEmailQuery -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.command.InsertProblemsCommand -import com.few.api.repo.dao.problem.support.Content -import com.few.api.repo.dao.problem.support.Contents -import com.few.data.common.code.CategoryType -import com.few.storage.document.service.ConvertDocumentService -import com.few.storage.document.service.PutDocumentService +import com.few.api.domain.admin.service.AdminArticleMainCardService +import com.few.api.domain.admin.service.GetUrlService +import com.few.api.domain.admin.service.dto.GetUrlInDto +import com.few.api.domain.admin.service.dto.InitializeArticleMainCardInDto +import com.few.api.domain.admin.usecase.dto.AddArticleUseCaseIn +import com.few.api.domain.admin.usecase.dto.AddArticleUseCaseOut +import com.few.api.domain.admin.utils.ObjectPathGenerator +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.common.exception.ExternalIntegrationException +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.ArticleViewCountDao +import com.few.api.domain.article.repo.command.InsertFullArticleRecordCommand +import com.few.api.domain.article.repo.query.ArticleViewCountQuery +import com.few.api.domain.admin.repo.document.DocumentDao +import com.few.api.domain.admin.repo.document.command.InsertDocumentIfoCommand +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectMemberByEmailQuery +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.command.InsertProblemsCommand +import com.few.api.domain.problem.repo.support.Content +import com.few.api.domain.problem.repo.support.Contents +import storage.document.PutDocumentProvider import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import java.io.File @@ -37,10 +36,10 @@ class AddArticleUseCase( private val problemDao: ProblemDao, private val documentDao: DocumentDao, private val articleViewCountDao: ArticleViewCountDao, - private val convertDocumentService: ConvertDocumentService, - private val putDocumentService: PutDocumentService, + private val convertDocumentService: com.few.api.domain.admin.service.ConvertDocumentService, + private val putDocumentService: PutDocumentProvider, private val getUrlService: GetUrlService, - private val articleMainCardService: ArticleMainCardService, + private val adminArticleMainCardService: AdminArticleMainCardService, ) { @Transactional fun execute(useCaseIn: AddArticleUseCaseIn): AddArticleUseCaseOut { @@ -103,7 +102,7 @@ class AddArticleUseCase( ArticleViewCountQuery(articleMstId, category) ) - articleMainCardService.initialize( + adminArticleMainCardService.initialize( InitializeArticleMainCardInDto( articleId = articleMstId, articleTitle = useCaseIn.title, diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddWorkbookUseCase.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/AddWorkbookUseCase.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddWorkbookUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/AddWorkbookUseCase.kt index de264d2b5..cd35aa96c 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/AddWorkbookUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/AddWorkbookUseCase.kt @@ -1,10 +1,10 @@ -package com.few.api.domain.admin.document.usecase +package com.few.api.domain.admin.usecase -import com.few.api.domain.admin.document.usecase.dto.AddWorkbookUseCaseIn -import com.few.api.domain.admin.document.usecase.dto.AddWorkbookUseCaseOut -import com.few.api.exception.common.InsertException -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.command.InsertWorkBookCommand +import com.few.api.domain.admin.usecase.dto.AddWorkbookUseCaseIn +import com.few.api.domain.admin.usecase.dto.AddWorkbookUseCaseOut +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.command.InsertWorkBookCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/ConvertContentUseCase.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/ConvertContentUseCase.kt similarity index 65% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/ConvertContentUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/ConvertContentUseCase.kt index 30e8a5a0d..5d800cb1b 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/ConvertContentUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/ConvertContentUseCase.kt @@ -1,16 +1,15 @@ -package com.few.api.domain.admin.document.usecase +package com.few.api.domain.admin.usecase -import com.few.api.domain.admin.document.usecase.dto.ConvertContentUseCaseIn -import com.few.api.domain.admin.document.usecase.dto.ConvertContentUseCaseOut -import com.few.api.domain.admin.document.service.GetUrlService -import com.few.api.domain.admin.document.service.dto.GetUrlInDto -import com.few.api.domain.admin.document.utils.ObjectPathGenerator -import com.few.api.exception.common.ExternalIntegrationException -import com.few.api.exception.common.InsertException -import com.few.api.repo.dao.document.DocumentDao -import com.few.api.repo.dao.document.command.InsertDocumentIfoCommand -import com.few.storage.document.service.ConvertDocumentService -import com.few.storage.document.service.PutDocumentService +import com.few.api.domain.admin.service.GetUrlService +import com.few.api.domain.admin.service.dto.GetUrlInDto +import com.few.api.domain.admin.usecase.dto.ConvertContentUseCaseIn +import com.few.api.domain.admin.usecase.dto.ConvertContentUseCaseOut +import com.few.api.domain.admin.utils.ObjectPathGenerator +import com.few.api.domain.common.exception.ExternalIntegrationException +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.admin.repo.document.DocumentDao +import com.few.api.domain.admin.repo.document.command.InsertDocumentIfoCommand +import storage.document.PutDocumentProvider import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import java.io.File @@ -18,8 +17,8 @@ import java.io.File @Component class ConvertContentUseCase( private val documentDao: DocumentDao, - private val convertDocumentService: ConvertDocumentService, - private val putDocumentService: PutDocumentService, + private val convertDocumentService: com.few.api.domain.admin.service.ConvertDocumentService, + private val putDocumentService: PutDocumentProvider, private val getUrlService: GetUrlService, ) { @Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/MapArticleUseCase.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/MapArticleUseCase.kt similarity index 53% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/MapArticleUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/MapArticleUseCase.kt index c2d3e4e0f..625615dda 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/MapArticleUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/MapArticleUseCase.kt @@ -1,17 +1,17 @@ -package com.few.api.domain.admin.document.usecase +package com.few.api.domain.admin.usecase -import com.few.api.domain.admin.document.service.ArticleMainCardService -import com.few.api.domain.admin.document.service.dto.AppendWorkbookToArticleMainCardInDto -import com.few.api.domain.admin.document.usecase.dto.MapArticleUseCaseIn -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.command.MapWorkBookToArticleCommand +import com.few.api.domain.admin.service.AdminArticleMainCardService +import com.few.api.domain.admin.service.dto.AppendWorkbookToArticleMainCardInDto +import com.few.api.domain.admin.usecase.dto.MapArticleUseCaseIn +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.command.MapWorkBookToArticleCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional @Component class MapArticleUseCase( private val workbookDao: WorkbookDao, - private val articleMainCardService: ArticleMainCardService, + private val adminArticleMainCardService: AdminArticleMainCardService, ) { @Transactional fun execute(useCaseIn: MapArticleUseCaseIn) { @@ -24,7 +24,7 @@ class MapArticleUseCase( ) - articleMainCardService.appendWorkbook( + adminArticleMainCardService.appendWorkbook( AppendWorkbookToArticleMainCardInDto(useCaseIn.articleId, useCaseIn.workbookId) ) } diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/PutImageUseCase.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/PutImageUseCase.kt similarity index 74% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/PutImageUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/PutImageUseCase.kt index 924e05416..3813a50c8 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/PutImageUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/PutImageUseCase.kt @@ -1,15 +1,15 @@ -package com.few.api.domain.admin.document.usecase +package com.few.api.domain.admin.usecase -import com.few.api.domain.admin.document.usecase.dto.PutImageUseCaseIn -import com.few.api.domain.admin.document.usecase.dto.PutImageUseCaseOut -import com.few.api.domain.admin.document.service.GetUrlService -import com.few.api.domain.admin.document.service.dto.GetUrlInDto -import com.few.api.domain.admin.document.utils.ObjectPathGenerator -import com.few.api.exception.common.ExternalIntegrationException -import com.few.api.exception.common.InsertException -import com.few.api.repo.dao.image.ImageDao -import com.few.api.repo.dao.image.command.InsertImageIfoCommand -import com.few.storage.image.service.PutImageService +import com.few.api.domain.admin.service.GetUrlService +import com.few.api.domain.admin.service.dto.GetUrlInDto +import com.few.api.domain.admin.usecase.dto.PutImageUseCaseIn +import com.few.api.domain.admin.usecase.dto.PutImageUseCaseOut +import com.few.api.domain.admin.utils.ObjectPathGenerator +import com.few.api.domain.common.exception.ExternalIntegrationException +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.admin.repo.image.ImageDao +import com.few.api.domain.admin.repo.image.command.InsertImageIfoCommand +import storage.image.PutImageProvider import com.sksamuel.scrimage.ImmutableImage import com.sksamuel.scrimage.webp.WebpWriter import org.springframework.stereotype.Component @@ -19,7 +19,7 @@ import java.io.File @Component class PutImageUseCase( private val imageDao: ImageDao, - private val putImageService: PutImageService, + private val putImageService: PutImageProvider, private val getUrlService: GetUrlService, ) { diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseIn.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseIn.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseIn.kt index f7d21ec1e..9a612b8a7 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseIn.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseOut.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseOut.kt similarity index 52% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseOut.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseOut.kt index f68f1985e..ac625d27b 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddArticleUseCaseOut.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddArticleUseCaseOut.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto data class AddArticleUseCaseOut( val articleId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseIn.kt similarity index 74% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseIn.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseIn.kt index a6959be5d..5dd9ea473 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseIn.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseOut.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseOut.kt similarity index 53% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseOut.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseOut.kt index bbd030cd6..49e49838e 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/AddWorkbookUseCaseOut.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/AddWorkbookUseCaseOut.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto data class AddWorkbookUseCaseOut( val workbookId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseIn.kt similarity index 70% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseIn.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseIn.kt index cd2b4f51c..e3a7a3f1f 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseIn.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import org.springframework.web.multipart.MultipartFile diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseOut.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseOut.kt similarity index 68% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseOut.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseOut.kt index 37967f8a1..ff5ebcc06 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/ConvertContentUseCaseOut.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/ConvertContentUseCaseOut.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/MapArticleUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/MapArticleUseCaseIn.kt similarity index 66% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/MapArticleUseCaseIn.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/MapArticleUseCaseIn.kt index 711a7f793..507ef2ea8 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/MapArticleUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/MapArticleUseCaseIn.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto data class MapArticleUseCaseIn( val workbookId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseIn.kt similarity index 68% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseIn.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseIn.kt index 723149377..8dd419f3a 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseIn.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import org.springframework.web.multipart.MultipartFile diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseOut.kt b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseOut.kt similarity index 66% rename from api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseOut.kt rename to api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseOut.kt index 1842c4d8c..4cc8aafa8 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/usecase/dto/PutImageUseCaseOut.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/usecase/dto/PutImageUseCaseOut.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.usecase.dto +package com.few.api.domain.admin.usecase.dto import java.net.URL diff --git a/api/src/main/kotlin/com/few/api/domain/admin/document/utils/ObjectPathGenerator.kt b/api/src/main/kotlin/com/few/api/domain/admin/utils/ObjectPathGenerator.kt similarity index 94% rename from api/src/main/kotlin/com/few/api/domain/admin/document/utils/ObjectPathGenerator.kt rename to api/src/main/kotlin/com/few/api/domain/admin/utils/ObjectPathGenerator.kt index 61f5f1c4b..93de1cffb 100644 --- a/api/src/main/kotlin/com/few/api/domain/admin/document/utils/ObjectPathGenerator.kt +++ b/api/src/main/kotlin/com/few/api/domain/admin/utils/ObjectPathGenerator.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.admin.document.utils +package com.few.api.domain.admin.utils import java.time.LocalDate import kotlin.random.Random diff --git a/api/src/main/kotlin/com/few/api/web/controller/article/ArticleController.kt b/api/src/main/kotlin/com/few/api/domain/article/controller/ArticleController.kt similarity index 85% rename from api/src/main/kotlin/com/few/api/web/controller/article/ArticleController.kt rename to api/src/main/kotlin/com/few/api/domain/article/controller/ArticleController.kt index ccbf37887..4399bd97d 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/article/ArticleController.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/controller/ArticleController.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.article +package com.few.api.domain.article.controller import com.few.api.domain.article.usecase.ReadArticleUseCase import com.few.api.domain.article.usecase.BrowseArticlesUseCase @@ -6,18 +6,18 @@ import com.few.api.domain.article.usecase.ReadArticleByEmailUseCase import com.few.api.domain.article.usecase.dto.ReadArticleByEmailUseCaseIn import com.few.api.domain.article.usecase.dto.ReadArticleUseCaseIn import com.few.api.domain.article.usecase.dto.ReadArticlesUseCaseIn -import com.few.api.web.controller.article.request.ReadArticleByEmailRequest -import com.few.api.web.controller.article.response.ReadArticleResponse -import com.few.api.web.controller.article.response.ReadArticlesResponse -import com.few.api.web.controller.article.response.WorkbookInfo -import com.few.api.web.controller.article.response.WriterInfo -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator -import com.few.api.web.support.EmailLogEventType -import com.few.api.web.support.SendType -import com.few.api.web.support.method.UserArgument -import com.few.api.web.support.method.UserArgumentDetails -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.article.controller.request.ReadArticleByEmailRequest +import com.few.api.domain.article.controller.response.ReadArticleResponse +import com.few.api.domain.article.controller.response.ReadArticlesResponse +import com.few.api.domain.article.controller.response.WorkbookInfo +import com.few.api.domain.article.controller.response.WriterInfo +import com.few.api.domain.common.vo.EmailLogEventType +import com.few.api.domain.common.vo.SendType +import web.ApiResponse +import web.ApiResponseGenerator +import web.UserArgument +import web.UserArgumentDetails import jakarta.validation.constraints.Min import org.springframework.http.HttpStatus import org.springframework.http.MediaType @@ -109,7 +109,7 @@ class ArticleController( } @GetMapping("/categories") - fun browseArticleCategories(): ApiResponse>> { + fun browseArticleCategories(): ApiResponse> { return ApiResponseGenerator.success( mapOf( "categories" to CategoryType.entries.map { diff --git a/api/src/main/kotlin/com/few/api/web/controller/article/request/ReadArticleByEmailRequest.kt b/api/src/main/kotlin/com/few/api/domain/article/controller/request/ReadArticleByEmailRequest.kt similarity index 65% rename from api/src/main/kotlin/com/few/api/web/controller/article/request/ReadArticleByEmailRequest.kt rename to api/src/main/kotlin/com/few/api/domain/article/controller/request/ReadArticleByEmailRequest.kt index 10da32ec4..2c4a25673 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/article/request/ReadArticleByEmailRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/controller/request/ReadArticleByEmailRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.article.request +package com.few.api.domain.article.controller.request data class ReadArticleByEmailRequest( val messageId: String, diff --git a/api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticleResponse.kt b/api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticleResponse.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticleResponse.kt rename to api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticleResponse.kt index ecb76a624..7aa3ddbba 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticleResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticleResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.article.response +package com.few.api.domain.article.controller.response import java.net.URL import java.time.LocalDateTime diff --git a/api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticlesResponse.kt b/api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticlesResponse.kt similarity index 65% rename from api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticlesResponse.kt rename to api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticlesResponse.kt index 80a139400..c90a07384 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticlesResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/controller/response/ReadArticlesResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.article.response +package com.few.api.domain.article.controller.response data class ReadArticlesResponse( val articles: List, diff --git a/email/src/main/kotlin/com/few/email/service/article/SendArticleEmailService.kt b/api/src/main/kotlin/com/few/api/domain/article/email/SendArticleEmailService.kt similarity index 88% rename from email/src/main/kotlin/com/few/email/service/article/SendArticleEmailService.kt rename to api/src/main/kotlin/com/few/api/domain/article/email/SendArticleEmailService.kt index 86898d7eb..25438c4f9 100644 --- a/email/src/main/kotlin/com/few/email/service/article/SendArticleEmailService.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/email/SendArticleEmailService.kt @@ -1,8 +1,8 @@ -package com.few.email.service.article +package com.few.api.domain.article.email -import com.few.email.sender.EmailSender -import com.few.email.sender.provider.ArticleAwsSESEmailSendProvider -import com.few.email.service.article.dto.SendArticleEmailArgs +import com.few.api.domain.article.email.dto.SendArticleEmailArgs +import email.EmailSender +import email.provider.ArticleAwsSESEmailSendProvider import org.springframework.boot.autoconfigure.mail.MailProperties import org.springframework.stereotype.Component import org.thymeleaf.TemplateEngine diff --git a/email/src/main/kotlin/com/few/email/service/article/dto/SendArticleEmailArgs.kt b/api/src/main/kotlin/com/few/api/domain/article/email/dto/SendArticleEmailArgs.kt similarity index 94% rename from email/src/main/kotlin/com/few/email/service/article/dto/SendArticleEmailArgs.kt rename to api/src/main/kotlin/com/few/api/domain/article/email/dto/SendArticleEmailArgs.kt index c34483ae1..f8b46a701 100644 --- a/email/src/main/kotlin/com/few/email/service/article/dto/SendArticleEmailArgs.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/email/dto/SendArticleEmailArgs.kt @@ -1,6 +1,6 @@ -package com.few.email.service.article.dto +package com.few.api.domain.article.email.dto -import com.few.email.sender.dto.SendMailArgs +import email.SendMailArgs import java.net.URL import java.time.LocalDate diff --git a/api/src/main/kotlin/com/few/api/domain/article/event/ReadArticleEventListener.kt b/api/src/main/kotlin/com/few/api/domain/article/event/ReadArticleEventListener.kt index 644c1c541..07184f87c 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/event/ReadArticleEventListener.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/event/ReadArticleEventListener.kt @@ -1,7 +1,7 @@ package com.few.api.domain.article.event import com.few.api.domain.article.event.dto.ReadArticleEvent -import com.few.api.domain.article.handler.ArticleViewHisAsyncHandler +import com.few.api.domain.article.event.handler.ArticleViewHisAsyncHandler import org.springframework.context.event.EventListener import org.springframework.stereotype.Component diff --git a/api/src/main/kotlin/com/few/api/domain/article/event/dto/ReadArticleEvent.kt b/api/src/main/kotlin/com/few/api/domain/article/event/dto/ReadArticleEvent.kt index c06c38a5e..e0becf512 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/event/dto/ReadArticleEvent.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/event/dto/ReadArticleEvent.kt @@ -1,6 +1,6 @@ package com.few.api.domain.article.event.dto -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType data class ReadArticleEvent( val articleId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewHisAsyncHandler.kt b/api/src/main/kotlin/com/few/api/domain/article/event/handler/ArticleViewHisAsyncHandler.kt similarity index 66% rename from api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewHisAsyncHandler.kt rename to api/src/main/kotlin/com/few/api/domain/article/event/handler/ArticleViewHisAsyncHandler.kt index b15936bda..af559f429 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewHisAsyncHandler.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/event/handler/ArticleViewHisAsyncHandler.kt @@ -1,11 +1,11 @@ -package com.few.api.domain.article.handler +package com.few.api.domain.article.event.handler -import com.few.api.config.DatabaseAccessThreadPoolConfig.Companion.DATABASE_ACCESS_POOL -import com.few.api.repo.dao.article.ArticleViewCountDao -import com.few.api.repo.dao.article.ArticleViewHisDao -import com.few.api.repo.dao.article.command.ArticleViewHisCommand -import com.few.api.repo.dao.article.query.ArticleViewCountQuery -import com.few.data.common.code.CategoryType +import com.few.api.config.ApiDatabaseAccessThreadPoolConfig.Companion.DATABASE_ACCESS_POOL +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.article.repo.ArticleViewCountDao +import com.few.api.domain.article.repo.ArticleViewHisDao +import com.few.api.domain.article.repo.command.ArticleViewHisCommand +import com.few.api.domain.article.repo.query.ArticleViewCountQuery import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component @@ -22,7 +22,12 @@ class ArticleViewHisAsyncHandler( @Transactional fun addArticleViewHis(articleId: Long, memberId: Long, categoryType: CategoryType) { runCatching { - articleViewHisDao.insertArticleViewHis(ArticleViewHisCommand(articleId, memberId)).also { + articleViewHisDao.insertArticleViewHis( + ArticleViewHisCommand( + articleId, + memberId + ) + ).also { log.debug { "Successfully inserted article view history for articleId: $articleId and memberId: $memberId" } } diff --git a/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewCountHandler.kt b/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewCountHandler.kt index f8127ef21..9ea079064 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewCountHandler.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/handler/ArticleViewCountHandler.kt @@ -1,7 +1,7 @@ package com.few.api.domain.article.handler -import com.few.api.repo.dao.article.ArticleViewCountDao -import com.few.api.repo.dao.article.command.ArticleViewCountCommand +import com.few.api.domain.article.repo.ArticleViewCountDao +import com.few.api.domain.article.repo.command.ArticleViewCountCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Propagation @@ -11,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional class ArticleViewCountHandler( private val articleViewCountDao: ArticleViewCountDao, ) { + @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRES_NEW) fun browseArticleViewCount(articleId: Long): Long { return (articleViewCountDao.selectArticleViewCount(ArticleViewCountCommand(articleId)) ?: 0L) + 1L diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleDao.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleDao.kt similarity index 95% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleDao.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/ArticleDao.kt index c97f38cc6..80e0a55f1 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleDao.kt @@ -1,11 +1,11 @@ -package com.few.api.repo.dao.article - -import com.few.api.repo.config.LocalCacheConfig.Companion.LOCAL_CM -import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_ARTICLE_RECORD_CACHE -import com.few.api.repo.dao.article.command.InsertFullArticleRecordCommand -import com.few.api.repo.dao.article.query.* -import com.few.api.repo.dao.article.record.* -import com.few.data.common.code.MemberType +package com.few.api.domain.article.repo + +import com.few.api.domain.article.repo.query.* +import com.few.api.domain.article.repo.record.* +import com.few.api.domain.common.vo.MemberType +import com.few.api.config.ApiLocalCacheConfig.Companion.LOCAL_CM +import com.few.api.config.ApiLocalCacheConfig.Companion.SELECT_ARTICLE_RECORD_CACHE +import com.few.api.domain.article.repo.command.InsertFullArticleRecordCommand import jooq.jooq_dsl.tables.* import jooq.jooq_dsl.tables.MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE import org.jooq.* diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleMainCardDao.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleMainCardDao.kt similarity index 89% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleMainCardDao.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/ArticleMainCardDao.kt index 7dd1511f8..e4715a32c 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleMainCardDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleMainCardDao.kt @@ -1,10 +1,10 @@ -package com.few.api.repo.dao.article +package com.few.api.domain.article.repo -import com.few.api.repo.dao.article.command.ArticleMainCardExcludeWorkbookCommand -import com.few.api.repo.dao.article.command.UpdateArticleMainCardWorkbookCommand -import com.few.api.repo.dao.article.record.ArticleMainCardRecord -import com.few.api.repo.dao.article.support.CommonJsonMapper -import com.few.api.repo.dao.article.support.ArticleMainCardMapper +import com.few.api.domain.article.repo.command.ArticleMainCardExcludeWorkbookCommand +import com.few.api.domain.article.repo.command.UpdateArticleMainCardWorkbookCommand +import com.few.api.domain.article.repo.record.ArticleMainCardRecord +import com.few.api.domain.article.repo.support.CommonJsonMapper +import com.few.api.domain.article.repo.support.ArticleMainCardMapper import jooq.jooq_dsl.tables.ArticleMainCard.ARTICLE_MAIN_CARD import org.jooq.* import org.jooq.impl.DSL.* diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewCountDao.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewCountDao.kt similarity index 81% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewCountDao.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewCountDao.kt index f94f4cfe9..0976f1f4d 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewCountDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewCountDao.kt @@ -1,27 +1,27 @@ -package com.few.api.repo.dao.article - -import com.few.api.repo.dao.article.TempTable.ARTICLE_ID_COLUMN -import com.few.api.repo.dao.article.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE -import com.few.api.repo.dao.article.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_ARTICLE_ID -import com.few.api.repo.dao.article.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_CATEGORY_CD -import com.few.api.repo.dao.article.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_VIEW_COUNT -import com.few.api.repo.dao.article.TempTable.EMAIL_VIEW_COUNT_TABLE -import com.few.api.repo.dao.article.TempTable.EMAIL_VIEW_COUNT_TABLE_ARTICLE_ID -import com.few.api.repo.dao.article.TempTable.EMAIL_VIEW_COUNT_TABLE_VIEW_COUNT -import com.few.api.repo.dao.article.TempTable.OFFSET_COLUMN -import com.few.api.repo.dao.article.TempTable.ROW_RANK_TABLE -import com.few.api.repo.dao.article.TempTable.ROW_RANK_TABLE_ARTICLE_ID -import com.few.api.repo.dao.article.TempTable.ROW_RANK_TABLE_OFFSET -import com.few.api.repo.dao.article.TempTable.TOTAL_VIEW_COUNT_TABLE -import com.few.api.repo.dao.article.TempTable.TOTAL_VIEW_COUNT_TABLE_ARTICLE_ID -import com.few.api.repo.dao.article.TempTable.TOTAL_VIEW_COUNT_TABLE_VIEW_COUNT -import com.few.api.repo.dao.article.TempTable.VIEW_COUNT_COLUMN -import com.few.api.repo.dao.article.command.ArticleViewCountCommand -import com.few.api.repo.dao.article.query.ArticleViewCountQuery -import com.few.api.repo.dao.article.query.SelectArticlesOrderByViewsQuery -import com.few.api.repo.dao.article.query.SelectRankByViewsQuery -import com.few.api.repo.dao.article.record.SelectArticleViewsRecord -import com.few.data.common.code.CategoryType +package com.few.api.domain.article.repo + +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.article.repo.TempTable.ARTICLE_ID_COLUMN +import com.few.api.domain.article.repo.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE +import com.few.api.domain.article.repo.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_ARTICLE_ID +import com.few.api.domain.article.repo.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_CATEGORY_CD +import com.few.api.domain.article.repo.TempTable.ARTICLE_VIEW_COUNT_OFFSET_TABLE_VIEW_COUNT +import com.few.api.domain.article.repo.TempTable.EMAIL_VIEW_COUNT_TABLE +import com.few.api.domain.article.repo.TempTable.EMAIL_VIEW_COUNT_TABLE_ARTICLE_ID +import com.few.api.domain.article.repo.TempTable.EMAIL_VIEW_COUNT_TABLE_VIEW_COUNT +import com.few.api.domain.article.repo.TempTable.OFFSET_COLUMN +import com.few.api.domain.article.repo.TempTable.ROW_RANK_TABLE +import com.few.api.domain.article.repo.TempTable.ROW_RANK_TABLE_ARTICLE_ID +import com.few.api.domain.article.repo.TempTable.ROW_RANK_TABLE_OFFSET +import com.few.api.domain.article.repo.TempTable.TOTAL_VIEW_COUNT_TABLE +import com.few.api.domain.article.repo.TempTable.TOTAL_VIEW_COUNT_TABLE_ARTICLE_ID +import com.few.api.domain.article.repo.TempTable.TOTAL_VIEW_COUNT_TABLE_VIEW_COUNT +import com.few.api.domain.article.repo.TempTable.VIEW_COUNT_COLUMN +import com.few.api.domain.article.repo.command.ArticleViewCountCommand +import com.few.api.domain.article.repo.query.ArticleViewCountQuery +import com.few.api.domain.article.repo.query.SelectArticlesOrderByViewsQuery +import com.few.api.domain.article.repo.query.SelectRankByViewsQuery +import com.few.api.domain.article.repo.record.SelectArticleViewsRecord import jooq.jooq_dsl.tables.ArticleViewCount.ARTICLE_VIEW_COUNT import jooq.jooq_dsl.tables.SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY import org.jooq.DSLContext diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewHisDao.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewHisDao.kt similarity index 85% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewHisDao.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewHisDao.kt index 9a3b10efd..85a5b4abc 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/ArticleViewHisDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/ArticleViewHisDao.kt @@ -1,7 +1,7 @@ -package com.few.api.repo.dao.article +package com.few.api.domain.article.repo -import com.few.api.repo.dao.article.command.ArticleViewHisCommand -import com.few.api.repo.dao.article.query.ArticleViewHisCountQuery +import com.few.api.domain.article.repo.command.ArticleViewHisCommand +import com.few.api.domain.article.repo.query.ArticleViewHisCountQuery import jooq.jooq_dsl.tables.ArticleViewHis import org.jooq.DSLContext import org.springframework.stereotype.Repository diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleMainCardExcludeWorkbookCommand.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleMainCardExcludeWorkbookCommand.kt similarity index 88% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleMainCardExcludeWorkbookCommand.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleMainCardExcludeWorkbookCommand.kt index f4658987d..55c05e6ea 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleMainCardExcludeWorkbookCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleMainCardExcludeWorkbookCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.command +package com.few.api.domain.article.repo.command import java.net.URL import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewCountCommand.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewCountCommand.kt similarity index 56% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewCountCommand.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewCountCommand.kt index 1b90d8fa7..12f8c1b5c 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewCountCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewCountCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.command +package com.few.api.domain.article.repo.command data class ArticleViewCountCommand( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewHisCommand.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewHisCommand.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewHisCommand.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewHisCommand.kt index e986fe85f..6f1128dec 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/ArticleViewHisCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/command/ArticleViewHisCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.command +package com.few.api.domain.article.repo.command data class ArticleViewHisCommand( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/InsertFullArticleRecordCommand.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/command/InsertFullArticleRecordCommand.kt similarity index 79% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/InsertFullArticleRecordCommand.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/command/InsertFullArticleRecordCommand.kt index 1c48794af..b7333eb29 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/InsertFullArticleRecordCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/command/InsertFullArticleRecordCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.command +package com.few.api.domain.article.repo.command import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/UpdateArticleMainCardWorkbookCommand.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/command/UpdateArticleMainCardWorkbookCommand.kt similarity index 79% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/UpdateArticleMainCardWorkbookCommand.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/command/UpdateArticleMainCardWorkbookCommand.kt index d828ab363..fb6cf321e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/command/UpdateArticleMainCardWorkbookCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/command/UpdateArticleMainCardWorkbookCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.command +package com.few.api.domain.article.repo.command data class UpdateArticleMainCardWorkbookCommand( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewCountQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewCountQuery.kt similarity index 50% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewCountQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewCountQuery.kt index 812695f0a..e565ad16e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewCountQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewCountQuery.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType data class ArticleViewCountQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewHisCountQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewHisCountQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewHisCountQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewHisCountQuery.kt index 50dfec413..3bd73e931 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/ArticleViewHisCountQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/ArticleViewHisCountQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class ArticleViewHisCountQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt similarity index 67% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt index 9f2be69ee..44fa4a251 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectAritlceIdByWorkbookIdAndDayQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectAritlceIdByWorkbookIdAndDayQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleContentQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleContentQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleContentQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleContentQuery.kt index dde507ad2..a94d5d973 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleContentQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleContentQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectArticleContentQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleIdByWorkbookIdAndDayQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleIdByWorkbookIdAndDayQuery.kt similarity index 67% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleIdByWorkbookIdAndDayQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleIdByWorkbookIdAndDayQuery.kt index c98869346..1707f6c2e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleIdByWorkbookIdAndDayQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleIdByWorkbookIdAndDayQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectArticleIdByWorkbookIdAndDayQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleRecordQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleRecordQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleRecordQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleRecordQuery.kt index 3607518a3..dc376a739 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticleRecordQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticleRecordQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectArticleRecordQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticlesOrderByViewsQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticlesOrderByViewsQuery.kt similarity index 51% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticlesOrderByViewsQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticlesOrderByViewsQuery.kt index 4a53bb267..4433e3bb1 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectArticlesOrderByViewsQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectArticlesOrderByViewsQuery.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType data class SelectArticlesOrderByViewsQuery( val offset: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectRankByViewsQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectRankByViewsQuery.kt similarity index 57% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectRankByViewsQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectRankByViewsQuery.kt index ca8777e0c..3323e831f 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectRankByViewsQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectRankByViewsQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectRankByViewsQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkBookArticleRecordQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkBookArticleRecordQuery.kt similarity index 68% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkBookArticleRecordQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkBookArticleRecordQuery.kt index 6e91dc8a3..71262377e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkBookArticleRecordQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkBookArticleRecordQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectWorkBookArticleRecordQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkbookMappedArticleRecordsQuery.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkbookMappedArticleRecordsQuery.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkbookMappedArticleRecordsQuery.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkbookMappedArticleRecordsQuery.kt index abfb44ad7..021b74965 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/query/SelectWorkbookMappedArticleRecordsQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/query/SelectWorkbookMappedArticleRecordsQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.query +package com.few.api.domain.article.repo.query data class SelectWorkbookMappedArticleRecordsQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleContentRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleContentRecord.kt similarity index 82% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleContentRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleContentRecord.kt index 3b121be38..924f4c618 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleContentRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleContentRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleIdRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleIdRecord.kt similarity index 56% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleIdRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleIdRecord.kt index ecb7cff77..53032d54b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleIdRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleIdRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record data class ArticleIdRecord( val articleIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleMainCardRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleMainCardRecord.kt similarity index 93% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleMainCardRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleMainCardRecord.kt index a3719f451..afb279b8e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/ArticleMainCardRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/ArticleMainCardRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record import java.net.URL import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleContentsRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleContentsRecord.kt similarity index 66% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleContentsRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleContentsRecord.kt index 1b649fe95..6e5c21a77 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleContentsRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleContentsRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record data class SelectArticleContentsRecord( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleRecord.kt similarity index 86% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleRecord.kt index dc80ccbde..a2618970d 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record import java.io.Serializable import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleViewsRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleViewsRecord.kt similarity index 64% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleViewsRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleViewsRecord.kt index e33b88b72..f91885dc9 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectArticleViewsRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectArticleViewsRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record data class SelectArticleViewsRecord( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookArticleRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookArticleRecord.kt similarity index 86% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookArticleRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookArticleRecord.kt index 46e325e8e..97bddf3a5 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookArticleRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookArticleRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record import java.net.URL import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookMappedArticleRecord.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookMappedArticleRecord.kt similarity index 85% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookMappedArticleRecord.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookMappedArticleRecord.kt index d96359125..24bb7ad1b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/record/SelectWorkBookMappedArticleRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/record/SelectWorkBookMappedArticleRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.record +package com.few.api.domain.article.repo.record import java.net.URL import java.time.LocalDateTime diff --git a/api/src/main/kotlin/com/few/api/domain/article/repo/support/ArticleMainCardMapper.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/support/ArticleMainCardMapper.kt new file mode 100644 index 000000000..f59173c8f --- /dev/null +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/support/ArticleMainCardMapper.kt @@ -0,0 +1,77 @@ +package com.few.api.domain.article.repo.support + +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.few.api.domain.article.repo.command.WorkbookCommand +import com.few.api.domain.article.repo.record.ArticleMainCardRecord +import com.few.api.domain.article.repo.record.WorkbookRecord +import org.jooq.JSON +import org.jooq.RecordMapper +import org.jooq.Record +import org.springframework.stereotype.Component +import java.net.URL +import java.time.LocalDateTime + +@Component +class ArticleMainCardMapper( + private val objectMapper: ObjectMapper, +) : RecordMapper { + override fun map(record: Record) = ArticleMainCardRecord( + articleId = record.get( + ArticleMainCardRecord::articleId.name, + Long::class.java + ), + articleTitle = record.get( + ArticleMainCardRecord::articleTitle.name, + String::class.java + ), + mainImageUrl = record.get( + ArticleMainCardRecord::mainImageUrl.name, + URL::class.java + ), + categoryCd = record.get( + ArticleMainCardRecord::categoryCd.name, + Byte::class.java + ), + createdAt = record.get( + ArticleMainCardRecord::createdAt.name, + LocalDateTime::class.java + ), + writerId = record.get( + ArticleMainCardRecord::writerId.name, + Long::class.java + ), + writerEmail = record.get( + ArticleMainCardRecord::writerEmail.name, + String::class.java + ), + writerName = record.get( + ArticleMainCardRecord::writerName.name, + String::class.java + ), + writerUrl = record.get( + ArticleMainCardRecord::writerUrl.name, + URL::class.java + ), + writerImgUrl = record.get( + ArticleMainCardRecord::writerImgUrl.name, + URL::class.java + ), + workbooks = record.get( + ArticleMainCardRecord::workbooks.name, + JSON::class.java + )?.data()?.let { + if ("{}".equals(it)) { + emptyList() + } else { + val workbookRecords = objectMapper.readValue>(it) + workbookRecords.filter { w -> w.id != null && w.title != null } + .toList() + } + } ?: run { + emptyList() + } + ) + + fun toJsonStr(workbooks: List) = objectMapper.writeValueAsString(workbooks) +} \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/CommonJsonMapper.kt b/api/src/main/kotlin/com/few/api/domain/article/repo/support/CommonJsonMapper.kt similarity index 87% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/CommonJsonMapper.kt rename to api/src/main/kotlin/com/few/api/domain/article/repo/support/CommonJsonMapper.kt index 6906a316c..b9d28e95f 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/article/support/CommonJsonMapper.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/repo/support/CommonJsonMapper.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.article.support +package com.few.api.domain.article.repo.support import com.fasterxml.jackson.databind.ObjectMapper import org.springframework.stereotype.Component diff --git a/api/src/main/kotlin/com/few/api/domain/article/service/ArticleLogService.kt b/api/src/main/kotlin/com/few/api/domain/article/service/ArticleLogService.kt index d60d86608..877c8f393 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/service/ArticleLogService.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/service/ArticleLogService.kt @@ -2,10 +2,10 @@ package com.few.api.domain.article.service import com.few.api.domain.article.service.dto.InsertOpenEventDto import com.few.api.domain.article.service.dto.SelectDeliveryEventByMessageIdDto -import com.few.api.repo.dao.log.SendArticleEventHistoryDao -import com.few.api.repo.dao.log.command.InsertEventCommand -import com.few.api.repo.dao.log.query.SelectEventByMessageIdAndEventTypeQuery -import com.few.api.repo.dao.log.record.SendArticleEventHistoryRecord +import com.few.api.domain.log.repo.SendArticleEventHistoryDao +import com.few.api.domain.log.repo.command.InsertEventCommand +import com.few.api.domain.log.repo.query.SelectEventByMessageIdAndEventTypeQuery +import com.few.api.domain.log.repo.record.SendArticleEventHistoryRecord import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/article/service/ArticleMemberService.kt b/api/src/main/kotlin/com/few/api/domain/article/service/ArticleMemberService.kt index fc940f09c..27cd4b2d5 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/service/ArticleMemberService.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/service/ArticleMemberService.kt @@ -1,8 +1,8 @@ package com.few.api.domain.article.service import com.few.api.domain.article.service.dto.ReadMemberByEmailDto -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectMemberByEmailQuery +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectMemberByEmailQuery import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/article/service/BrowseArticleProblemsService.kt b/api/src/main/kotlin/com/few/api/domain/article/service/BrowseArticleProblemsService.kt index 6aa313ec9..fea41ca6a 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/service/BrowseArticleProblemsService.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/service/BrowseArticleProblemsService.kt @@ -2,9 +2,9 @@ package com.few.api.domain.article.service import com.few.api.domain.article.service.dto.BrowseArticleProblemIdsInDto import com.few.api.domain.article.service.dto.BrowseArticleProblemsOutDto -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.query.SelectProblemsByArticleIdQuery import org.springframework.stereotype.Service @Suppress("NAME_SHADOWING") diff --git a/api/src/main/kotlin/com/few/api/domain/article/service/ReadArticleWriterRecordService.kt b/api/src/main/kotlin/com/few/api/domain/article/service/ReadArticleWriterRecordService.kt index 150a02d34..f3b190fab 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/service/ReadArticleWriterRecordService.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/service/ReadArticleWriterRecordService.kt @@ -2,8 +2,8 @@ package com.few.api.domain.article.service import com.few.api.domain.article.service.dto.ReadWriterOutDto import com.few.api.domain.article.service.dto.ReadWriterRecordInDto -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectWriterQuery +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectWriterQuery import org.springframework.stereotype.Service @Suppress("NAME_SHADOWING") diff --git a/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt b/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt index ef56bb003..e8f6d1095 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt @@ -1,16 +1,16 @@ package com.few.api.domain.article.usecase import com.few.api.domain.article.usecase.dto.* -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.ArticleMainCardDao -import com.few.api.repo.dao.article.ArticleViewCountDao -import com.few.api.repo.dao.article.query.SelectArticlesOrderByViewsQuery -import com.few.api.repo.dao.article.query.SelectRankByViewsQuery -import com.few.api.repo.dao.article.record.ArticleMainCardRecord -import com.few.api.repo.dao.article.record.SelectArticleContentsRecord -import com.few.api.repo.dao.article.record.SelectArticleViewsRecord -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.ArticleMainCardDao +import com.few.api.domain.article.repo.ArticleViewCountDao +import com.few.api.domain.article.repo.query.SelectArticlesOrderByViewsQuery +import com.few.api.domain.article.repo.query.SelectRankByViewsQuery +import com.few.api.domain.article.repo.record.ArticleMainCardRecord +import com.few.api.domain.article.repo.record.SelectArticleContentsRecord +import com.few.api.domain.article.repo.record.SelectArticleViewsRecord import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import java.util.* diff --git a/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleByEmailUseCase.kt b/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleByEmailUseCase.kt index c594b3f97..e78945426 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleByEmailUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleByEmailUseCase.kt @@ -6,7 +6,7 @@ import com.few.api.domain.article.service.dto.InsertOpenEventDto import com.few.api.domain.article.service.dto.ReadMemberByEmailDto import com.few.api.domain.article.service.dto.SelectDeliveryEventByMessageIdDto import com.few.api.domain.article.usecase.dto.ReadArticleByEmailUseCaseIn -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.common.vo.EmailLogEventType import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import org.webjars.NotFoundException diff --git a/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCase.kt b/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCase.kt index 6753f1697..51e88b176 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCase.kt @@ -9,10 +9,10 @@ import com.few.api.domain.article.service.BrowseArticleProblemsService import com.few.api.domain.article.service.ReadArticleWriterRecordService import com.few.api.domain.article.service.dto.BrowseArticleProblemIdsInDto import com.few.api.domain.article.service.dto.ReadWriterRecordInDto -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.query.SelectArticleRecordQuery -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.query.SelectArticleRecordQuery import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticleByEmailUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticleByEmailUseCaseIn.kt index 4e16d2d4b..27fb94f0a 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticleByEmailUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticleByEmailUseCaseIn.kt @@ -1,7 +1,7 @@ package com.few.api.domain.article.usecase.dto -import com.few.api.web.support.EmailLogEventType -import com.few.api.web.support.SendType +import com.few.api.domain.common.vo.EmailLogEventType +import com.few.api.domain.common.vo.SendType data class ReadArticleByEmailUseCaseIn( val messageId: String, diff --git a/batch/src/main/kotlin/com/few/batch/service/article/BatchSendArticleEmailService.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/ApiBatchSendArticleEmailService.kt similarity index 75% rename from batch/src/main/kotlin/com/few/batch/service/article/BatchSendArticleEmailService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/ApiBatchSendArticleEmailService.kt index f69de5073..ac139ee16 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/BatchSendArticleEmailService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/ApiBatchSendArticleEmailService.kt @@ -1,19 +1,20 @@ -package com.few.batch.service.article +package com.few.api.domain.batch.article import com.fasterxml.jackson.databind.ObjectMapper -import com.few.batch.log.BatchCallExecutionService -import com.few.batch.service.article.reader.WorkBookSubscriberReader -import com.few.batch.service.article.writer.WorkBookSubscriberWriter +import com.few.api.domain.batch.article.reader.WorkBookSubscriberReader +import com.few.api.domain.batch.article.writer.WorkBookSubscriberWriter +import com.few.api.domain.batch.log.ApiBatchCallExecutionService import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @Service -class BatchSendArticleEmailService( +class ApiBatchSendArticleEmailService( private val workBookSubscriberReader: WorkBookSubscriberReader, private val workBookSubscriberWriter: WorkBookSubscriberWriter, - private val batchCallExecutionService: BatchCallExecutionService, + private val batchCallExecutionService: ApiBatchCallExecutionService, private val objectMapper: ObjectMapper, ) { + @Transactional fun execute() { val startTime = System.currentTimeMillis() diff --git a/batch/src/main/kotlin/com/few/batch/service/article/dto/WorkBookSubscriberItem.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/dto/WorkBookSubscriberItem.kt similarity index 96% rename from batch/src/main/kotlin/com/few/batch/service/article/dto/WorkBookSubscriberItem.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/dto/WorkBookSubscriberItem.kt index 18d80d2aa..1b477761e 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/dto/WorkBookSubscriberItem.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/dto/WorkBookSubscriberItem.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.dto +package com.few.api.domain.batch.article.dto fun List.toMemberIds(): Set { return this.map { it.memberId }.toSet() diff --git a/batch/src/main/kotlin/com/few/batch/service/article/reader/WorkBookSubscriberReader.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/reader/WorkBookSubscriberReader.kt similarity index 74% rename from batch/src/main/kotlin/com/few/batch/service/article/reader/WorkBookSubscriberReader.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/reader/WorkBookSubscriberReader.kt index 4f018f1ab..0670ded0f 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/reader/WorkBookSubscriberReader.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/reader/WorkBookSubscriberReader.kt @@ -1,7 +1,7 @@ -package com.few.batch.service.article.reader +package com.few.api.domain.batch.article.reader -import com.few.batch.data.common.code.BatchDayCode -import com.few.batch.service.article.dto.WorkBookSubscriberItem +import com.few.api.domain.batch.article.dto.WorkBookSubscriberItem +import com.few.api.domain.common.vo.DayCode import jooq.jooq_dsl.tables.Subscription.SUBSCRIPTION import jooq.jooq_dsl.tables.records.SubscriptionRecord import org.jooq.Condition @@ -26,9 +26,9 @@ class WorkBookSubscriberReader( val date = LocalDate.now(ZoneId.of("Asia/Seoul")) val sendDay = if ((date.dayOfWeek == DayOfWeek.SATURDAY) || (date.dayOfWeek == DayOfWeek.SUNDAY)) { - BatchDayCode.MON_TUE_WED_THU_FRI_SAT_SUN + DayCode.MON_TUE_WED_THU_FRI_SAT_SUN } else { - BatchDayCode.MON_TUE_WED_THU_FRI + DayCode.MON_TUE_WED_THU_FRI } return dslContext.select( @@ -44,16 +44,16 @@ class WorkBookSubscriberReader( .fetchInto(WorkBookSubscriberItem::class.java) } - private fun sendDayCondition(sendDayField: TableField, sendDayCode: BatchDayCode): Condition { + private fun sendDayCondition(sendDayField: TableField, sendDayCode: DayCode): Condition { return when (sendDayCode) { /** 평일인 경우 매일을 포함하여 전송한다 */ - BatchDayCode.MON_TUE_WED_THU_FRI -> { - sendDayField.eq(BatchDayCode.MON_TUE_WED_THU_FRI.code) - .or(sendDayField.eq(BatchDayCode.MON_TUE_WED_THU_FRI_SAT_SUN.code)) + DayCode.MON_TUE_WED_THU_FRI -> { + sendDayField.eq(DayCode.MON_TUE_WED_THU_FRI.code) + .or(sendDayField.eq(DayCode.MON_TUE_WED_THU_FRI_SAT_SUN.code)) } /** 매일의 경우 매일만 전송한다 */ - BatchDayCode.MON_TUE_WED_THU_FRI_SAT_SUN -> { - sendDayField.eq(BatchDayCode.MON_TUE_WED_THU_FRI_SAT_SUN.code) + DayCode.MON_TUE_WED_THU_FRI_SAT_SUN -> { + sendDayField.eq(DayCode.MON_TUE_WED_THU_FRI_SAT_SUN.code) } else -> { throw IllegalArgumentException("Invalid sendDayCode: $sendDayCode") diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/WorkBookSubscriberWriter.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/WorkBookSubscriberWriter.kt similarity index 81% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/WorkBookSubscriberWriter.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/WorkBookSubscriberWriter.kt index 596d11359..ebbf970ba 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/WorkBookSubscriberWriter.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/WorkBookSubscriberWriter.kt @@ -1,16 +1,19 @@ -package com.few.batch.service.article.writer +package com.few.api.domain.batch.article.writer -import com.few.batch.data.common.code.BatchSendEventType -import com.few.batch.data.common.code.BatchSendType -import com.few.batch.service.article.dto.WorkBookSubscriberItem -import com.few.batch.service.article.dto.toMemberIds -import com.few.batch.service.article.dto.toTargetWorkBookIds -import com.few.batch.service.article.dto.toTargetWorkBookProgress -import com.few.batch.service.article.writer.model.* -import com.few.batch.service.article.writer.service.* -import com.few.batch.service.article.writer.support.MailSendRecorder -import com.few.batch.service.article.writer.support.MailServiceArgsGenerator -import com.few.email.service.article.SendArticleEmailService +import com.few.api.domain.common.vo.SendEventType +import com.few.api.domain.common.vo.SendType +import com.few.api.domain.article.email.SendArticleEmailService +import com.few.api.domain.batch.article.dto.WorkBookSubscriberItem +import com.few.api.domain.batch.article.dto.toMemberIds +import com.few.api.domain.batch.article.dto.toTargetWorkBookIds +import com.few.api.domain.batch.article.dto.toTargetWorkBookProgress +import com.few.api.domain.batch.article.writer.model.* +import com.few.api.domain.batch.article.writer.service.BrowseArticleContentsService +import com.few.api.domain.batch.article.writer.service.BrowseMemberEmailService +import com.few.api.domain.batch.article.writer.service.BrowseMemberReceiveArticlesService +import com.few.api.domain.batch.article.writer.service.BrowseWorkbookLastDayColService +import com.few.api.domain.batch.article.writer.support.MailSendRecorder +import com.few.api.domain.batch.article.writer.support.MailServiceArgsGenerator import jooq.jooq_dsl.tables.* import org.jooq.DSLContext import org.jooq.InsertSetMoreStep @@ -68,8 +71,8 @@ class WorkBookSubscriberWriter( .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.MEMBER_ID, it.memberId) .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.ARTICLE_ID, it.articleId) .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.MESSAGE_ID, messageId) - .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.EVENT_TYPE_CD, BatchSendEventType.SEND.code) - .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.SEND_TYPE_CD, BatchSendType.AWSSES.code) + .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.EVENT_TYPE_CD, SendEventType.SEND.code) + .set(SendArticleEventHistory.SEND_ARTICLE_EVENT_HISTORY.SEND_TYPE_CD, SendType.AWSSES.code) ) } catch (e: Exception) { mailSendRecorder.recordFail( @@ -93,7 +96,11 @@ class WorkBookSubscriberWriter( mailSendRecorder.getSuccessMemberIds(), receiveLastDayRecords.getMemberIds() ).filter().map { - UpdateProgressRecord(it.memberId, it.targetWorkBookId, it.progress) + UpdateProgressRecord( + it.memberId, + it.targetWorkBookId, + it.progress + ) } /** 진행률 업데이트 */ diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecord.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecord.kt similarity index 83% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecord.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecord.kt index 0a239b05a..fe4519dc4 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecord.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.model +package com.few.api.domain.batch.article.writer.model fun List.getMemberIds(): Set { return this.map { it.memberId }.toSet() diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilter.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecordFilter.kt similarity index 80% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilter.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecordFilter.kt index 5d55380de..4acbe199b 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilter.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/ReceiveLastArticleRecordFilter.kt @@ -1,6 +1,6 @@ -package com.few.batch.service.article.writer.model +package com.few.api.domain.batch.article.writer.model -import com.few.batch.service.article.dto.WorkBookSubscriberItem +import com.few.api.domain.batch.article.dto.WorkBookSubscriberItem /** * 학습지의 마지막 아티클을 받은 구독자 정보 필터 diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecord.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecord.kt similarity index 75% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecord.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecord.kt index 794037ee6..953139fcb 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecord.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.model +package com.few.api.domain.batch.article.writer.model data class UpdateProgressRecord( val memberId: Long, diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilter.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecordFilter.kt similarity index 84% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilter.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecordFilter.kt index 6e9a53bcb..b501f573e 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilter.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/model/UpdateProgressRecordFilter.kt @@ -1,6 +1,6 @@ -package com.few.batch.service.article.writer.model +package com.few.api.domain.batch.article.writer.model -import com.few.batch.service.article.dto.WorkBookSubscriberItem +import com.few.api.domain.batch.article.dto.WorkBookSubscriberItem /** * 진행률을 업데이트할 구독자 정보 필터 diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseArticleContentsService.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseArticleContentsService.kt similarity index 91% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseArticleContentsService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseArticleContentsService.kt index 85375c5da..c545de05b 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseArticleContentsService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseArticleContentsService.kt @@ -1,6 +1,6 @@ -package com.few.batch.service.article.writer.service +package com.few.api.domain.batch.article.writer.service -import com.few.batch.data.common.code.BatchMemberType +import com.few.api.domain.common.vo.MemberType import jooq.jooq_dsl.tables.ArticleIfo import jooq.jooq_dsl.tables.ArticleMst import jooq.jooq_dsl.tables.Member @@ -44,7 +44,7 @@ class BrowseArticleContentsService( .join(Member.MEMBER) .on( ArticleMst.ARTICLE_MST.MEMBER_ID.eq(Member.MEMBER.ID) - .and(Member.MEMBER.TYPE_CD.eq(BatchMemberType.WRITER.code)) + .and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code)) ) .where(ArticleIfo.ARTICLE_IFO.ARTICLE_MST_ID.`in`(articleIds)) .and(ArticleIfo.ARTICLE_IFO.DELETED_AT.isNull) diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberEmailService.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberEmailService.kt similarity index 92% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberEmailService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberEmailService.kt index b417cff1d..fe98a3aac 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberEmailService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberEmailService.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.service +package com.few.api.domain.batch.article.writer.service import jooq.jooq_dsl.tables.Member import org.jooq.DSLContext diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberReceiveArticlesService.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberReceiveArticlesService.kt similarity index 97% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberReceiveArticlesService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberReceiveArticlesService.kt index 079b1c630..646113948 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseMemberReceiveArticlesService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseMemberReceiveArticlesService.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.service +package com.few.api.domain.batch.article.writer.service import jooq.jooq_dsl.tables.MappingWorkbookArticle import org.jooq.DSLContext diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseWorkbookLastDayColService.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseWorkbookLastDayColService.kt similarity index 95% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseWorkbookLastDayColService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseWorkbookLastDayColService.kt index 1d368f599..95c5465bf 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/service/BrowseWorkbookLastDayColService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/service/BrowseWorkbookLastDayColService.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.service +package com.few.api.domain.batch.article.writer.service import jooq.jooq_dsl.tables.MappingWorkbookArticle import org.jooq.DSLContext diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailSendRecorder.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailSendRecorder.kt similarity index 77% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailSendRecorder.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailSendRecorder.kt index 99ab57c7f..73cd7d541 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailSendRecorder.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailSendRecorder.kt @@ -1,4 +1,4 @@ -package com.few.batch.service.article.writer.support +package com.few.api.domain.batch.article.writer.support private data class MemberMappedWorkBook( val memberId: Long, @@ -6,16 +6,11 @@ private data class MemberMappedWorkBook( ) /** 이메일 전송 성공/실패 기록을 위한 정보 기록 클래스 */ -class MailSendRecorder(mailServiceArgs: List) { +class MailSendRecorder(mailServiceArgs: List) { - private var records: MutableMap - private var failRecords: MutableMap> - - init { - records = - mailServiceArgs.associate { MemberMappedWorkBook(it.memberId, it.workbookId) to true }.toMutableMap() - failRecords = mutableMapOf() - } + private var records: MutableMap = + mailServiceArgs.associate { MemberMappedWorkBook(it.memberId, it.workbookId) to true }.toMutableMap() + private var failRecords: MutableMap> = mutableMapOf() fun recordFail(memberId: Long, workbookId: Long, reason: String) { records[MemberMappedWorkBook(memberId, workbookId)] = false diff --git a/batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailServiceArgsGenerator.kt b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailServiceArgsGenerator.kt similarity index 80% rename from batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailServiceArgsGenerator.kt rename to api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailServiceArgsGenerator.kt index 8c4a10899..9e6b775da 100644 --- a/batch/src/main/kotlin/com/few/batch/service/article/writer/support/MailServiceArgsGenerator.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/article/writer/support/MailServiceArgsGenerator.kt @@ -1,12 +1,12 @@ -package com.few.batch.service.article.writer.support +package com.few.api.domain.batch.article.writer.support -import com.few.batch.data.common.code.BatchCategoryType -import com.few.batch.service.article.dto.WorkBookSubscriberItem -import com.few.batch.service.article.writer.service.ArticleContent -import com.few.batch.service.article.writer.service.MemberReceiveArticles -import com.few.batch.service.article.writer.service.peek -import com.few.email.service.article.dto.Content -import com.few.email.service.article.dto.SendArticleEmailArgs +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.article.email.dto.Content +import com.few.api.domain.article.email.dto.SendArticleEmailArgs +import com.few.api.domain.batch.article.dto.WorkBookSubscriberItem +import com.few.api.domain.batch.article.writer.service.ArticleContent +import com.few.api.domain.batch.article.writer.service.MemberReceiveArticles +import com.few.api.domain.batch.article.writer.service.peek import java.net.URL import java.time.LocalDate @@ -41,7 +41,7 @@ class MailServiceArgsGenerator( Content( articleLink = URL("https://www.fewletter.com/article/${memberArticle.articleId}"), currentDate = date, - category = BatchCategoryType.convertToDisplayName(article.category.toByte()), + category = CategoryType.convertToDisplayName(article.category.toByte()), articleDay = memberArticle.dayCol.toInt(), articleTitle = article.articleTitle, writerName = article.writerName, diff --git a/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt b/api/src/main/kotlin/com/few/api/domain/batch/controller/BatchController.kt similarity index 79% rename from api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt rename to api/src/main/kotlin/com/few/api/domain/batch/controller/BatchController.kt index 7f7fb04db..4ec05dc9e 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/controller/BatchController.kt @@ -1,6 +1,6 @@ -package com.few.api.web.controller.batch +package com.few.api.domain.batch.controller -import com.few.batch.service.article.BatchSendArticleEmailService +import com.few.api.domain.batch.article.ApiBatchSendArticleEmailService import org.springframework.beans.factory.annotation.Value import org.springframework.validation.annotation.Validated import org.springframework.web.bind.annotation.PostMapping @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/batch") class BatchController( - private val batchSendArticleEmailService: BatchSendArticleEmailService, + private val batchSendArticleEmailService: ApiBatchSendArticleEmailService, @Value("\${auth.batch}") private val auth: String, ) { diff --git a/batch/src/main/kotlin/com/few/batch/log/BatchCallExecutionService.kt b/api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchCallExecutionService.kt similarity index 86% rename from batch/src/main/kotlin/com/few/batch/log/BatchCallExecutionService.kt rename to api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchCallExecutionService.kt index 294cce6da..60163a618 100644 --- a/batch/src/main/kotlin/com/few/batch/log/BatchCallExecutionService.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchCallExecutionService.kt @@ -1,4 +1,4 @@ -package com.few.batch.log +package com.few.api.domain.batch.log import jooq.jooq_dsl.Tables.BATCH_CALL_EXECUTION import org.jooq.DSLContext @@ -6,7 +6,7 @@ import org.jooq.JSON import org.springframework.stereotype.Service @Service -class BatchCallExecutionService( +class ApiBatchCallExecutionService( private val dslContext: DSLContext, ) { fun execute(status: Boolean, jsonDescription: String) { diff --git a/batch/src/main/kotlin/com/few/batch/log/BatchServiceLogAspect.kt b/api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchServiceLogAspect.kt similarity index 75% rename from batch/src/main/kotlin/com/few/batch/log/BatchServiceLogAspect.kt rename to api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchServiceLogAspect.kt index 9490efd4b..c173ea8ad 100644 --- a/batch/src/main/kotlin/com/few/batch/log/BatchServiceLogAspect.kt +++ b/api/src/main/kotlin/com/few/api/domain/batch/log/ApiBatchServiceLogAspect.kt @@ -1,4 +1,4 @@ -package com.few.batch.log +package com.few.api.domain.batch.log import io.github.oshai.kotlinlogging.KotlinLogging import org.aspectj.lang.ProceedingJoinPoint @@ -10,10 +10,10 @@ import java.util.* @Aspect @Component -class BatchServiceLogAspect { +class ApiBatchServiceLogAspect { private val log = KotlinLogging.logger {} - @Pointcut(value = "execution(* com.few.batch.service..*.execute(..))") + @Pointcut(value = "execution(* com.few.api.domain.batch..*.execute(..))") fun batchServiceDao() {} @Around("batchServiceDao()") @@ -21,12 +21,12 @@ class BatchServiceLogAspect { fun requestLogging(joinPoint: ProceedingJoinPoint): Any? { val signature = joinPoint.signature val splitByDot = - signature.declaringTypeName.split("\\.".toRegex()).dropLastWhile { it.isEmpty() } + signature.declaringTypeName.split(regex = "\\.".toRegex()).dropLastWhile { it.isEmpty() } .toTypedArray() val serviceName = splitByDot[splitByDot.size - 1] val args = joinPoint.args - log.trace { "$serviceName} execute with $args" } + log.trace { "$serviceName execute with $args" } val startTime = System.currentTimeMillis() val proceed = joinPoint.proceed() val elapsedTime = System.currentTimeMillis() - startTime diff --git a/api/src/main/kotlin/com/few/api/exception/common/ExternalIntegrationException.kt b/api/src/main/kotlin/com/few/api/domain/common/exception/ExternalIntegrationException.kt similarity index 57% rename from api/src/main/kotlin/com/few/api/exception/common/ExternalIntegrationException.kt rename to api/src/main/kotlin/com/few/api/domain/common/exception/ExternalIntegrationException.kt index 0e514b289..9764a02ca 100644 --- a/api/src/main/kotlin/com/few/api/exception/common/ExternalIntegrationException.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/exception/ExternalIntegrationException.kt @@ -1,23 +1,23 @@ -package com.few.api.exception.common +package com.few.api.domain.common.exception -import com.few.api.exception.support.MessageSourceAccessor +import com.few.api.config.ApiMessageSourceAccessor class ExternalIntegrationException : IllegalStateException { private val code: String - constructor(errorCode: String) : super(MessageSourceAccessor.getMessage(errorCode)) { + constructor(errorCode: String) : super(ApiMessageSourceAccessor.getMessage(errorCode)) { this.code = errorCode } constructor( errorCode: String, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(errorCode, args)) { + ) : super(ApiMessageSourceAccessor.getMessage(errorCode, args)) { this.code = errorCode } constructor(code: String, cause: Throwable?) : super( - MessageSourceAccessor.getMessage( + ApiMessageSourceAccessor.getMessage( code ), cause @@ -29,7 +29,7 @@ class ExternalIntegrationException : IllegalStateException { code: String, cause: Throwable?, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(code, args), cause) { + ) : super(ApiMessageSourceAccessor.getMessage(code, args), cause) { this.code = code } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/exception/common/InsertException.kt b/api/src/main/kotlin/com/few/api/domain/common/exception/InsertException.kt similarity index 56% rename from api/src/main/kotlin/com/few/api/exception/common/InsertException.kt rename to api/src/main/kotlin/com/few/api/domain/common/exception/InsertException.kt index f144429b6..eff735d52 100644 --- a/api/src/main/kotlin/com/few/api/exception/common/InsertException.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/exception/InsertException.kt @@ -1,23 +1,23 @@ -package com.few.api.exception.common +package com.few.api.domain.common.exception -import com.few.api.exception.support.MessageSourceAccessor +import com.few.api.config.ApiMessageSourceAccessor class InsertException : IllegalArgumentException { private val code: String - constructor(errorCode: String) : super(MessageSourceAccessor.getMessage(errorCode)) { + constructor(errorCode: String) : super(ApiMessageSourceAccessor.getMessage(errorCode)) { this.code = errorCode } constructor( errorCode: String, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(errorCode, args)) { + ) : super(ApiMessageSourceAccessor.getMessage(errorCode, args)) { this.code = errorCode } constructor(code: String, cause: Throwable?) : super( - MessageSourceAccessor.getMessage( + ApiMessageSourceAccessor.getMessage( code ), cause @@ -29,7 +29,7 @@ class InsertException : IllegalArgumentException { code: String, cause: Throwable?, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(code, args), cause) { + ) : super(ApiMessageSourceAccessor.getMessage(code, args), cause) { this.code = code } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/exception/common/NotFoundException.kt b/api/src/main/kotlin/com/few/api/domain/common/exception/NotFoundException.kt similarity index 56% rename from api/src/main/kotlin/com/few/api/exception/common/NotFoundException.kt rename to api/src/main/kotlin/com/few/api/domain/common/exception/NotFoundException.kt index baa38d42a..e115dcaa2 100644 --- a/api/src/main/kotlin/com/few/api/exception/common/NotFoundException.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/exception/NotFoundException.kt @@ -1,23 +1,23 @@ -package com.few.api.exception.common +package com.few.api.domain.common.exception -import com.few.api.exception.support.MessageSourceAccessor +import com.few.api.config.ApiMessageSourceAccessor class NotFoundException : IllegalArgumentException { private val code: String - constructor(errorCode: String) : super(MessageSourceAccessor.getMessage(errorCode)) { + constructor(errorCode: String) : super(ApiMessageSourceAccessor.getMessage(errorCode)) { this.code = errorCode } constructor( errorCode: String, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(errorCode, args)) { + ) : super(ApiMessageSourceAccessor.getMessage(errorCode, args)) { this.code = errorCode } constructor(code: String, cause: Throwable?) : super( - MessageSourceAccessor.getMessage( + ApiMessageSourceAccessor.getMessage( code ), cause @@ -29,7 +29,7 @@ class NotFoundException : IllegalArgumentException { code: String, cause: Throwable?, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(code, args), cause) { + ) : super(ApiMessageSourceAccessor.getMessage(code, args), cause) { this.code = code } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/domain/common/lock/LockAspect.kt b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockAspect.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/domain/common/lock/LockAspect.kt rename to api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockAspect.kt index 05a51c173..10a321f0b 100644 --- a/api/src/main/kotlin/com/few/api/domain/common/lock/LockAspect.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockAspect.kt @@ -1,7 +1,7 @@ package com.few.api.domain.common.lock import com.few.api.domain.subscription.usecase.dto.SubscribeWorkbookUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao +import com.few.api.domain.subscription.repo.SubscriptionDao import io.github.oshai.kotlinlogging.KotlinLogging import org.aspectj.lang.annotation.AfterReturning import org.aspectj.lang.annotation.AfterThrowing @@ -14,19 +14,19 @@ import org.springframework.stereotype.Component @Aspect @Component -class LockAspect( +class ApiLockAspect( private val subscriptionDao: SubscriptionDao, ) { private val log = KotlinLogging.logger {} - @Pointcut("@annotation(com.few.api.domain.common.lock.LockFor)") + @Pointcut("@annotation(com.few.api.domain.common.lock.ApiLockFor)") fun lockPointcut() {} @Before("lockPointcut()") fun before(joinPoint: JoinPoint) { getLockFor(joinPoint).run { when (this.identifier) { - LockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { + ApiLockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { getSubscriptionMemberIdAndWorkBookIdLockCase(joinPoint) } } @@ -61,7 +61,7 @@ class LockAspect( fun afterReturning(joinPoint: JoinPoint) { getLockFor(joinPoint).run { when (this.identifier) { - LockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { + ApiLockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { releaseSubscriptionMemberIdAndWorkBookIdLockCase(joinPoint) } } @@ -72,7 +72,7 @@ class LockAspect( fun afterThrowing(joinPoint: JoinPoint) { getLockFor(joinPoint).run { when (this.identifier) { - LockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { + ApiLockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID -> { releaseSubscriptionMemberIdAndWorkBookIdLockCase(joinPoint) } } @@ -80,7 +80,7 @@ class LockAspect( } private fun getLockFor(joinPoint: JoinPoint) = - (joinPoint.signature as MethodSignature).method.getAnnotation(LockFor::class.java) + (joinPoint.signature as MethodSignature).method.getAnnotation(ApiLockFor::class.java) private fun releaseSubscriptionMemberIdAndWorkBookIdLockCase(joinPoint: JoinPoint) { if (joinPoint.args[0] is SubscribeWorkbookUseCaseIn) { diff --git a/api/src/main/kotlin/com/few/api/domain/common/lock/LockFor.kt b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockFor.kt similarity index 63% rename from api/src/main/kotlin/com/few/api/domain/common/lock/LockFor.kt rename to api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockFor.kt index bd1af4189..4561c580c 100644 --- a/api/src/main/kotlin/com/few/api/domain/common/lock/LockFor.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockFor.kt @@ -2,6 +2,6 @@ package com.few.api.domain.common.lock @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.RUNTIME) -annotation class LockFor( - val identifier: LockIdentifier, +annotation class ApiLockFor( + val identifier: ApiLockIdentifier, ) \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/domain/common/lock/LockIdentifier.kt b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockIdentifier.kt similarity index 84% rename from api/src/main/kotlin/com/few/api/domain/common/lock/LockIdentifier.kt rename to api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockIdentifier.kt index 532e80899..c58182261 100644 --- a/api/src/main/kotlin/com/few/api/domain/common/lock/LockIdentifier.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/lock/ApiLockIdentifier.kt @@ -1,6 +1,6 @@ package com.few.api.domain.common.lock -enum class LockIdentifier { +enum class ApiLockIdentifier { /** * 구독 테이블에 멤버와 워크북을 기준으로 락을 건다. */ diff --git a/api/src/main/kotlin/com/few/api/client/repo/RepoClient.kt b/api/src/main/kotlin/com/few/api/domain/common/repo/client/ApiRepoClient.kt similarity index 88% rename from api/src/main/kotlin/com/few/api/client/repo/RepoClient.kt rename to api/src/main/kotlin/com/few/api/domain/common/repo/client/ApiRepoClient.kt index 985da9fdf..e4af637f5 100644 --- a/api/src/main/kotlin/com/few/api/client/repo/RepoClient.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/repo/client/ApiRepoClient.kt @@ -1,8 +1,8 @@ -package com.few.api.client.repo +package com.few.api.domain.common.repo.client -import com.few.api.client.config.properties.DiscordBodyProperty -import com.few.api.client.config.properties.Embed -import com.few.api.client.repo.dto.RepoAlterArgs +import web.client.DiscordBodyProperty +import web.client.Embed +import com.few.api.domain.common.repo.client.dto.RepoAlterArgs import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpEntity @@ -11,7 +11,7 @@ import org.springframework.stereotype.Service import org.springframework.web.client.RestTemplate @Service -class RepoClient( +class ApiRepoClient( private val restTemplate: RestTemplate, @Value("\${webhook.discord}") private val discordWebhook: String, ) { diff --git a/api/src/main/kotlin/com/few/api/client/repo/dto/RepoAlterArgs.kt b/api/src/main/kotlin/com/few/api/domain/common/repo/client/dto/RepoAlterArgs.kt similarity index 61% rename from api/src/main/kotlin/com/few/api/client/repo/dto/RepoAlterArgs.kt rename to api/src/main/kotlin/com/few/api/domain/common/repo/client/dto/RepoAlterArgs.kt index 41f17efc8..38756b96b 100644 --- a/api/src/main/kotlin/com/few/api/client/repo/dto/RepoAlterArgs.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/repo/client/dto/RepoAlterArgs.kt @@ -1,4 +1,4 @@ -package com.few.api.client.repo.dto +package com.few.api.domain.common.repo.client.dto data class RepoAlterArgs( val requestURL: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/common/LocalCacheEventLogger.kt b/api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiLocalCacheEventListener.kt similarity index 75% rename from api-repo/src/main/kotlin/com/few/api/repo/common/LocalCacheEventLogger.kt rename to api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiLocalCacheEventListener.kt index 4f28df241..56497b5b3 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/common/LocalCacheEventLogger.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiLocalCacheEventListener.kt @@ -1,10 +1,10 @@ -package com.few.api.repo.common +package com.few.api.domain.common.repo.event import io.github.oshai.kotlinlogging.KotlinLogging import org.ehcache.event.CacheEvent import org.ehcache.event.CacheEventListener -class LocalCacheEventLogger : CacheEventListener { +class ApiLocalCacheEventListener : CacheEventListener { private val log = KotlinLogging.logger {} override fun onEvent(event: CacheEvent) { diff --git a/api/src/main/kotlin/com/few/api/client/repo/event/SlowQueryEventListener.kt b/api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiSlowQueryEventListener.kt similarity index 62% rename from api/src/main/kotlin/com/few/api/client/repo/event/SlowQueryEventListener.kt rename to api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiSlowQueryEventListener.kt index 411acf111..b05ebd09a 100644 --- a/api/src/main/kotlin/com/few/api/client/repo/event/SlowQueryEventListener.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/repo/event/ApiSlowQueryEventListener.kt @@ -1,17 +1,17 @@ -package com.few.api.client.repo.event +package com.few.api.domain.common.repo.event -import com.few.api.client.repo.RepoClient -import com.few.api.client.repo.dto.RepoAlterArgs +import com.few.api.domain.common.repo.client.ApiRepoClient +import com.few.api.domain.common.repo.client.dto.RepoAlterArgs import com.few.api.config.ApiThreadPoolConfig.Companion.DISCORD_HOOK_EVENT_POOL -import com.few.api.repo.common.SlowQueryEvent +import repo.common.SlowQueryEvent import org.slf4j.MDC import org.springframework.context.event.EventListener import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component @Component -class SlowQueryEventListener( - private val repoClient: RepoClient, +class ApiSlowQueryEventListener( + private val apiRepoClient: ApiRepoClient, ) { @Async(value = DISCORD_HOOK_EVENT_POOL) @@ -21,6 +21,6 @@ class SlowQueryEventListener( requestURL = MDC.get("Request-URL") ?: "", query = event.slowQuery ) - repoClient.announceRepoAlter(args) + apiRepoClient.announceRepoAlter(args) } } \ No newline at end of file diff --git a/data/src/main/kotlin/com/few/data/common/code/CategoryType.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/CategoryType.kt similarity index 86% rename from data/src/main/kotlin/com/few/data/common/code/CategoryType.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/CategoryType.kt index 04b123b23..a46691fcf 100644 --- a/data/src/main/kotlin/com/few/data/common/code/CategoryType.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/CategoryType.kt @@ -1,9 +1,5 @@ -package com.few.data.common.code +package com.few.api.domain.common.vo -/** - * @see com.few.batch.data.common.code.BatchCategoryType - * @see com.few.api.web.support.WorkBookCategory - */ enum class CategoryType(val code: Byte, val displayName: String) { All(-1, "전체"), // Should not be stored in the DB ECONOMY(0, "경제"), diff --git a/api/src/main/kotlin/com/few/api/web/support/DayCode.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/DayCode.kt similarity index 98% rename from api/src/main/kotlin/com/few/api/web/support/DayCode.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/DayCode.kt index c2f5ab6bc..af3956472 100644 --- a/api/src/main/kotlin/com/few/api/web/support/DayCode.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/DayCode.kt @@ -1,8 +1,5 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo -/** - * @see com.few.data.common.code.DayCode - */ enum class DayCode(val code: String, val days: String) { MON("0000001", "월"), TUE("0000010", "화"), diff --git a/api/src/main/kotlin/com/few/api/web/support/EmailLogEventType.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/EmailLogEventType.kt similarity index 84% rename from api/src/main/kotlin/com/few/api/web/support/EmailLogEventType.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/EmailLogEventType.kt index 7628cd23e..ecfde6f1c 100644 --- a/api/src/main/kotlin/com/few/api/web/support/EmailLogEventType.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/EmailLogEventType.kt @@ -1,8 +1,5 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo -/** - * @see com.few.data.common.code.SendEventType - */ enum class EmailLogEventType(val code: Byte, val type: String) { OPEN(0, "open"), DELIVERY(1, "delivery"), diff --git a/data/src/main/kotlin/com/few/data/common/code/MemberType.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/MemberType.kt similarity index 78% rename from data/src/main/kotlin/com/few/data/common/code/MemberType.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/MemberType.kt index 64aa02483..94106bae6 100644 --- a/data/src/main/kotlin/com/few/data/common/code/MemberType.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/MemberType.kt @@ -1,8 +1,5 @@ -package com.few.data.common.code +package com.few.api.domain.common.vo -/** - * @see com.few.batch.data.common.code.BatchMemberType - */ enum class MemberType(val code: Byte, val displayName: String) { PREAUTH(30, "가입대기멤버"), NORMAL(60, "일반멤버"), diff --git a/data/src/main/kotlin/com/few/data/common/code/SendEventType.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/SendEventType.kt similarity index 75% rename from data/src/main/kotlin/com/few/data/common/code/SendEventType.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/SendEventType.kt index 6daf4b3ee..cc8b6f520 100644 --- a/data/src/main/kotlin/com/few/data/common/code/SendEventType.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/SendEventType.kt @@ -1,9 +1,5 @@ -package com.few.data.common.code +package com.few.api.domain.common.vo -/** - * @see com.few.api.web.support.EmailLogEventType - * @see com.few.batch.data.common.code.BatchSendEventType - */ enum class SendEventType(val code: Byte, val type: String) { OPEN(0, "open"), DELIVERY(1, "delivery"), diff --git a/api/src/main/kotlin/com/few/api/web/support/SendType.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/SendType.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/web/support/SendType.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/SendType.kt index e4f61bfee..318b21275 100644 --- a/api/src/main/kotlin/com/few/api/web/support/SendType.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/SendType.kt @@ -1,8 +1,5 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo -/** - * @see com.few.data.common.code.SendType - */ enum class SendType(val code: Byte) { EMAIL(0), AWSSES(1), diff --git a/api/src/main/kotlin/com/few/api/web/support/ViewCategory.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/ViewCategory.kt similarity index 88% rename from api/src/main/kotlin/com/few/api/web/support/ViewCategory.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/ViewCategory.kt index 514cff4e4..6be015ed1 100644 --- a/api/src/main/kotlin/com/few/api/web/support/ViewCategory.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/ViewCategory.kt @@ -1,4 +1,4 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo enum class ViewCategory(val viewName: String) { MAIN_CARD("mainCard"), diff --git a/api/src/main/kotlin/com/few/api/web/support/WorkBookCategory.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookCategory.kt similarity index 82% rename from api/src/main/kotlin/com/few/api/web/support/WorkBookCategory.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookCategory.kt index ef4759998..a5e96a8ba 100644 --- a/api/src/main/kotlin/com/few/api/web/support/WorkBookCategory.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookCategory.kt @@ -1,9 +1,5 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo -/** - * WorkBookCategory is origin from CategoryType in few-data module. - * @see com.few.data.common.code.CategoryType - */ enum class WorkBookCategory(val code: Byte, val parameterName: String, val displayName: String) { All(-1, "all", "전체"), ECONOMY(0, "economy", "경제"), diff --git a/api/src/main/kotlin/com/few/api/web/support/WorkBookStatus.kt b/api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookStatus.kt similarity index 88% rename from api/src/main/kotlin/com/few/api/web/support/WorkBookStatus.kt rename to api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookStatus.kt index 1aac91f42..235cdb147 100644 --- a/api/src/main/kotlin/com/few/api/web/support/WorkBookStatus.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/vo/WorkBookStatus.kt @@ -1,4 +1,4 @@ -package com.few.api.web.support +package com.few.api.domain.common.vo enum class WorkBookStatus { ACTIVE, diff --git a/api/src/main/kotlin/com/few/api/domain/common/web/config/ApiWebConfigurer.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/ApiWebConfigurer.kt new file mode 100644 index 000000000..828cbdf76 --- /dev/null +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/ApiWebConfigurer.kt @@ -0,0 +1,18 @@ +package com.few.api.domain.common.web.config + +import com.few.api.domain.common.web.config.converter.* +import org.springframework.context.annotation.Configuration +import org.springframework.format.FormatterRegistry +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer + +@Configuration +class ApiWebConfigurer : WebMvcConfigurer { + + override fun addFormatters(registry: FormatterRegistry) { + registry.addConverter(WorkBookCategoryConverter()) + registry.addConverter(ViewConverter()) + registry.addConverter(DayCodeConverter()) + registry.addConverter(EmailLogEventTypeConverter()) + registry.addConverter(SendTypeConverter()) + } +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/config/converter/DayCodeConverter.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/DayCodeConverter.kt similarity index 68% rename from api/src/main/kotlin/com/few/api/web/config/converter/DayCodeConverter.kt rename to api/src/main/kotlin/com/few/api/domain/common/web/config/converter/DayCodeConverter.kt index 35645d020..4e4f2ea80 100644 --- a/api/src/main/kotlin/com/few/api/web/config/converter/DayCodeConverter.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/DayCodeConverter.kt @@ -1,6 +1,6 @@ -package com.few.api.web.config.converter +package com.few.api.domain.common.web.config.converter -import com.few.api.web.support.DayCode +import com.few.api.domain.common.vo.DayCode import org.springframework.core.convert.converter.Converter class DayCodeConverter : Converter { diff --git a/api/src/main/kotlin/com/few/api/web/config/converter/EmailLogEventTypeConverter.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/EmailLogEventTypeConverter.kt similarity index 76% rename from api/src/main/kotlin/com/few/api/web/config/converter/EmailLogEventTypeConverter.kt rename to api/src/main/kotlin/com/few/api/domain/common/web/config/converter/EmailLogEventTypeConverter.kt index ae8aa4102..8ccfcfde4 100644 --- a/api/src/main/kotlin/com/few/api/web/config/converter/EmailLogEventTypeConverter.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/EmailLogEventTypeConverter.kt @@ -1,6 +1,6 @@ -package com.few.api.web.config.converter +package com.few.api.domain.common.web.config.converter -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.common.vo.EmailLogEventType import org.springframework.core.convert.converter.Converter class EmailLogEventTypeConverter : Converter { diff --git a/api/src/main/kotlin/com/few/api/web/config/converter/SendTypeConverter.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/SendTypeConverter.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/web/config/converter/SendTypeConverter.kt rename to api/src/main/kotlin/com/few/api/domain/common/web/config/converter/SendTypeConverter.kt index ae84a0f0b..894a9e3ff 100644 --- a/api/src/main/kotlin/com/few/api/web/config/converter/SendTypeConverter.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/SendTypeConverter.kt @@ -1,6 +1,6 @@ -package com.few.api.web.config.converter +package com.few.api.domain.common.web.config.converter -import com.few.api.web.support.SendType +import com.few.api.domain.common.vo.SendType import org.springframework.core.convert.converter.Converter class SendTypeConverter : Converter { diff --git a/api/src/main/kotlin/com/few/api/web/config/converter/ViewConverter.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/ViewConverter.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/web/config/converter/ViewConverter.kt rename to api/src/main/kotlin/com/few/api/domain/common/web/config/converter/ViewConverter.kt index 8c9051171..eb426ecc2 100644 --- a/api/src/main/kotlin/com/few/api/web/config/converter/ViewConverter.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/ViewConverter.kt @@ -1,6 +1,6 @@ -package com.few.api.web.config.converter +package com.few.api.domain.common.web.config.converter -import com.few.api.web.support.ViewCategory +import com.few.api.domain.common.vo.ViewCategory import org.springframework.core.convert.converter.Converter class ViewConverter : Converter { diff --git a/api/src/main/kotlin/com/few/api/web/config/converter/WorkBookCategoryConverter.kt b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/WorkBookCategoryConverter.kt similarity index 70% rename from api/src/main/kotlin/com/few/api/web/config/converter/WorkBookCategoryConverter.kt rename to api/src/main/kotlin/com/few/api/domain/common/web/config/converter/WorkBookCategoryConverter.kt index 1b5f9a4d1..c3a056d3d 100644 --- a/api/src/main/kotlin/com/few/api/web/config/converter/WorkBookCategoryConverter.kt +++ b/api/src/main/kotlin/com/few/api/domain/common/web/config/converter/WorkBookCategoryConverter.kt @@ -1,6 +1,6 @@ -package com.few.api.web.config.converter +package com.few.api.domain.common.web.config.converter -import com.few.api.web.support.WorkBookCategory +import com.few.api.domain.common.vo.WorkBookCategory import org.springframework.core.convert.converter.Converter class WorkBookCategoryConverter : Converter { diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/ApiLogController.kt b/api/src/main/kotlin/com/few/api/domain/log/controller/ApiLogController.kt similarity index 79% rename from api/src/main/kotlin/com/few/api/web/controller/admin/ApiLogController.kt rename to api/src/main/kotlin/com/few/api/domain/log/controller/ApiLogController.kt index 58824e9b9..6d2924b79 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/ApiLogController.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/controller/ApiLogController.kt @@ -1,13 +1,14 @@ -package com.few.api.web.controller.admin +package com.few.api.domain.log.controller -import com.few.api.domain.log.AddApiLogUseCase -import com.few.api.domain.log.AddEmailLogUseCase +import com.few.api.domain.log.controller.request.EmailLogRequest +import com.few.api.domain.log.usecase.AddApiLogUseCase +import com.few.api.domain.log.usecase.AddEmailLogUseCase import com.few.api.domain.log.dto.AddApiLogUseCaseIn import com.few.api.domain.log.dto.AddEmailLogUseCaseIn -import com.few.api.web.controller.admin.request.* -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.common.vo.EmailLogEventType +import com.few.api.domain.log.controller.request.ApiLogRequest +import web.ApiResponse +import web.ApiResponseGenerator import org.springframework.http.HttpStatus import org.springframework.validation.annotation.Validated import org.springframework.web.bind.annotation.PostMapping diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ApiLogRequest.kt b/api/src/main/kotlin/com/few/api/domain/log/controller/request/ApiLogRequest.kt similarity index 51% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/ApiLogRequest.kt rename to api/src/main/kotlin/com/few/api/domain/log/controller/request/ApiLogRequest.kt index 60f4790f8..446da560c 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/ApiLogRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/controller/request/ApiLogRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.log.controller.request data class ApiLogRequest( val history: String, diff --git a/api/src/main/kotlin/com/few/api/web/controller/admin/request/EmailLogRequest.kt b/api/src/main/kotlin/com/few/api/domain/log/controller/request/EmailLogRequest.kt similarity index 85% rename from api/src/main/kotlin/com/few/api/web/controller/admin/request/EmailLogRequest.kt rename to api/src/main/kotlin/com/few/api/domain/log/controller/request/EmailLogRequest.kt index ed46a2f3d..b88366133 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/admin/request/EmailLogRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/controller/request/EmailLogRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.admin.request +package com.few.api.domain.log.controller.request import com.fasterxml.jackson.annotation.JsonFormat import java.time.LocalDateTime diff --git a/api/src/main/kotlin/com/few/api/domain/log/dto/AddEmailLogUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/log/dto/AddEmailLogUseCaseIn.kt index bab41880e..d809805b9 100644 --- a/api/src/main/kotlin/com/few/api/domain/log/dto/AddEmailLogUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/dto/AddEmailLogUseCaseIn.kt @@ -1,6 +1,6 @@ package com.few.api.domain.log.dto -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.common.vo.EmailLogEventType import java.time.LocalDateTime data class AddEmailLogUseCaseIn( diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/LogIfoDao.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/LogIfoDao.kt similarity index 82% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/LogIfoDao.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/LogIfoDao.kt index 1f793d5c7..f6a72e822 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/LogIfoDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/LogIfoDao.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.log +package com.few.api.domain.log.repo -import com.few.api.repo.dao.log.command.InsertLogCommand +import com.few.api.domain.log.repo.command.InsertLogCommand import jooq.jooq_dsl.tables.LogIfo import org.jooq.DSLContext import org.jooq.JSON diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/SendArticleEventHistoryDao.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/SendArticleEventHistoryDao.kt similarity index 89% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/SendArticleEventHistoryDao.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/SendArticleEventHistoryDao.kt index b087fa9fb..483b8f26e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/SendArticleEventHistoryDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/SendArticleEventHistoryDao.kt @@ -1,8 +1,8 @@ -package com.few.api.repo.dao.log +package com.few.api.domain.log.repo -import com.few.api.repo.dao.log.command.InsertEventCommand -import com.few.api.repo.dao.log.query.SelectEventByMessageIdAndEventTypeQuery -import com.few.api.repo.dao.log.record.SendArticleEventHistoryRecord +import com.few.api.domain.log.repo.command.InsertEventCommand +import com.few.api.domain.log.repo.query.SelectEventByMessageIdAndEventTypeQuery +import com.few.api.domain.log.repo.record.SendArticleEventHistoryRecord import jooq.jooq_dsl.tables.SendArticleEventHistory import org.jooq.DSLContext import org.springframework.stereotype.Repository diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertEventCommand.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertEventCommand.kt similarity index 78% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertEventCommand.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertEventCommand.kt index 635820737..83f935399 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertEventCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertEventCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.log.command +package com.few.api.domain.log.repo.command data class InsertEventCommand( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertLogCommand.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertLogCommand.kt similarity index 56% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertLogCommand.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertLogCommand.kt index b69cb5ad8..73e821dbb 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/command/InsertLogCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/command/InsertLogCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.log.command +package com.few.api.domain.log.repo.command data class InsertLogCommand( val history: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/query/SelectEventByMessageIdAndEventTypeQuery.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/query/SelectEventByMessageIdAndEventTypeQuery.kt similarity index 71% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/query/SelectEventByMessageIdAndEventTypeQuery.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/query/SelectEventByMessageIdAndEventTypeQuery.kt index 05d96a8b5..3def89e91 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/query/SelectEventByMessageIdAndEventTypeQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/query/SelectEventByMessageIdAndEventTypeQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.log.query +package com.few.api.domain.log.repo.query data class SelectEventByMessageIdAndEventTypeQuery( val messageId: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/record/SendArticleEventHistoryRecord.kt b/api/src/main/kotlin/com/few/api/domain/log/repo/record/SendArticleEventHistoryRecord.kt similarity index 79% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/log/record/SendArticleEventHistoryRecord.kt rename to api/src/main/kotlin/com/few/api/domain/log/repo/record/SendArticleEventHistoryRecord.kt index 1b2be2b18..f2754b13b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/log/record/SendArticleEventHistoryRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/repo/record/SendArticleEventHistoryRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.log.record +package com.few.api.domain.log.repo.record data class SendArticleEventHistoryRecord( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/log/AddApiLogUseCase.kt b/api/src/main/kotlin/com/few/api/domain/log/usecase/AddApiLogUseCase.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/domain/log/AddApiLogUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/log/usecase/AddApiLogUseCase.kt index 90ad5116d..c3f22f9c0 100644 --- a/api/src/main/kotlin/com/few/api/domain/log/AddApiLogUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/usecase/AddApiLogUseCase.kt @@ -1,8 +1,8 @@ -package com.few.api.domain.log +package com.few.api.domain.log.usecase import com.few.api.domain.log.dto.AddApiLogUseCaseIn -import com.few.api.repo.dao.log.LogIfoDao -import com.few.api.repo.dao.log.command.InsertLogCommand +import com.few.api.domain.log.repo.LogIfoDao +import com.few.api.domain.log.repo.command.InsertLogCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/log/AddEmailLogUseCase.kt b/api/src/main/kotlin/com/few/api/domain/log/usecase/AddEmailLogUseCase.kt similarity index 76% rename from api/src/main/kotlin/com/few/api/domain/log/AddEmailLogUseCase.kt rename to api/src/main/kotlin/com/few/api/domain/log/usecase/AddEmailLogUseCase.kt index a6982c2aa..13f19ba64 100644 --- a/api/src/main/kotlin/com/few/api/domain/log/AddEmailLogUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/log/usecase/AddEmailLogUseCase.kt @@ -1,12 +1,12 @@ -package com.few.api.domain.log +package com.few.api.domain.log.usecase import com.few.api.domain.log.dto.AddEmailLogUseCaseIn -import com.few.api.repo.dao.log.SendArticleEventHistoryDao -import com.few.api.repo.dao.log.command.InsertEventCommand -import com.few.api.repo.dao.log.query.SelectEventByMessageIdAndEventTypeQuery -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectMemberByEmailQuery -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.log.repo.SendArticleEventHistoryDao +import com.few.api.domain.log.repo.command.InsertEventCommand +import com.few.api.domain.log.repo.query.SelectEventByMessageIdAndEventTypeQuery +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectMemberByEmailQuery +import com.few.api.domain.common.vo.EmailLogEventType import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import org.webjars.NotFoundException diff --git a/api/src/main/kotlin/com/few/api/web/controller/member/MemberController.kt b/api/src/main/kotlin/com/few/api/domain/member/controller/MemberController.kt similarity index 86% rename from api/src/main/kotlin/com/few/api/web/controller/member/MemberController.kt rename to api/src/main/kotlin/com/few/api/domain/member/controller/MemberController.kt index f1677d3cf..3fc89d7b8 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/member/MemberController.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/controller/MemberController.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.member +package com.few.api.domain.member.controller import com.few.api.domain.member.usecase.DeleteMemberUseCase import com.few.api.domain.member.usecase.SaveMemberUseCase @@ -6,13 +6,12 @@ import com.few.api.domain.member.usecase.TokenUseCase import com.few.api.domain.member.usecase.dto.DeleteMemberUseCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn import com.few.api.domain.member.usecase.dto.TokenUseCaseIn -import com.few.api.security.authentication.token.TokenUserDetails -import com.few.api.web.controller.member.request.SaveMemberRequest -import com.few.api.web.controller.member.request.TokenRequest -import com.few.api.web.controller.member.response.SaveMemberResponse -import com.few.api.web.controller.member.response.TokenResponse -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator +import com.few.api.domain.member.controller.request.SaveMemberRequest +import com.few.api.domain.member.controller.request.TokenRequest +import com.few.api.domain.member.controller.response.SaveMemberResponse +import com.few.api.domain.member.controller.response.TokenResponse +import web.ApiResponse +import web.ApiResponseGenerator import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.security.core.annotation.AuthenticationPrincipal @@ -23,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController +import security.TokenUserDetails @Validated @RestController diff --git a/api/src/main/kotlin/com/few/api/web/controller/member/request/SaveMemberRequest.kt b/api/src/main/kotlin/com/few/api/domain/member/controller/request/SaveMemberRequest.kt similarity index 76% rename from api/src/main/kotlin/com/few/api/web/controller/member/request/SaveMemberRequest.kt rename to api/src/main/kotlin/com/few/api/domain/member/controller/request/SaveMemberRequest.kt index 3b1e4536d..ff5a2c63f 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/member/request/SaveMemberRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/controller/request/SaveMemberRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.member.request +package com.few.api.domain.member.controller.request import jakarta.validation.constraints.Email diff --git a/api/src/main/kotlin/com/few/api/web/controller/member/request/TokenRequest.kt b/api/src/main/kotlin/com/few/api/domain/member/controller/request/TokenRequest.kt similarity index 52% rename from api/src/main/kotlin/com/few/api/web/controller/member/request/TokenRequest.kt rename to api/src/main/kotlin/com/few/api/domain/member/controller/request/TokenRequest.kt index 76e80d9e2..5b7f02b85 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/member/request/TokenRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/controller/request/TokenRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.member.request +package com.few.api.domain.member.controller.request data class TokenRequest( val refreshToken: String?, diff --git a/api/src/main/kotlin/com/few/api/web/controller/member/response/SaveMemberResponse.kt b/api/src/main/kotlin/com/few/api/domain/member/controller/response/SaveMemberResponse.kt similarity index 53% rename from api/src/main/kotlin/com/few/api/web/controller/member/response/SaveMemberResponse.kt rename to api/src/main/kotlin/com/few/api/domain/member/controller/response/SaveMemberResponse.kt index 1f2fc68a2..446b437a6 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/member/response/SaveMemberResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/controller/response/SaveMemberResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.member.response +package com.few.api.domain.member.controller.response data class SaveMemberResponse( val isSendAuth: Boolean, diff --git a/api/src/main/kotlin/com/few/api/web/controller/member/response/TokenResponse.kt b/api/src/main/kotlin/com/few/api/domain/member/controller/response/TokenResponse.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/web/controller/member/response/TokenResponse.kt rename to api/src/main/kotlin/com/few/api/domain/member/controller/response/TokenResponse.kt index 831f5ea9c..70aa0a837 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/member/response/TokenResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/controller/response/TokenResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.member.response +package com.few.api.domain.member.controller.response data class TokenResponse( val accessToken: String, diff --git a/email/src/main/kotlin/com/few/email/service/member/SendAuthEmailService.kt b/api/src/main/kotlin/com/few/api/domain/member/email/SendAuthEmailService.kt similarity index 81% rename from email/src/main/kotlin/com/few/email/service/member/SendAuthEmailService.kt rename to api/src/main/kotlin/com/few/api/domain/member/email/SendAuthEmailService.kt index 510e15e57..5667397d7 100644 --- a/email/src/main/kotlin/com/few/email/service/member/SendAuthEmailService.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/email/SendAuthEmailService.kt @@ -1,8 +1,8 @@ -package com.few.email.service.member +package com.few.api.domain.member.email -import com.few.email.sender.EmailSender -import com.few.email.sender.provider.EmailSendProvider -import com.few.email.service.member.dto.SendAuthEmailArgs +import email.EmailSender +import email.provider.EmailSendProvider +import com.few.api.domain.member.email.dto.SendAuthEmailArgs import org.springframework.boot.autoconfigure.mail.MailProperties import org.springframework.stereotype.Component import org.thymeleaf.TemplateEngine diff --git a/email/src/main/kotlin/com/few/email/service/member/dto/SendAuthEmailArgs.kt b/api/src/main/kotlin/com/few/api/domain/member/email/dto/SendAuthEmailArgs.kt similarity index 81% rename from email/src/main/kotlin/com/few/email/service/member/dto/SendAuthEmailArgs.kt rename to api/src/main/kotlin/com/few/api/domain/member/email/dto/SendAuthEmailArgs.kt index 1b40a0892..5ad921e98 100644 --- a/email/src/main/kotlin/com/few/email/service/member/dto/SendAuthEmailArgs.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/email/dto/SendAuthEmailArgs.kt @@ -1,6 +1,6 @@ -package com.few.email.service.member.dto +package com.few.api.domain.member.email.dto -import com.few.email.sender.dto.SendMailArgs +import email.SendMailArgs import java.net.URL data class SendAuthEmailArgs( diff --git a/api/src/main/kotlin/com/few/api/exception/member/NotValidTokenException.kt b/api/src/main/kotlin/com/few/api/domain/member/exception/NotValidTokenException.kt similarity index 56% rename from api/src/main/kotlin/com/few/api/exception/member/NotValidTokenException.kt rename to api/src/main/kotlin/com/few/api/domain/member/exception/NotValidTokenException.kt index 97cc0f817..445ac4dfe 100644 --- a/api/src/main/kotlin/com/few/api/exception/member/NotValidTokenException.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/exception/NotValidTokenException.kt @@ -1,23 +1,23 @@ -package com.few.api.exception.member +package com.few.api.domain.member.exception -import com.few.api.exception.support.MessageSourceAccessor +import com.few.api.config.ApiMessageSourceAccessor class NotValidTokenException : IllegalStateException { private val code: String - constructor(errorCode: String) : super(MessageSourceAccessor.getMessage(errorCode)) { + constructor(errorCode: String) : super(ApiMessageSourceAccessor.getMessage(errorCode)) { this.code = errorCode } constructor( errorCode: String, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(errorCode, args)) { + ) : super(ApiMessageSourceAccessor.getMessage(errorCode, args)) { this.code = errorCode } constructor(code: String, cause: Throwable?) : super( - MessageSourceAccessor.getMessage( + ApiMessageSourceAccessor.getMessage( code ), cause @@ -29,7 +29,7 @@ class NotValidTokenException : IllegalStateException { code: String, cause: Throwable?, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(code, args), cause) { + ) : super(ApiMessageSourceAccessor.getMessage(code, args), cause) { this.code = code } } \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberCacheManager.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/MemberCacheManager.kt similarity index 85% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberCacheManager.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/MemberCacheManager.kt index fd5dcc93a..ee3b3a336 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberCacheManager.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/MemberCacheManager.kt @@ -1,7 +1,7 @@ -package com.few.api.repo.dao.member +package com.few.api.domain.member.repo -import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_WRITER_CACHE -import com.few.api.repo.dao.member.record.WriterRecord +import com.few.api.config.ApiLocalCacheConfig.Companion.SELECT_WRITER_CACHE +import com.few.api.domain.member.repo.record.WriterRecord import org.springframework.cache.CacheManager import org.springframework.stereotype.Service import javax.cache.Cache diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/MemberDao.kt similarity index 91% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/MemberDao.kt index d72022b8b..a8bebe4c8 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/MemberDao.kt @@ -1,18 +1,18 @@ -package com.few.api.repo.dao.member - -import com.few.api.repo.config.LocalCacheConfig.Companion.LOCAL_CM -import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_WRITER_CACHE -import com.few.api.repo.dao.member.command.DeleteMemberCommand -import com.few.api.repo.dao.member.command.InsertMemberCommand -import com.few.api.repo.dao.member.command.UpdateDeletedMemberTypeCommand -import com.few.api.repo.dao.member.command.UpdateMemberTypeCommand -import com.few.api.repo.dao.member.query.* -import com.few.api.repo.dao.member.record.MemberIdAndIsDeletedRecord -import com.few.api.repo.dao.member.record.MemberRecord -import com.few.api.repo.dao.member.record.MemberEmailAndTypeRecord -import com.few.api.repo.dao.member.record.WriterRecord -import com.few.api.repo.dao.member.record.WriterRecordMappedWorkbook -import com.few.data.common.code.MemberType +package com.few.api.domain.member.repo + +import com.few.api.domain.common.vo.MemberType +import com.few.api.config.ApiLocalCacheConfig.Companion.LOCAL_CM +import com.few.api.config.ApiLocalCacheConfig.Companion.SELECT_WRITER_CACHE +import com.few.api.domain.member.repo.command.DeleteMemberCommand +import com.few.api.domain.member.repo.command.InsertMemberCommand +import com.few.api.domain.member.repo.command.UpdateDeletedMemberTypeCommand +import com.few.api.domain.member.repo.command.UpdateMemberTypeCommand +import com.few.api.domain.member.repo.query.* +import com.few.api.domain.member.repo.record.MemberIdAndIsDeletedRecord +import com.few.api.domain.member.repo.record.MemberRecord +import com.few.api.domain.member.repo.record.MemberEmailAndTypeRecord +import com.few.api.domain.member.repo.record.WriterRecordMappedWorkbook +import com.few.api.domain.member.repo.record.WriterRecord import jooq.jooq_dsl.tables.ArticleMst import jooq.jooq_dsl.tables.MappingWorkbookArticle import jooq.jooq_dsl.tables.Member diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/DeleteMemberCommand.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/command/DeleteMemberCommand.kt similarity index 55% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/DeleteMemberCommand.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/command/DeleteMemberCommand.kt index a0b98e268..3ce96eb33 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/DeleteMemberCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/command/DeleteMemberCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.command +package com.few.api.domain.member.repo.command data class DeleteMemberCommand( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/member/repo/command/InsertMemberCommand.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/command/InsertMemberCommand.kt new file mode 100644 index 000000000..4c863030f --- /dev/null +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/command/InsertMemberCommand.kt @@ -0,0 +1,8 @@ +package com.few.api.domain.member.repo.command + +import com.few.api.domain.common.vo.MemberType + +data class InsertMemberCommand( + val email: String, + val memberType: MemberType, +) \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateDeletedMemberTypeCommand.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateDeletedMemberTypeCommand.kt similarity index 50% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateDeletedMemberTypeCommand.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateDeletedMemberTypeCommand.kt index 8d46d8984..ead27d7c9 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/command/UpdateDeletedMemberTypeCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateDeletedMemberTypeCommand.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.member.command +package com.few.api.domain.member.repo.command -import com.few.data.common.code.MemberType +import com.few.api.domain.common.vo.MemberType data class UpdateDeletedMemberTypeCommand( val id: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateMemberTypeCommand.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateMemberTypeCommand.kt new file mode 100644 index 000000000..47a172bde --- /dev/null +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/command/UpdateMemberTypeCommand.kt @@ -0,0 +1,8 @@ +package com.few.api.domain.member.repo.command + +import com.few.api.domain.common.vo.MemberType + +data class UpdateMemberTypeCommand( + val id: Long, + val memberType: MemberType, +) \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/BrowseWorkbookWritersQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/BrowseWorkbookWritersQuery.kt similarity index 62% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/BrowseWorkbookWritersQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/BrowseWorkbookWritersQuery.kt index f40ca4d30..3c9117c97 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/BrowseWorkbookWritersQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/BrowseWorkbookWritersQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class BrowseWorkbookWritersQuery( val workbookIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt similarity index 64% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt index e72afe483..07ea65a04 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailNotConsiderDeletedAtQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class SelectMemberByEmailNotConsiderDeletedAtQuery( val email: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailQuery.kt similarity index 57% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailQuery.kt index ead59a663..acff02a03 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberByEmailQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberByEmailQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class SelectMemberByEmailQuery( val email: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberEmailQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberEmailQuery.kt similarity index 57% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberEmailQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberEmailQuery.kt index 329f31035..fa3510de0 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectMemberEmailQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectMemberEmailQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class SelectMemberEmailQuery( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWriterQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWriterQuery.kt similarity index 55% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWriterQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWriterQuery.kt index e90079629..e1f22b5e0 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWriterQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWriterQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class SelectWriterQuery( val writerId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWritersQuery.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWritersQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWritersQuery.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWritersQuery.kt index 513032a8b..bcb524b63 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/query/SelectWritersQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/query/SelectWritersQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.query +package com.few.api.domain.member.repo.query data class SelectWritersQuery( val writerIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberEmailAndTypeRecord.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberEmailAndTypeRecord.kt similarity index 50% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberEmailAndTypeRecord.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberEmailAndTypeRecord.kt index 472f20917..a084d27d7 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberEmailAndTypeRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberEmailAndTypeRecord.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.member.record +package com.few.api.domain.member.repo.record -import com.few.data.common.code.MemberType +import com.few.api.domain.common.vo.MemberType data class MemberEmailAndTypeRecord( val email: String, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberIdAndIsDeletedRecord.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberIdAndIsDeletedRecord.kt similarity index 66% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberIdAndIsDeletedRecord.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberIdAndIsDeletedRecord.kt index f7bf5431a..3c9aa299d 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberIdAndIsDeletedRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberIdAndIsDeletedRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.record +package com.few.api.domain.member.repo.record data class MemberIdAndIsDeletedRecord( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberRecord.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberRecord.kt similarity index 80% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberRecord.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberRecord.kt index f4f21c01c..cfbfbf379 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/MemberRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/record/MemberRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.record +package com.few.api.domain.member.repo.record import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecord.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecord.kt similarity index 74% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecord.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecord.kt index ff9e7413e..fa1f63927 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.record +package com.few.api.domain.member.repo.record import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecordMappedWorkbook.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecordMappedWorkbook.kt similarity index 76% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecordMappedWorkbook.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecordMappedWorkbook.kt index 4dec7fd49..7d46b0b64 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/record/WriterRecordMappedWorkbook.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/record/WriterRecordMappedWorkbook.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.record +package com.few.api.domain.member.repo.record import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescription.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescription.kt similarity index 71% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescription.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescription.kt index a59a2c994..75b6d913b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescription.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescription.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.support +package com.few.api.domain.member.repo.support import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescriptionJsonMapper.kt b/api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescriptionJsonMapper.kt similarity index 92% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescriptionJsonMapper.kt rename to api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescriptionJsonMapper.kt index 37a129ea7..548fa4328 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/member/support/WriterDescriptionJsonMapper.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/repo/support/WriterDescriptionJsonMapper.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.member.support +package com.few.api.domain.member.repo.support import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.registerKotlinModule diff --git a/api/src/main/kotlin/com/few/api/domain/member/subscription/MemberSubscriptionService.kt b/api/src/main/kotlin/com/few/api/domain/member/service/MemberSubscriptionService.kt similarity index 65% rename from api/src/main/kotlin/com/few/api/domain/member/subscription/MemberSubscriptionService.kt rename to api/src/main/kotlin/com/few/api/domain/member/service/MemberSubscriptionService.kt index ac83fbfd3..3cbdd6b52 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/subscription/MemberSubscriptionService.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/service/MemberSubscriptionService.kt @@ -1,8 +1,8 @@ -package com.few.api.domain.member.subscription +package com.few.api.domain.member.service -import com.few.api.domain.member.subscription.dto.DeleteSubscriptionDto -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.UpdateDeletedAtInAllSubscriptionCommand +import com.few.api.domain.member.service.dto.DeleteSubscriptionDto +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.UpdateDeletedAtInAllSubscriptionCommand import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/member/subscription/dto/DeleteSubscriptionDto.kt b/api/src/main/kotlin/com/few/api/domain/member/service/dto/DeleteSubscriptionDto.kt similarity index 66% rename from api/src/main/kotlin/com/few/api/domain/member/subscription/dto/DeleteSubscriptionDto.kt rename to api/src/main/kotlin/com/few/api/domain/member/service/dto/DeleteSubscriptionDto.kt index dac23580a..13bab649f 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/subscription/dto/DeleteSubscriptionDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/service/dto/DeleteSubscriptionDto.kt @@ -1,4 +1,4 @@ -package com.few.api.domain.member.subscription.dto +package com.few.api.domain.member.service.dto data class DeleteSubscriptionDto( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/member/usecase/DeleteMemberUseCase.kt b/api/src/main/kotlin/com/few/api/domain/member/usecase/DeleteMemberUseCase.kt index ee4f22e48..5ecbc6713 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/usecase/DeleteMemberUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/usecase/DeleteMemberUseCase.kt @@ -1,11 +1,11 @@ package com.few.api.domain.member.usecase -import com.few.api.domain.member.subscription.MemberSubscriptionService -import com.few.api.domain.member.subscription.dto.DeleteSubscriptionDto +import com.few.api.domain.member.service.MemberSubscriptionService +import com.few.api.domain.member.service.dto.DeleteSubscriptionDto import com.few.api.domain.member.usecase.dto.DeleteMemberUseCaseIn import com.few.api.domain.member.usecase.dto.DeleteMemberUseCaseOut -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.DeleteMemberCommand +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.command.DeleteMemberCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCase.kt b/api/src/main/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCase.kt index 92d80636d..c9e4c983a 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCase.kt @@ -1,24 +1,24 @@ package com.few.api.domain.member.usecase -import com.few.api.config.crypto.IdEncryption import com.few.api.domain.member.usecase.dto.SaveMemberTxCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseOut import com.few.api.domain.member.usecase.transaction.SaveMemberTxCase -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectMemberByEmailNotConsiderDeletedAtQuery -import com.few.email.service.member.SendAuthEmailService -import com.few.email.service.member.dto.Content -import com.few.email.service.member.dto.SendAuthEmailArgs +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectMemberByEmailNotConsiderDeletedAtQuery +import com.few.api.domain.member.email.SendAuthEmailService +import com.few.api.domain.member.email.dto.Content +import com.few.api.domain.member.email.dto.SendAuthEmailArgs import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional +import security.IdEncryptor import java.net.URL @Component class SaveMemberUseCase( private val memberDao: MemberDao, private val sendAuthEmailService: SendAuthEmailService, - private val idEncryption: IdEncryption, + private val idEncryption: IdEncryptor, private val saveMemberTxCase: SaveMemberTxCase, ) { @Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/member/usecase/TokenUseCase.kt b/api/src/main/kotlin/com/few/api/domain/member/usecase/TokenUseCase.kt index e0a05d340..59b4bf8da 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/usecase/TokenUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/usecase/TokenUseCase.kt @@ -1,25 +1,25 @@ package com.few.api.domain.member.usecase -import com.few.api.config.crypto.IdEncryption +import com.few.api.domain.common.vo.MemberType +import security.IdEncryptor import com.few.api.domain.member.usecase.dto.TokenUseCaseIn import com.few.api.domain.member.usecase.dto.TokenUseCaseOut -import com.few.api.exception.member.NotValidTokenException -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.UpdateMemberTypeCommand -import com.few.api.security.authentication.authority.Roles -import com.few.api.security.token.TokenGenerator -import com.few.api.security.token.TokenResolver -import com.few.data.common.code.MemberType +import com.few.api.domain.member.exception.NotValidTokenException +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.command.UpdateMemberTypeCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import org.webjars.NotFoundException +import security.Roles +import security.TokenGenerator +import security.TokenResolver @Component class TokenUseCase( private val tokenGenerator: TokenGenerator, private val tokenResolver: TokenResolver, private val memberDao: MemberDao, - private val idEncryption: IdEncryption, + private val idEncryption: IdEncryptor, ) { @Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/member/usecase/dto/SaveMemberTxCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/member/usecase/dto/SaveMemberTxCaseIn.kt index 2e8d2f756..a8bb40941 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/usecase/dto/SaveMemberTxCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/usecase/dto/SaveMemberTxCaseIn.kt @@ -1,6 +1,6 @@ package com.few.api.domain.member.usecase.dto -import com.few.api.repo.dao.member.record.MemberIdAndIsDeletedRecord +import com.few.api.domain.member.repo.record.MemberIdAndIsDeletedRecord data class SaveMemberTxCaseIn( val record: MemberIdAndIsDeletedRecord?, diff --git a/api/src/main/kotlin/com/few/api/domain/member/usecase/transaction/SaveMemberTxCase.kt b/api/src/main/kotlin/com/few/api/domain/member/usecase/transaction/SaveMemberTxCase.kt index f3a564a90..0774c746f 100644 --- a/api/src/main/kotlin/com/few/api/domain/member/usecase/transaction/SaveMemberTxCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/member/usecase/transaction/SaveMemberTxCase.kt @@ -1,16 +1,15 @@ package com.few.api.domain.member.usecase.transaction +import com.few.api.domain.common.vo.MemberType import com.few.api.domain.member.usecase.dto.SaveMemberTxCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberTxCaseOut -import com.few.api.exception.common.InsertException -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.InsertMemberCommand -import com.few.api.repo.dao.member.command.UpdateDeletedMemberTypeCommand -import com.few.api.repo.dao.member.record.MemberIdAndIsDeletedRecord -import com.few.data.common.code.MemberType +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.command.InsertMemberCommand +import com.few.api.domain.member.repo.command.UpdateDeletedMemberTypeCommand +import com.few.api.domain.member.repo.record.MemberIdAndIsDeletedRecord import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional -import java.util.* @Component class SaveMemberTxCase( diff --git a/api/src/main/kotlin/com/few/api/web/controller/problem/ProblemController.kt b/api/src/main/kotlin/com/few/api/domain/problem/controller/ProblemController.kt similarity index 86% rename from api/src/main/kotlin/com/few/api/web/controller/problem/ProblemController.kt rename to api/src/main/kotlin/com/few/api/domain/problem/controller/ProblemController.kt index 1d9a5a72e..327e27091 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/problem/ProblemController.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/controller/ProblemController.kt @@ -1,22 +1,22 @@ -package com.few.api.web.controller.problem +package com.few.api.domain.problem.controller import com.few.api.domain.problem.usecase.BrowseProblemsUseCase import com.few.api.domain.problem.usecase.BrowseUndoneProblemsUseCase -import com.few.api.web.controller.problem.request.CheckProblemRequest -import com.few.api.web.controller.problem.response.CheckProblemResponse -import com.few.api.web.controller.problem.response.ProblemContents -import com.few.api.web.controller.problem.response.ReadProblemResponse -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator +import com.few.api.domain.problem.controller.request.CheckProblemRequest +import com.few.api.domain.problem.controller.response.CheckProblemResponse +import com.few.api.domain.problem.controller.response.ProblemContents +import com.few.api.domain.problem.controller.response.ReadProblemResponse +import web.ApiResponse +import web.ApiResponseGenerator import com.few.api.domain.problem.usecase.CheckProblemUseCase import com.few.api.domain.problem.usecase.ReadProblemUseCase import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseIn import com.few.api.domain.problem.usecase.dto.BrowseUndoneProblemsUseCaseIn import com.few.api.domain.problem.usecase.dto.CheckProblemUseCaseIn import com.few.api.domain.problem.usecase.dto.ReadProblemUseCaseIn -import com.few.api.web.controller.problem.response.BrowseProblemsResponse -import com.few.api.web.support.method.UserArgument -import com.few.api.web.support.method.UserArgumentDetails +import com.few.api.domain.problem.controller.response.BrowseProblemsResponse +import web.UserArgument +import web.UserArgumentDetails import jakarta.validation.Valid import jakarta.validation.constraints.Min import org.springframework.http.HttpStatus diff --git a/api/src/main/kotlin/com/few/api/web/controller/problem/request/CheckProblemRequest.kt b/api/src/main/kotlin/com/few/api/domain/problem/controller/request/CheckProblemRequest.kt similarity index 73% rename from api/src/main/kotlin/com/few/api/web/controller/problem/request/CheckProblemRequest.kt rename to api/src/main/kotlin/com/few/api/domain/problem/controller/request/CheckProblemRequest.kt index 65f55d38b..c70b32980 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/problem/request/CheckProblemRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/controller/request/CheckProblemRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.problem.request +package com.few.api.domain.problem.controller.request import jakarta.validation.constraints.NotBlank diff --git a/api/src/main/kotlin/com/few/api/web/controller/problem/response/BrowseProblemsResponse.kt b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/BrowseProblemsResponse.kt similarity index 63% rename from api/src/main/kotlin/com/few/api/web/controller/problem/response/BrowseProblemsResponse.kt rename to api/src/main/kotlin/com/few/api/domain/problem/controller/response/BrowseProblemsResponse.kt index b76a8cb04..ceb1c7945 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/problem/response/BrowseProblemsResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/BrowseProblemsResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.problem.response +package com.few.api.domain.problem.controller.response data class BrowseProblemsResponse( val problemIds: List, diff --git a/api/src/main/kotlin/com/few/api/web/controller/problem/response/CheckProblemResponse.kt b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/CheckProblemResponse.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/web/controller/problem/response/CheckProblemResponse.kt rename to api/src/main/kotlin/com/few/api/domain/problem/controller/response/CheckProblemResponse.kt index 4c5577448..ff120ac3b 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/problem/response/CheckProblemResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/CheckProblemResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.problem.response +package com.few.api.domain.problem.controller.response data class CheckProblemResponse( val explanation: String, diff --git a/api/src/main/kotlin/com/few/api/web/controller/problem/response/ReadProblemResponse.kt b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/ReadProblemResponse.kt similarity index 79% rename from api/src/main/kotlin/com/few/api/web/controller/problem/response/ReadProblemResponse.kt rename to api/src/main/kotlin/com/few/api/domain/problem/controller/response/ReadProblemResponse.kt index 9c8e3e953..1d66484cb 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/problem/response/ReadProblemResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/controller/response/ReadProblemResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.problem.response +package com.few.api.domain.problem.controller.response data class ReadProblemResponse( val id: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/ProblemDao.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/ProblemDao.kt similarity index 83% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/ProblemDao.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/ProblemDao.kt index 844f6ce6a..8f00b767f 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/ProblemDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/ProblemDao.kt @@ -1,15 +1,15 @@ -package com.few.api.repo.dao.problem +package com.few.api.domain.problem.repo -import com.few.api.repo.dao.problem.command.InsertProblemsCommand -import com.few.api.repo.dao.problem.query.SelectProblemAnswerQuery -import com.few.api.repo.dao.problem.query.SelectProblemIdByArticleIdsQuery -import com.few.api.repo.dao.problem.query.SelectProblemQuery -import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery -import com.few.api.repo.dao.problem.record.ProblemIdAndArticleIdRecord -import com.few.api.repo.dao.problem.record.ProblemIdsRecord -import com.few.api.repo.dao.problem.record.SelectProblemAnswerRecord -import com.few.api.repo.dao.problem.record.SelectProblemRecord -import com.few.api.repo.dao.problem.support.ContentsJsonMapper +import com.few.api.domain.problem.repo.command.InsertProblemsCommand +import com.few.api.domain.problem.repo.query.SelectProblemAnswerQuery +import com.few.api.domain.problem.repo.query.SelectProblemIdByArticleIdsQuery +import com.few.api.domain.problem.repo.query.SelectProblemQuery +import com.few.api.domain.problem.repo.query.SelectProblemsByArticleIdQuery +import com.few.api.domain.problem.repo.record.ProblemIdAndArticleIdRecord +import com.few.api.domain.problem.repo.record.ProblemIdsRecord +import com.few.api.domain.problem.repo.record.SelectProblemAnswerRecord +import com.few.api.domain.problem.repo.record.SelectProblemRecord +import com.few.api.domain.problem.repo.support.ContentsJsonMapper import jooq.jooq_dsl.tables.Problem import org.jooq.DSLContext import org.jooq.JSON diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/SubmitHistoryDao.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/SubmitHistoryDao.kt similarity index 84% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/SubmitHistoryDao.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/SubmitHistoryDao.kt index 7eab14aba..c1e0e3887 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/SubmitHistoryDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/SubmitHistoryDao.kt @@ -1,8 +1,8 @@ -package com.few.api.repo.dao.problem +package com.few.api.domain.problem.repo -import com.few.api.repo.dao.problem.command.InsertSubmitHistoryCommand -import com.few.api.repo.dao.problem.query.SelectSubmittedProblemIdsQuery -import com.few.api.repo.dao.problem.record.SubmittedProblemIdsRecord +import com.few.api.domain.problem.repo.command.InsertSubmitHistoryCommand +import com.few.api.domain.problem.repo.query.SelectSubmittedProblemIdsQuery +import com.few.api.domain.problem.repo.record.SubmittedProblemIdsRecord import jooq.jooq_dsl.Tables.SUBMIT_HISTORY import org.jooq.DSLContext import org.springframework.stereotype.Repository diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertProblemsCommand.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertProblemsCommand.kt similarity index 64% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertProblemsCommand.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertProblemsCommand.kt index e0b7e884f..8037ff492 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertProblemsCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertProblemsCommand.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.problem.command +package com.few.api.domain.problem.repo.command -import com.few.api.repo.dao.problem.support.Contents +import com.few.api.domain.problem.repo.support.Contents data class InsertProblemsCommand( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertSubmitHistoryCommand.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertSubmitHistoryCommand.kt similarity index 75% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertSubmitHistoryCommand.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertSubmitHistoryCommand.kt index 737cacc8c..60fdc1d94 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/command/InsertSubmitHistoryCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/command/InsertSubmitHistoryCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.command +package com.few.api.domain.problem.repo.command data class InsertSubmitHistoryCommand( val problemId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemAnswerQuery.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemAnswerQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemAnswerQuery.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemAnswerQuery.kt index fa15ec70c..11a95e602 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemAnswerQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemAnswerQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.query +package com.few.api.domain.problem.repo.query data class SelectProblemAnswerQuery( val problemId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemIdByArticleIdsQuery.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemIdByArticleIdsQuery.kt similarity index 62% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemIdByArticleIdsQuery.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemIdByArticleIdsQuery.kt index 2511f6f21..3ddac7fc4 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemIdByArticleIdsQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemIdByArticleIdsQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.query +package com.few.api.domain.problem.repo.query data class SelectProblemIdByArticleIdsQuery( val articleIds: Set, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemQuery.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemQuery.kt similarity index 55% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemQuery.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemQuery.kt index 7d62121c3..2512da397 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.query +package com.few.api.domain.problem.repo.query data class SelectProblemQuery( val problemId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemsByArticleIdQuery.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemsByArticleIdQuery.kt similarity index 60% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemsByArticleIdQuery.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemsByArticleIdQuery.kt index c66ceab83..4e8efb017 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectProblemsByArticleIdQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectProblemsByArticleIdQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.query +package com.few.api.domain.problem.repo.query data class SelectProblemsByArticleIdQuery( val articleId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectSubmittedProblemIdsQuery.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectSubmittedProblemIdsQuery.kt similarity index 68% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectSubmittedProblemIdsQuery.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectSubmittedProblemIdsQuery.kt index 902993fd5..3a9fc1558 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/query/SelectSubmittedProblemIdsQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/query/SelectSubmittedProblemIdsQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.query +package com.few.api.domain.problem.repo.query data class SelectSubmittedProblemIdsQuery( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdAndArticleIdRecord.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdAndArticleIdRecord.kt similarity index 66% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdAndArticleIdRecord.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdAndArticleIdRecord.kt index bf4b0d535..e44d56f9d 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdAndArticleIdRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdAndArticleIdRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.record +package com.few.api.domain.problem.repo.record data class ProblemIdAndArticleIdRecord( val problemId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdsRecord.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdsRecord.kt similarity index 57% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdsRecord.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdsRecord.kt index c030de7f2..0a8d9f281 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/ProblemIdsRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/ProblemIdsRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.record +package com.few.api.domain.problem.repo.record data class ProblemIdsRecord( val problemIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemAnswerRecord.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemAnswerRecord.kt similarity index 70% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemAnswerRecord.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemAnswerRecord.kt index 5155ce435..65ceac52c 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemAnswerRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemAnswerRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.record +package com.few.api.domain.problem.repo.record data class SelectProblemAnswerRecord( val id: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemRecord.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemRecord.kt similarity index 72% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemRecord.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemRecord.kt index 2066cbf25..b56d36c89 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SelectProblemRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SelectProblemRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.record +package com.few.api.domain.problem.repo.record data class SelectProblemRecord( val id: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SubmittedProblemIdsRecord.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SubmittedProblemIdsRecord.kt similarity index 60% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SubmittedProblemIdsRecord.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/record/SubmittedProblemIdsRecord.kt index f70ca92cc..51060f93f 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/record/SubmittedProblemIdsRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/record/SubmittedProblemIdsRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.record +package com.few.api.domain.problem.repo.record data class SubmittedProblemIdsRecord( val problemIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/Contents.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/support/Contents.kt similarity index 72% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/Contents.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/support/Contents.kt index 28e07c66a..ae12d72b3 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/Contents.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/support/Contents.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.support +package com.few.api.domain.problem.repo.support data class Contents( val contents: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapper.kt b/api/src/main/kotlin/com/few/api/domain/problem/repo/support/ContentsJsonMapper.kt similarity index 92% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapper.kt rename to api/src/main/kotlin/com/few/api/domain/problem/repo/support/ContentsJsonMapper.kt index 76d4ec01d..b8e7cb948 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/problem/support/ContentsJsonMapper.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/repo/support/ContentsJsonMapper.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.problem.support +package com.few.api.domain.problem.repo.support import com.fasterxml.jackson.databind.ObjectMapper import org.springframework.stereotype.Component diff --git a/api/src/main/kotlin/com/few/api/domain/problem/service/ArticleService.kt b/api/src/main/kotlin/com/few/api/domain/problem/service/ProblemArticleService.kt similarity index 76% rename from api/src/main/kotlin/com/few/api/domain/problem/service/ArticleService.kt rename to api/src/main/kotlin/com/few/api/domain/problem/service/ProblemArticleService.kt index 966ffc46b..ca03fddc9 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/service/ArticleService.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/service/ProblemArticleService.kt @@ -1,12 +1,12 @@ package com.few.api.domain.problem.service import com.few.api.domain.problem.service.dto.BrowseArticleIdInDto -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.query.SelectAritlceIdByWorkbookIdAndDayQuery +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.query.SelectAritlceIdByWorkbookIdAndDayQuery import org.springframework.stereotype.Service @Service -class ArticleService( +class ProblemArticleService( private val articleDao: ArticleDao, ) { diff --git a/api/src/main/kotlin/com/few/api/domain/problem/service/SubscriptionService.kt b/api/src/main/kotlin/com/few/api/domain/problem/service/ProblemSubscriptionService.kt similarity index 79% rename from api/src/main/kotlin/com/few/api/domain/problem/service/SubscriptionService.kt rename to api/src/main/kotlin/com/few/api/domain/problem/service/ProblemSubscriptionService.kt index 8a18f9a2c..3dbec5a0b 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/service/SubscriptionService.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/service/ProblemSubscriptionService.kt @@ -2,12 +2,12 @@ package com.few.api.domain.problem.service import com.few.api.domain.problem.service.dto.BrowseWorkbookIdAndProgressInDto import com.few.api.domain.problem.service.dto.SubscriptionProgressOutDto -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.query.SelectSubscriptionSendStatusQuery +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.query.SelectSubscriptionSendStatusQuery import org.springframework.stereotype.Component @Component -class SubscriptionService( +class ProblemSubscriptionService( private val subscriptionDao: SubscriptionDao, ) { diff --git a/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCase.kt b/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCase.kt index 5888bb864..f22d6a2a3 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCase.kt @@ -2,9 +2,9 @@ package com.few.api.domain.problem.usecase import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseIn import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseOut -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.query.SelectProblemsByArticleIdQuery import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCase.kt b/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCase.kt index d9f96e92b..ab7eda110 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCase.kt @@ -1,24 +1,24 @@ package com.few.api.domain.problem.usecase -import com.few.api.domain.problem.service.ArticleService -import com.few.api.domain.problem.service.SubscriptionService +import com.few.api.domain.problem.service.ProblemArticleService +import com.few.api.domain.problem.service.ProblemSubscriptionService import com.few.api.domain.problem.service.dto.BrowseArticleIdInDto import com.few.api.domain.problem.service.dto.BrowseWorkbookIdAndProgressInDto import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseOut import com.few.api.domain.problem.usecase.dto.BrowseUndoneProblemsUseCaseIn -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.SubmitHistoryDao -import com.few.api.repo.dao.problem.query.SelectProblemIdByArticleIdsQuery -import com.few.api.repo.dao.problem.query.SelectSubmittedProblemIdsQuery +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.SubmitHistoryDao +import com.few.api.domain.problem.repo.query.SelectProblemIdByArticleIdsQuery +import com.few.api.domain.problem.repo.query.SelectSubmittedProblemIdsQuery import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional @Component class BrowseUndoneProblemsUseCase( private val problemDao: ProblemDao, - private val subscriptionService: SubscriptionService, - private val articleService: ArticleService, + private val problemSubscriptionService: ProblemSubscriptionService, + private val problemArticleService: ProblemArticleService, private val submitHistoryDao: SubmitHistoryDao, ) { @@ -28,7 +28,7 @@ class BrowseUndoneProblemsUseCase( * 유저가 구독한 워크북들에 속한 아티클 개수를 조회함 * 이때 아티클 개수는 현 시점 기준으로 이메일이 전송된 아티클 개수까지만 조회함 */ - val subscriptionProgresses = subscriptionService.browseWorkbookIdAndProgress( + val subscriptionProgresses = problemSubscriptionService.browseWorkbookIdAndProgress( BrowseWorkbookIdAndProgressInDto(useCaseIn.memberId) ).takeIf { it.isNotEmpty() } ?: throw NotFoundException("subscribe.workbook.notexist") @@ -36,7 +36,7 @@ class BrowseUndoneProblemsUseCase( * 위에서 조회한 워크부에 속한 아티클 개수에 대해 article_id 들을 조회함 */ val sentArticleIds = subscriptionProgresses.flatMap { subscriptionProgress -> - articleService.browseArticleIdByWorkbookIdLimitDay( + problemArticleService.browseArticleIdByWorkbookIdLimitDay( BrowseArticleIdInDto( subscriptionProgress.workbookId, subscriptionProgress.day diff --git a/api/src/main/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCase.kt b/api/src/main/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCase.kt index c3f555837..a49d81ed6 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCase.kt @@ -1,13 +1,13 @@ package com.few.api.domain.problem.usecase -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.SubmitHistoryDao -import com.few.api.repo.dao.problem.command.InsertSubmitHistoryCommand -import com.few.api.repo.dao.problem.query.SelectProblemAnswerQuery +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.SubmitHistoryDao +import com.few.api.domain.problem.repo.command.InsertSubmitHistoryCommand +import com.few.api.domain.problem.repo.query.SelectProblemAnswerQuery import com.few.api.domain.problem.usecase.dto.CheckProblemUseCaseIn import com.few.api.domain.problem.usecase.dto.CheckProblemUseCaseOut -import com.few.api.exception.common.InsertException -import com.few.api.exception.common.NotFoundException +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.common.exception.NotFoundException import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCase.kt b/api/src/main/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCase.kt index 7b750b14e..38a73515b 100644 --- a/api/src/main/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCase.kt @@ -1,12 +1,12 @@ package com.few.api.domain.problem.usecase -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.query.SelectProblemQuery +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.query.SelectProblemQuery import com.few.api.domain.problem.usecase.dto.ReadProblemUseCaseIn import com.few.api.domain.problem.usecase.dto.ReadProblemContentsUseCaseOutDetail import com.few.api.domain.problem.usecase.dto.ReadProblemUseCaseOut -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.problem.support.ContentsJsonMapper +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.problem.repo.support.ContentsJsonMapper import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/client/subscription/SubscriptionClient.kt b/api/src/main/kotlin/com/few/api/domain/subscription/client/ApiSubscriptionClient.kt similarity index 85% rename from api/src/main/kotlin/com/few/api/client/subscription/SubscriptionClient.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/client/ApiSubscriptionClient.kt index cf08ab5d0..04594d61f 100644 --- a/api/src/main/kotlin/com/few/api/client/subscription/SubscriptionClient.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/client/ApiSubscriptionClient.kt @@ -1,8 +1,8 @@ -package com.few.api.client.subscription +package com.few.api.domain.subscription.client -import com.few.api.client.config.properties.DiscordBodyProperty -import com.few.api.client.config.properties.Embed -import com.few.api.client.subscription.dto.WorkbookSubscriptionArgs +import web.client.DiscordBodyProperty +import web.client.Embed +import com.few.api.domain.subscription.client.dto.WorkbookSubscriptionArgs import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpEntity @@ -11,7 +11,7 @@ import org.springframework.stereotype.Service import org.springframework.web.client.RestTemplate @Service -class SubscriptionClient( +class ApiSubscriptionClient( private val restTemplate: RestTemplate, @Value("\${webhook.discord}") private val discordWebhook: String, ) { diff --git a/api/src/main/kotlin/com/few/api/client/subscription/dto/WorkbookSubscriptionArgs.kt b/api/src/main/kotlin/com/few/api/domain/subscription/client/dto/WorkbookSubscriptionArgs.kt similarity index 73% rename from api/src/main/kotlin/com/few/api/client/subscription/dto/WorkbookSubscriptionArgs.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/client/dto/WorkbookSubscriptionArgs.kt index f4cb1febd..87c3d8221 100644 --- a/api/src/main/kotlin/com/few/api/client/subscription/dto/WorkbookSubscriptionArgs.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/client/dto/WorkbookSubscriptionArgs.kt @@ -1,4 +1,4 @@ -package com.few.api.client.subscription.dto +package com.few.api.domain.subscription.client.dto data class WorkbookSubscriptionArgs( val totalSubscriptions: Long, diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/SubscriptionController.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/SubscriptionController.kt similarity index 88% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/SubscriptionController.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/SubscriptionController.kt index f7408e8bd..c9e257563 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/SubscriptionController.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/SubscriptionController.kt @@ -1,17 +1,18 @@ -package com.few.api.web.controller.subscription +package com.few.api.domain.subscription.controller import com.few.api.domain.subscription.usecase.* -import com.few.api.web.controller.subscription.request.UnsubscribeWorkbookRequest -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator +import com.few.api.domain.subscription.controller.request.UnsubscribeWorkbookRequest +import web.ApiResponse +import web.ApiResponseGenerator import com.few.api.domain.subscription.usecase.dto.* -import com.few.api.security.authentication.token.TokenUserDetails -import com.few.api.web.controller.subscription.request.UnsubscribeAllRequest -import com.few.api.web.controller.subscription.request.UpdateSubscriptionDayRequest -import com.few.api.web.controller.subscription.request.UpdateSubscriptionTimeRequest -import com.few.api.web.controller.subscription.response.* -import com.few.api.web.support.DayCode -import com.few.api.web.support.ViewCategory +import com.few.api.domain.subscription.controller.request.UnsubscribeAllRequest +import com.few.api.domain.subscription.controller.request.UpdateSubscriptionDayRequest +import com.few.api.domain.subscription.controller.request.UpdateSubscriptionTimeRequest +import com.few.api.domain.common.vo.DayCode +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.subscription.controller.response.MainCardSubscribeWorkbookInfo +import com.few.api.domain.subscription.controller.response.MyPageSubscribeWorkbookInfo +import com.few.api.domain.subscription.controller.response.SubscribeWorkbooksResponse import jakarta.validation.Valid import jakarta.validation.constraints.Min import org.springframework.http.HttpStatus @@ -19,6 +20,7 @@ import org.springframework.http.MediaType import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.validation.annotation.Validated import org.springframework.web.bind.annotation.* +import security.TokenUserDetails import java.lang.IllegalStateException @Validated diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeAllRequest.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeAllRequest.kt similarity index 50% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeAllRequest.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeAllRequest.kt index 52716ef45..4f24bd806 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeAllRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeAllRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.subscription.request +package com.few.api.domain.subscription.controller.request data class UnsubscribeAllRequest( val opinion: String, diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeWorkbookRequest.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeWorkbookRequest.kt similarity index 52% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeWorkbookRequest.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeWorkbookRequest.kt index 9f6bb6462..dc28daec0 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UnsubscribeWorkbookRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UnsubscribeWorkbookRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.subscription.request +package com.few.api.domain.subscription.controller.request data class UnsubscribeWorkbookRequest( val opinion: String, diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionDayRequest.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionDayRequest.kt similarity index 74% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionDayRequest.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionDayRequest.kt index e07ba1930..17415094f 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionDayRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionDayRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.subscription.request +package com.few.api.domain.subscription.controller.request import com.fasterxml.jackson.annotation.JsonProperty diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionTimeRequest.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionTimeRequest.kt similarity index 67% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionTimeRequest.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionTimeRequest.kt index eb73d89f2..ff4ac6415 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/request/UpdateSubscriptionTimeRequest.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/request/UpdateSubscriptionTimeRequest.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.subscription.request +package com.few.api.domain.subscription.controller.request import java.time.LocalTime diff --git a/api/src/main/kotlin/com/few/api/web/controller/subscription/response/SubscribeWorkbooksResponse.kt b/api/src/main/kotlin/com/few/api/domain/subscription/controller/response/SubscribeWorkbooksResponse.kt similarity index 95% rename from api/src/main/kotlin/com/few/api/web/controller/subscription/response/SubscribeWorkbooksResponse.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/controller/response/SubscribeWorkbooksResponse.kt index e8c51f615..ea12f1881 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/subscription/response/SubscribeWorkbooksResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/controller/response/SubscribeWorkbooksResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.subscription.response +package com.few.api.domain.subscription.controller.response import com.few.api.domain.subscription.usecase.dto.Subscription diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionAfterCompletionEventListener.kt b/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionAfterCompletionEventListener.kt index befafe8bc..db4596037 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionAfterCompletionEventListener.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionAfterCompletionEventListener.kt @@ -1,7 +1,7 @@ package com.few.api.domain.subscription.event import com.few.api.domain.subscription.event.dto.WorkbookSubscriptionEvent -import com.few.api.domain.subscription.handler.SendWorkbookArticleAsyncHandler +import com.few.api.domain.subscription.event.handler.SendWorkbookArticleAsyncHandler import org.springframework.stereotype.Component import org.springframework.transaction.event.TransactionPhase import org.springframework.transaction.event.TransactionalEventListener diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionEventListener.kt b/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionEventListener.kt index ec4c8a15c..c1ab57d57 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionEventListener.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/event/WorkbookSubscriptionEventListener.kt @@ -1,7 +1,7 @@ package com.few.api.domain.subscription.event import com.few.api.domain.subscription.event.dto.WorkbookSubscriptionEvent -import com.few.api.domain.subscription.handler.WorkbookSubscriptionClientAsyncHandler +import com.few.api.domain.subscription.event.handler.WorkbookSubscriptionClientAsyncHandler import org.springframework.context.event.EventListener import org.springframework.stereotype.Component diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/handler/SendWorkbookArticleAsyncHandler.kt b/api/src/main/kotlin/com/few/api/domain/subscription/event/handler/SendWorkbookArticleAsyncHandler.kt similarity index 83% rename from api/src/main/kotlin/com/few/api/domain/subscription/handler/SendWorkbookArticleAsyncHandler.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/event/handler/SendWorkbookArticleAsyncHandler.kt index 99bf96e18..82d33d4b7 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/handler/SendWorkbookArticleAsyncHandler.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/event/handler/SendWorkbookArticleAsyncHandler.kt @@ -1,18 +1,18 @@ -package com.few.api.domain.subscription.handler +package com.few.api.domain.subscription.event.handler -import com.few.api.config.DatabaseAccessThreadPoolConfig.Companion.DATABASE_ACCESS_POOL -import com.few.api.domain.common.lock.LockFor -import com.few.api.domain.common.lock.LockIdentifier +import com.few.api.config.ApiDatabaseAccessThreadPoolConfig.Companion.DATABASE_ACCESS_POOL +import com.few.api.domain.common.lock.ApiLockFor +import com.few.api.domain.common.lock.ApiLockIdentifier +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.subscription.service.* import com.few.api.domain.subscription.service.dto.* -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.UpdateArticleProgressCommand -import com.few.api.repo.dao.subscription.command.UpdateLastArticleProgressCommand -import com.few.api.repo.dao.subscription.query.SelectSubscriptionQuery -import com.few.api.web.support.SendType -import com.few.data.common.code.CategoryType -import com.few.email.service.article.dto.Content +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.UpdateArticleProgressCommand +import com.few.api.domain.subscription.repo.command.UpdateLastArticleProgressCommand +import com.few.api.domain.subscription.repo.query.SelectSubscriptionQuery +import com.few.api.domain.common.vo.SendType +import com.few.api.domain.article.email.dto.Content import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component @@ -32,7 +32,7 @@ class SendWorkbookArticleAsyncHandler( private val log = KotlinLogging.logger {} @Async(value = DATABASE_ACCESS_POOL) - @LockFor(identifier = LockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID) + @ApiLockFor(identifier = ApiLockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID) @Transactional(propagation = Propagation.REQUIRES_NEW) fun sendWorkbookArticle(memberId: Long, workbookId: Long, articleDayCol: Byte) { val date = LocalDate.now() diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/handler/WorkbookSubscriptionClientAsyncHandler.kt b/api/src/main/kotlin/com/few/api/domain/subscription/event/handler/WorkbookSubscriptionClientAsyncHandler.kt similarity index 71% rename from api/src/main/kotlin/com/few/api/domain/subscription/handler/WorkbookSubscriptionClientAsyncHandler.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/event/handler/WorkbookSubscriptionClientAsyncHandler.kt index 0019467c3..93a80673b 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/handler/WorkbookSubscriptionClientAsyncHandler.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/event/handler/WorkbookSubscriptionClientAsyncHandler.kt @@ -1,19 +1,19 @@ -package com.few.api.domain.subscription.handler +package com.few.api.domain.subscription.event.handler -import com.few.api.client.subscription.SubscriptionClient -import com.few.api.client.subscription.dto.WorkbookSubscriptionArgs +import com.few.api.domain.subscription.client.ApiSubscriptionClient +import com.few.api.domain.subscription.client.dto.WorkbookSubscriptionArgs import com.few.api.config.ApiThreadPoolConfig.Companion.DISCORD_HOOK_EVENT_POOL import com.few.api.domain.subscription.service.SubscriptionWorkbookService import com.few.api.domain.subscription.service.dto.ReadWorkbookTitleInDto -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.subscription.SubscriptionDao +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.subscription.repo.SubscriptionDao import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component @Component class WorkbookSubscriptionClientAsyncHandler( private val subscriptionDao: SubscriptionDao, - private val subscriptionClient: SubscriptionClient, + private val apiSubscriptionClient: ApiSubscriptionClient, private val workbookService: SubscriptionWorkbookService, ) { @@ -24,7 +24,7 @@ class WorkbookSubscriptionClientAsyncHandler( ?: throw NotFoundException("workbook.notfound.id") subscriptionDao.countAllSubscriptionStatus().also { record -> - subscriptionClient.announceWorkbookSubscription( + apiSubscriptionClient.announceWorkbookSubscription( WorkbookSubscriptionArgs( totalSubscriptions = record.totalSubscriptions, activeSubscriptions = record.activeSubscriptions, diff --git a/api/src/main/kotlin/com/few/api/exception/subscribe/SubscribeIllegalArgumentException.kt b/api/src/main/kotlin/com/few/api/domain/subscription/exception/SubscribeIllegalArgumentException.kt similarity index 57% rename from api/src/main/kotlin/com/few/api/exception/subscribe/SubscribeIllegalArgumentException.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/exception/SubscribeIllegalArgumentException.kt index 188b31e32..14a893839 100644 --- a/api/src/main/kotlin/com/few/api/exception/subscribe/SubscribeIllegalArgumentException.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/exception/SubscribeIllegalArgumentException.kt @@ -1,23 +1,23 @@ -package com.few.api.exception.subscribe +package com.few.api.domain.subscription.exception -import com.few.api.exception.support.MessageSourceAccessor +import com.few.api.config.ApiMessageSourceAccessor class SubscribeIllegalArgumentException : IllegalStateException { private val code: String - constructor(errorCode: String) : super(MessageSourceAccessor.getMessage(errorCode)) { + constructor(errorCode: String) : super(ApiMessageSourceAccessor.getMessage(errorCode)) { this.code = errorCode } constructor( errorCode: String, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(errorCode, args)) { + ) : super(ApiMessageSourceAccessor.getMessage(errorCode, args)) { this.code = errorCode } constructor(code: String, cause: Throwable?) : super( - MessageSourceAccessor.getMessage( + ApiMessageSourceAccessor.getMessage( code ), cause @@ -29,7 +29,7 @@ class SubscribeIllegalArgumentException : IllegalStateException { code: String, cause: Throwable?, vararg args: Any?, - ) : super(MessageSourceAccessor.getMessage(code, args), cause) { + ) : super(ApiMessageSourceAccessor.getMessage(code, args), cause) { this.code = code } } \ No newline at end of file diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/SubscriptionDao.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/SubscriptionDao.kt similarity index 98% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/SubscriptionDao.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/SubscriptionDao.kt index 5316134c3..85eab4eef 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/SubscriptionDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/SubscriptionDao.kt @@ -1,8 +1,8 @@ -package com.few.api.repo.dao.subscription +package com.few.api.domain.subscription.repo -import com.few.api.repo.dao.subscription.command.* -import com.few.api.repo.dao.subscription.query.* -import com.few.api.repo.dao.subscription.record.* +import com.few.api.domain.subscription.repo.command.* +import com.few.api.domain.subscription.repo.query.* +import com.few.api.domain.subscription.repo.record.* import jooq.jooq_dsl.Tables.MAPPING_WORKBOOK_ARTICLE import jooq.jooq_dsl.Tables.SUBSCRIPTION import jooq.jooq_dsl.tables.MappingWorkbookArticle diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendDayCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendDayCommand.kt similarity index 70% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendDayCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendDayCommand.kt index 2b0ed2adc..d02ad58ea 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendDayCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendDayCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command data class BulkUpdateSubscriptionSendDayCommand( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendTimeCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendTimeCommand.kt similarity index 75% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendTimeCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendTimeCommand.kt index 5e13d9727..86c099a5e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/BulkUpdateSubscriptionSendTimeCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/BulkUpdateSubscriptionSendTimeCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command import java.time.LocalTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/InsertWorkbookSubscriptionCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/InsertWorkbookSubscriptionCommand.kt similarity index 71% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/InsertWorkbookSubscriptionCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/InsertWorkbookSubscriptionCommand.kt index b36985930..cda79062c 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/InsertWorkbookSubscriptionCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/InsertWorkbookSubscriptionCommand.kt @@ -1,6 +1,6 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command -import com.few.data.common.code.DayCode +import com.few.api.domain.common.vo.DayCode import java.time.LocalTime data class InsertWorkbookSubscriptionCommand( diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateArticleProgressCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateArticleProgressCommand.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateArticleProgressCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateArticleProgressCommand.kt index 9d08c36be..b109cd0c6 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateArticleProgressCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateArticleProgressCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command data class UpdateArticleProgressCommand( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInAllSubscriptionCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInAllSubscriptionCommand.kt similarity index 66% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInAllSubscriptionCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInAllSubscriptionCommand.kt index 07768f1bd..6f337741e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInAllSubscriptionCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInAllSubscriptionCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command data class UpdateDeletedAtInAllSubscriptionCommand( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt similarity index 71% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt index 45152ca51..15d28bebc 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateDeletedAtInWorkbookSubscriptionCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command data class UpdateDeletedAtInWorkbookSubscriptionCommand( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateLastArticleProgressCommand.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateLastArticleProgressCommand.kt similarity index 72% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateLastArticleProgressCommand.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateLastArticleProgressCommand.kt index 389d7e159..a9e83da9b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/command/UpdateLastArticleProgressCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/command/UpdateLastArticleProgressCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.command +package com.few.api.domain.subscription.repo.command data class UpdateLastArticleProgressCommand( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountAllWorkbooksSubscriptionQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountAllWorkbooksSubscriptionQuery.kt similarity index 61% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountAllWorkbooksSubscriptionQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountAllWorkbooksSubscriptionQuery.kt index d87d6f920..eeb71c51a 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountAllWorkbooksSubscriptionQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountAllWorkbooksSubscriptionQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query data class CountAllWorkbooksSubscriptionQuery( val workbookIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountWorkbookMappedArticlesQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountWorkbookMappedArticlesQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountWorkbookMappedArticlesQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountWorkbookMappedArticlesQuery.kt index 6d9b8a08b..73dd67941 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/CountWorkbookMappedArticlesQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/CountWorkbookMappedArticlesQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query data class CountWorkbookMappedArticlesQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt similarity index 75% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt index f0d8eba9f..08241c516 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookActiveSubscriptionQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query /** * 멤버의 구독 중인 워크북 목록을 조회합니다. diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt similarity index 80% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt index d09bed59a..ed3e73ad7 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookInActiveSubscriptionQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query /** * 멤버의 구독 완료 워크북 목록을 조회합니다. diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt similarity index 87% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt index eee092aca..9f7ac1c50 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query /** * UnsubOpinion 조건을 만족하고 diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllSubscriptionSendStatusQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllSubscriptionSendStatusQuery.kt similarity index 67% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllSubscriptionSendStatusQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllSubscriptionSendStatusQuery.kt index 811924ec2..b3feb5ec0 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllSubscriptionSendStatusQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllSubscriptionSendStatusQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query data class SelectAllSubscriptionSendStatusQuery( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt similarity index 81% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt index 0780d4d8f..abb933722 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query /** * DeleteAt을 고려하지 않고 모든 워크북 구독 상태를 조회하는 쿼리 diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionQuery.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionQuery.kt index 69179ceba..f2564a7f2 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query data class SelectSubscriptionQuery( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionSendStatusQuery.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionSendStatusQuery.kt similarity index 58% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionSendStatusQuery.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionSendStatusQuery.kt index 3f07c581d..b1f3b0675 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/query/SelectSubscriptionSendStatusQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/query/SelectSubscriptionSendStatusQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.query +package com.few.api.domain.subscription.repo.query data class SelectSubscriptionSendStatusQuery( val memberId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/CountAllSubscriptionStatusRecord.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/CountAllSubscriptionStatusRecord.kt similarity index 69% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/CountAllSubscriptionStatusRecord.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/CountAllSubscriptionStatusRecord.kt index 139ad6285..e6617ff41 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/CountAllSubscriptionStatusRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/CountAllSubscriptionStatusRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record data class CountAllSubscriptionStatusRecord( val totalSubscriptions: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/MemberWorkbookSubscriptionStatusRecord.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/MemberWorkbookSubscriptionStatusRecord.kt similarity index 75% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/MemberWorkbookSubscriptionStatusRecord.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/MemberWorkbookSubscriptionStatusRecord.kt index 0bddbd397..e5dd4da12 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/MemberWorkbookSubscriptionStatusRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/MemberWorkbookSubscriptionStatusRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record data class MemberWorkbookSubscriptionStatusRecord( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionProgressRecord.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionProgressRecord.kt similarity index 62% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionProgressRecord.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionProgressRecord.kt index 1fbf4acf4..fce44d59b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionProgressRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionProgressRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record data class SubscriptionProgressRecord( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatus.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatus.kt similarity index 76% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatus.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatus.kt index 616c5f817..fa8b442cc 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatus.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatus.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record import java.time.LocalTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatusRecord.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatusRecord.kt similarity index 74% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatusRecord.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatusRecord.kt index 048fa2a9b..7c6e63f60 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionSendStatusRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionSendStatusRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record import java.time.LocalTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionTimeRecord.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionTimeRecord.kt similarity index 80% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionTimeRecord.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionTimeRecord.kt index ba705342a..b93d5b61e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/SubscriptionTimeRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/SubscriptionTimeRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/WorkbookSubscriptionStatus.kt b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/WorkbookSubscriptionStatus.kt similarity index 68% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/WorkbookSubscriptionStatus.kt rename to api/src/main/kotlin/com/few/api/domain/subscription/repo/record/WorkbookSubscriptionStatus.kt index 010db51e2..0d45352c8 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/subscription/record/WorkbookSubscriptionStatus.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/repo/record/WorkbookSubscriptionStatus.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.subscription.record +package com.few.api.domain.subscription.repo.record data class WorkbookSubscriptionStatus( val workbookId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionArticleService.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionArticleService.kt index 21b70f97e..7bbb86547 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionArticleService.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionArticleService.kt @@ -3,9 +3,9 @@ package com.few.api.domain.subscription.service import com.few.api.domain.subscription.service.dto.ReadArticleContentInDto import com.few.api.domain.subscription.service.dto.ReadArticleContentOutDto import com.few.api.domain.subscription.service.dto.ReadArticleIdByWorkbookIdAndDayDto -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.query.SelectArticleContentQuery -import com.few.api.repo.dao.article.query.SelectArticleIdByWorkbookIdAndDayQuery +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.query.SelectArticleContentQuery +import com.few.api.domain.article.repo.query.SelectArticleIdByWorkbookIdAndDayQuery import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionEmailService.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionEmailService.kt index 311ef73a3..8526af5a5 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionEmailService.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionEmailService.kt @@ -1,8 +1,8 @@ package com.few.api.domain.subscription.service import com.few.api.domain.subscription.service.dto.SendArticleInDto -import com.few.email.service.article.SendArticleEmailService -import com.few.email.service.article.dto.SendArticleEmailArgs +import com.few.api.domain.article.email.SendArticleEmailService +import com.few.api.domain.article.email.dto.SendArticleEmailArgs import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionLogService.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionLogService.kt index 858546fc0..0caa2ea3e 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionLogService.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionLogService.kt @@ -1,9 +1,9 @@ package com.few.api.domain.subscription.service import com.few.api.domain.subscription.service.dto.InsertSendEventDto -import com.few.api.repo.dao.log.SendArticleEventHistoryDao -import com.few.api.repo.dao.log.command.InsertEventCommand -import com.few.api.web.support.EmailLogEventType +import com.few.api.domain.log.repo.SendArticleEventHistoryDao +import com.few.api.domain.log.repo.command.InsertEventCommand +import com.few.api.domain.common.vo.EmailLogEventType import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionMemberService.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionMemberService.kt index 109480b86..e7064b297 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionMemberService.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionMemberService.kt @@ -1,11 +1,11 @@ package com.few.api.domain.subscription.service import com.few.api.domain.subscription.service.dto.* -import com.few.api.exception.common.InsertException -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.InsertMemberCommand -import com.few.api.repo.dao.member.query.SelectMemberByEmailQuery -import com.few.api.repo.dao.member.query.SelectMemberEmailQuery +import com.few.api.domain.common.exception.InsertException +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.command.InsertMemberCommand +import com.few.api.domain.member.repo.query.SelectMemberByEmailQuery +import com.few.api.domain.member.repo.query.SelectMemberEmailQuery import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionWorkbookService.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionWorkbookService.kt index 967446fa9..e1bf4b834 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionWorkbookService.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/SubscriptionWorkbookService.kt @@ -1,10 +1,10 @@ package com.few.api.domain.subscription.service import com.few.api.domain.subscription.service.dto.* -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.query.SelectAllWorkbookTitleQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookLastArticleIdQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.query.SelectAllWorkbookTitleQuery +import com.few.api.domain.workbook.repo.query.SelectWorkBookLastArticleIdQuery +import com.few.api.domain.workbook.repo.query.SelectWorkBookRecordQuery import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/InsertMemberInDto.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/InsertMemberInDto.kt index a05b85740..4fd1cb3a4 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/InsertMemberInDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/InsertMemberInDto.kt @@ -1,6 +1,6 @@ package com.few.api.domain.subscription.service.dto -import com.few.data.common.code.MemberType +import com.few.api.domain.common.vo.MemberType data class InsertMemberInDto( val email: String, diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/SendArticleInDto.kt b/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/SendArticleInDto.kt index bc1f11724..234adc3a3 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/SendArticleInDto.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/service/dto/SendArticleInDto.kt @@ -1,6 +1,6 @@ package com.few.api.domain.subscription.service.dto -import com.few.email.service.article.dto.Content +import com.few.api.domain.article.email.dto.Content data class SendArticleInDto( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCase.kt index 70b72404e..7c2a1cb87 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCase.kt @@ -6,13 +6,13 @@ import com.few.api.domain.subscription.service.SubscriptionWorkbookService import com.few.api.domain.subscription.service.dto.ReadAllWorkbookTitleInDto import com.few.api.domain.subscription.service.dto.ReadArticleIdByWorkbookIdAndDayDto import com.few.api.domain.subscription.usecase.dto.* -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.query.CountAllWorkbooksSubscriptionQuery -import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookActiveSubscriptionQuery -import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookInActiveSubscriptionQuery -import com.few.api.repo.dao.subscription.query.SelectAllSubscriptionSendStatusQuery -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookStatus +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.query.CountAllWorkbooksSubscriptionQuery +import com.few.api.domain.subscription.repo.query.SelectAllMemberWorkbookActiveSubscriptionQuery +import com.few.api.domain.subscription.repo.query.SelectAllMemberWorkbookInActiveSubscriptionQuery +import com.few.api.domain.subscription.repo.query.SelectAllSubscriptionSendStatusQuery +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookStatus import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import org.webjars.NotFoundException diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt index fb04f3640..27367c451 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCase.kt @@ -1,19 +1,19 @@ package com.few.api.domain.subscription.usecase -import com.few.api.domain.common.lock.LockFor -import com.few.api.domain.common.lock.LockIdentifier +import com.few.api.domain.common.lock.ApiLockFor +import com.few.api.domain.common.lock.ApiLockIdentifier import com.few.api.domain.subscription.event.dto.WorkbookSubscriptionEvent -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.InsertWorkbookSubscriptionCommand -import com.few.api.repo.dao.subscription.query.SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.InsertWorkbookSubscriptionCommand +import com.few.api.domain.subscription.repo.query.SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery import com.few.api.domain.subscription.usecase.dto.SubscribeWorkbookUseCaseIn import com.few.api.domain.subscription.usecase.model.CancelledWorkbookSubscriptionHistory import com.few.api.domain.subscription.usecase.model.WorkbookSubscriptionHistory import com.few.api.domain.subscription.usecase.model.WorkbookSubscriptionStatus -import com.few.api.exception.common.NotFoundException -import com.few.api.exception.subscribe.SubscribeIllegalArgumentException -import com.few.api.repo.dao.subscription.query.CountWorkbookMappedArticlesQuery -import com.few.api.repo.dao.subscription.query.SelectSubscriptionSendStatusQuery +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.subscription.exception.SubscribeIllegalArgumentException +import com.few.api.domain.subscription.repo.query.CountWorkbookMappedArticlesQuery +import com.few.api.domain.subscription.repo.query.SelectSubscriptionSendStatusQuery import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional @@ -24,7 +24,7 @@ class SubscribeWorkbookUseCase( private val applicationEventPublisher: ApplicationEventPublisher, ) { - @LockFor(LockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID) + @ApiLockFor(ApiLockIdentifier.SUBSCRIPTION_MEMBER_ID_WORKBOOK_ID) @Transactional fun execute(useCaseIn: SubscribeWorkbookUseCaseIn) { val subTargetWorkbookId = useCaseIn.workbookId @@ -98,11 +98,6 @@ class SubscribeWorkbookUseCase( } } - /** - * 구독 이벤트 발행 - * @see com.few.api.domain.subscription.event.WorkbookSubscriptionEventListener - * @see com.few.api.domain.subscription.event.WorkbookSubscriptionAfterCompletionEventListener - */ applicationEventPublisher.publishEvent( WorkbookSubscriptionEvent( workbookId = subTargetWorkbookId, diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCase.kt index 48f57e687..aae9108c8 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCase.kt @@ -1,8 +1,8 @@ package com.few.api.domain.subscription.usecase import com.few.api.domain.subscription.usecase.dto.UnsubscribeAllUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.UpdateDeletedAtInAllSubscriptionCommand +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.UpdateDeletedAtInAllSubscriptionCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCase.kt index 057193e47..6f2f8e624 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCase.kt @@ -1,7 +1,7 @@ package com.few.api.domain.subscription.usecase -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.UpdateDeletedAtInWorkbookSubscriptionCommand +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.UpdateDeletedAtInWorkbookSubscriptionCommand import com.few.api.domain.subscription.usecase.dto.UnsubscribeWorkbookUseCaseIn import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionDayUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionDayUseCase.kt index 8531fb93d..a170363d1 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionDayUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionDayUseCase.kt @@ -1,8 +1,8 @@ package com.few.api.domain.subscription.usecase import com.few.api.domain.subscription.usecase.dto.UpdateSubscriptionDayUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.BulkUpdateSubscriptionSendDayCommand +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.BulkUpdateSubscriptionSendDayCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionTimeUseCase.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionTimeUseCase.kt index 70b69649b..ec2882fc5 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionTimeUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/UpdateSubscriptionTimeUseCase.kt @@ -1,8 +1,8 @@ package com.few.api.domain.subscription.usecase import com.few.api.domain.subscription.usecase.dto.UpdateSubscriptionTimeUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.command.BulkUpdateSubscriptionSendTimeCommand +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.command.BulkUpdateSubscriptionSendTimeCommand import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseIn.kt index e59b47284..112c64a08 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseIn.kt @@ -1,6 +1,6 @@ package com.few.api.domain.subscription.usecase.dto -import com.few.api.web.support.ViewCategory +import com.few.api.domain.common.vo.ViewCategory data class BrowseSubscribeWorkbooksUseCaseIn( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseOut.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseOut.kt index 5138f197e..7b07c00b4 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseOut.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/BrowseSubscribeWorkbooksUseCaseOut.kt @@ -1,8 +1,8 @@ package com.few.api.domain.subscription.usecase.dto import com.fasterxml.jackson.annotation.JsonFormat -import com.few.api.web.support.DayCode -import com.few.api.web.support.WorkBookStatus +import com.few.api.domain.common.vo.DayCode +import com.few.api.domain.common.vo.WorkBookStatus import java.time.LocalTime data class BrowseSubscribeWorkbooksUseCaseOut( diff --git a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionDayUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionDayUseCaseIn.kt index 6d92824f4..08de30cab 100644 --- a/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionDayUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/subscription/usecase/dto/UpdateSubscriptionDayUseCaseIn.kt @@ -1,6 +1,6 @@ package com.few.api.domain.subscription.usecase.dto -import com.few.api.web.support.DayCode +import com.few.api.domain.common.vo.DayCode data class UpdateSubscriptionDayUseCaseIn( val memberId: Long, diff --git a/api/src/main/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleController.kt b/api/src/main/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleController.kt similarity index 83% rename from api/src/main/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleController.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleController.kt index 049d8de02..87b2473ca 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleController.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleController.kt @@ -1,12 +1,12 @@ -package com.few.api.web.controller.workbook.article +package com.few.api.domain.workbook.article.controller import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleUseCaseIn import com.few.api.domain.workbook.article.usecase.ReadWorkBookArticleUseCase -import com.few.api.web.controller.workbook.article.response.ReadWorkBookArticleResponse -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator -import com.few.api.web.support.method.UserArgument -import com.few.api.web.support.method.UserArgumentDetails +import com.few.api.domain.workbook.article.controller.response.ReadWorkBookArticleResponse +import web.ApiResponse +import web.ApiResponseGenerator +import web.UserArgument +import web.UserArgumentDetails import jakarta.validation.constraints.Min import org.springframework.http.HttpStatus import org.springframework.http.MediaType diff --git a/api/src/main/kotlin/com/few/api/web/controller/workbook/article/response/ReadWorkBookArticleResponse.kt b/api/src/main/kotlin/com/few/api/domain/workbook/article/controller/response/ReadWorkBookArticleResponse.kt similarity index 86% rename from api/src/main/kotlin/com/few/api/web/controller/workbook/article/response/ReadWorkBookArticleResponse.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/article/controller/response/ReadWorkBookArticleResponse.kt index 2d10346aa..a6040bcb9 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/workbook/article/response/ReadWorkBookArticleResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/article/controller/response/ReadWorkBookArticleResponse.kt @@ -1,7 +1,7 @@ -package com.few.api.web.controller.workbook.article.response +package com.few.api.domain.workbook.article.controller.response import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleOut -import com.few.api.web.controller.workbook.response.WriterInfo +import com.few.api.domain.workbook.controller.response.WriterInfo import java.time.LocalDateTime data class ReadWorkBookArticleResponse( diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/article/usecase/ReadWorkBookArticleUseCase.kt b/api/src/main/kotlin/com/few/api/domain/workbook/article/usecase/ReadWorkBookArticleUseCase.kt index e975c6720..8923e7cb7 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/article/usecase/ReadWorkBookArticleUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/article/usecase/ReadWorkBookArticleUseCase.kt @@ -6,13 +6,13 @@ import com.few.api.domain.article.service.BrowseArticleProblemsService import com.few.api.domain.article.service.ReadArticleWriterRecordService import com.few.api.domain.article.service.dto.BrowseArticleProblemIdsInDto import com.few.api.domain.article.service.dto.ReadWriterRecordInDto +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleUseCaseIn import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleOut import com.few.api.domain.workbook.article.dto.WriterDetail -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.query.SelectWorkBookArticleRecordQuery -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.query.SelectWorkBookArticleRecordQuery import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -41,9 +41,6 @@ class ReadWorkBookArticleUseCase( val problemIds = browseArticleProblemsService.execute(BrowseArticleProblemIdsInDto(articleRecord.articleId)) - /** - * @see com.few.api.domain.article.usecase.ReadArticleUseCase - */ articleViewCountHandler.browseArticleViewCount(useCaseIn.articleId) applicationEventPublisher.publishEvent( ReadArticleEvent( diff --git a/api/src/main/kotlin/com/few/api/web/controller/workbook/WorkBookController.kt b/api/src/main/kotlin/com/few/api/domain/workbook/controller/WorkBookController.kt similarity index 86% rename from api/src/main/kotlin/com/few/api/web/controller/workbook/WorkBookController.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/controller/WorkBookController.kt index 1e1b45fa7..5a5e4bd3d 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/workbook/WorkBookController.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/controller/WorkBookController.kt @@ -1,16 +1,19 @@ -package com.few.api.web.controller.workbook +package com.few.api.domain.workbook.controller import com.few.api.domain.workbook.usecase.BrowseWorkbooksUseCase import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseIn import com.few.api.domain.workbook.usecase.ReadWorkbookUseCase import com.few.api.domain.workbook.usecase.dto.BrowseWorkbooksUseCaseIn -import com.few.api.web.controller.workbook.response.* -import com.few.api.web.support.WorkBookCategory -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.method.UserArgument -import com.few.api.web.support.method.UserArgumentDetails +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookCategory +import com.few.api.domain.workbook.controller.response.BrowseWorkBookInfo +import com.few.api.domain.workbook.controller.response.BrowseWorkBooksResponse +import com.few.api.domain.workbook.controller.response.ReadWorkBookResponse +import com.few.api.domain.workbook.controller.response.WriterInfo +import web.ApiResponse +import web.ApiResponseGenerator +import web.UserArgument +import web.UserArgumentDetails import jakarta.validation.constraints.Min import org.springframework.http.HttpStatus import org.springframework.http.MediaType diff --git a/api/src/main/kotlin/com/few/api/web/controller/workbook/response/BrowseWorkBooksResponse.kt b/api/src/main/kotlin/com/few/api/domain/workbook/controller/response/BrowseWorkBooksResponse.kt similarity index 87% rename from api/src/main/kotlin/com/few/api/web/controller/workbook/response/BrowseWorkBooksResponse.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/controller/response/BrowseWorkBooksResponse.kt index bedb84de9..66bb75c9a 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/workbook/response/BrowseWorkBooksResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/controller/response/BrowseWorkBooksResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.workbook.response +package com.few.api.domain.workbook.controller.response import java.net.URL import java.time.LocalDateTime diff --git a/api/src/main/kotlin/com/few/api/web/controller/workbook/response/ReadWorkBookResponse.kt b/api/src/main/kotlin/com/few/api/domain/workbook/controller/response/ReadWorkBookResponse.kt similarity index 95% rename from api/src/main/kotlin/com/few/api/web/controller/workbook/response/ReadWorkBookResponse.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/controller/response/ReadWorkBookResponse.kt index 090ef090f..338904d57 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/workbook/response/ReadWorkBookResponse.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/controller/response/ReadWorkBookResponse.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.workbook.response +package com.few.api.domain.workbook.controller.response import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseOut import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkBookCacheManager.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkBookCacheManager.kt similarity index 76% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkBookCacheManager.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkBookCacheManager.kt index 603423dd4..52f1a361a 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkBookCacheManager.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkBookCacheManager.kt @@ -1,7 +1,7 @@ -package com.few.api.repo.dao.workbook +package com.few.api.domain.workbook.repo -import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_WORKBOOK_RECORD_CACHE -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecord +import com.few.api.config.ApiLocalCacheConfig.Companion.SELECT_WORKBOOK_RECORD_CACHE +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecord import org.springframework.cache.CacheManager import org.springframework.stereotype.Service import javax.cache.Cache diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkbookDao.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkbookDao.kt similarity index 88% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkbookDao.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkbookDao.kt index 561a0e00b..2fe0b8c6e 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkbookDao.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/WorkbookDao.kt @@ -1,17 +1,17 @@ -package com.few.api.repo.dao.workbook +package com.few.api.domain.workbook.repo -import com.few.api.repo.config.LocalCacheConfig -import com.few.api.repo.config.LocalCacheConfig.Companion.LOCAL_CM -import com.few.api.repo.dao.workbook.command.InsertWorkBookCommand -import com.few.api.repo.dao.workbook.command.MapWorkBookToArticleCommand -import com.few.api.repo.dao.workbook.query.BrowseWorkBookQueryWithSubscriptionCountQuery -import com.few.api.repo.dao.workbook.query.SelectAllWorkbookTitleQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookLastArticleIdQuery -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecord -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecordWithSubscriptionCount -import com.few.api.repo.dao.workbook.record.WorkbookTitleRecord -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.vo.CategoryType +import com.few.api.config.ApiLocalCacheConfig +import com.few.api.config.ApiLocalCacheConfig.Companion.LOCAL_CM +import com.few.api.domain.workbook.repo.command.InsertWorkBookCommand +import com.few.api.domain.workbook.repo.command.MapWorkBookToArticleCommand +import com.few.api.domain.workbook.repo.query.BrowseWorkBookQueryWithSubscriptionCountQuery +import com.few.api.domain.workbook.repo.query.SelectAllWorkbookTitleQuery +import com.few.api.domain.workbook.repo.query.SelectWorkBookLastArticleIdQuery +import com.few.api.domain.workbook.repo.query.SelectWorkBookRecordQuery +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecord +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecordWithSubscriptionCount +import com.few.api.domain.workbook.repo.record.WorkbookTitleRecord import jooq.jooq_dsl.tables.MappingWorkbookArticle import jooq.jooq_dsl.tables.Subscription import jooq.jooq_dsl.tables.Workbook @@ -25,7 +25,7 @@ import org.springframework.stereotype.Repository class WorkbookDao( private val dslContext: DSLContext, ) { - @Cacheable(key = "#query.id", cacheManager = LOCAL_CM, cacheNames = [LocalCacheConfig.SELECT_WORKBOOK_RECORD_CACHE]) + @Cacheable(key = "#query.id", cacheManager = LOCAL_CM, cacheNames = [ApiLocalCacheConfig.SELECT_WORKBOOK_RECORD_CACHE]) fun selectWorkBook(query: SelectWorkBookRecordQuery): SelectWorkBookRecord? { return selectWorkBookQuery(query) .fetchOneInto(SelectWorkBookRecord::class.java) diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/InsertWorkBookCommand.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/command/InsertWorkBookCommand.kt similarity index 76% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/InsertWorkBookCommand.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/command/InsertWorkBookCommand.kt index 19812684c..c9e2b247d 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/InsertWorkBookCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/command/InsertWorkBookCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.command +package com.few.api.domain.workbook.repo.command import java.net.URL diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/MapWorkBookToArticleCommand.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/command/MapWorkBookToArticleCommand.kt similarity index 69% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/MapWorkBookToArticleCommand.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/command/MapWorkBookToArticleCommand.kt index 7d0892021..62379f190 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/command/MapWorkBookToArticleCommand.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/command/MapWorkBookToArticleCommand.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.command +package com.few.api.domain.workbook.repo.command data class MapWorkBookToArticleCommand( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt similarity index 76% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt index f5aa8e89a..28fd53d24 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/BrowseWorkBookQueryWithSubscriptionCountQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.query +package com.few.api.domain.workbook.repo.query data class BrowseWorkBookQueryWithSubscriptionCountQuery( /** diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectAllWorkbookTitleQuery.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectAllWorkbookTitleQuery.kt similarity index 61% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectAllWorkbookTitleQuery.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectAllWorkbookTitleQuery.kt index 1bfa772db..c935dd3df 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectAllWorkbookTitleQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectAllWorkbookTitleQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.query +package com.few.api.domain.workbook.repo.query data class SelectAllWorkbookTitleQuery( val workbookIds: List, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookLastArticleIdQuery.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookLastArticleIdQuery.kt similarity index 60% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookLastArticleIdQuery.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookLastArticleIdQuery.kt index 428d4d315..4ee1f1d5a 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookLastArticleIdQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookLastArticleIdQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.query +package com.few.api.domain.workbook.repo.query data class SelectWorkBookLastArticleIdQuery( val workbookId: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookRecordQuery.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookRecordQuery.kt similarity index 55% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookRecordQuery.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookRecordQuery.kt index 1e5818270..34e52812b 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/query/SelectWorkBookRecordQuery.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/query/SelectWorkBookRecordQuery.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.query +package com.few.api.domain.workbook.repo.query data class SelectWorkBookRecordQuery( val id: Long, diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecord.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecord.kt similarity index 83% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecord.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecord.kt index 971b48fca..519277583 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.record +package com.few.api.domain.workbook.repo.record import java.net.URL import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecordWithSubscriptionCount.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecordWithSubscriptionCount.kt similarity index 86% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecordWithSubscriptionCount.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecordWithSubscriptionCount.kt index 04ff9fa38..140e321df 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/SelectWorkBookRecordWithSubscriptionCount.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/SelectWorkBookRecordWithSubscriptionCount.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.record +package com.few.api.domain.workbook.repo.record import java.net.URL import java.time.LocalDateTime diff --git a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/WorkbookTitleRecord.kt b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/WorkbookTitleRecord.kt similarity index 63% rename from api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/WorkbookTitleRecord.kt rename to api/src/main/kotlin/com/few/api/domain/workbook/repo/record/WorkbookTitleRecord.kt index f6531c5f5..64b0d6c7f 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/record/WorkbookTitleRecord.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/repo/record/WorkbookTitleRecord.kt @@ -1,4 +1,4 @@ -package com.few.api.repo.dao.workbook.record +package com.few.api.domain.workbook.repo.record data class WorkbookTitleRecord( val workbookId: Long, diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookArticleService.kt b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookArticleService.kt index e0985abc2..a315f8cd0 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookArticleService.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookArticleService.kt @@ -3,8 +3,8 @@ package com.few.api.domain.workbook.service import com.few.api.domain.workbook.usecase.dto.ArticleDetail import com.few.api.domain.workbook.service.dto.BrowseWorkbookArticlesInDto import com.few.api.domain.workbook.service.dto.WorkBookArticleOutDto -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.query.SelectWorkbookMappedArticleRecordsQuery +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.query.SelectWorkbookMappedArticleRecordsQuery import org.springframework.stereotype.Service fun List.writerIds(): List { diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookMemberService.kt b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookMemberService.kt index feaaf900a..65d29e810 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookMemberService.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookMemberService.kt @@ -5,9 +5,9 @@ import com.few.api.domain.workbook.usecase.dto.WriterDetail import com.few.api.domain.workbook.service.dto.BrowseWriterRecordsInDto import com.few.api.domain.workbook.service.dto.WriterMappedWorkbookOutDto import com.few.api.domain.workbook.service.dto.WriterOutDto -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.BrowseWorkbookWritersQuery -import com.few.api.repo.dao.member.query.SelectWritersQuery +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.BrowseWorkbookWritersQuery +import com.few.api.domain.member.repo.query.SelectWritersQuery import org.springframework.stereotype.Service fun List.toWriterDetails(): List { diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookSubscribeService.kt b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookSubscribeService.kt index 3bbd89ae2..789bcaa81 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookSubscribeService.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/service/WorkbookSubscribeService.kt @@ -2,9 +2,9 @@ package com.few.api.domain.workbook.service import com.few.api.domain.workbook.service.dto.BrowseMemberSubscribeWorkbooksInDto import com.few.api.domain.workbook.service.dto.BrowseMemberSubscribeWorkbooksOutDto -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookActiveSubscriptionQuery -import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookInActiveSubscriptionQuery +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.query.SelectAllMemberWorkbookActiveSubscriptionQuery +import com.few.api.domain.subscription.repo.query.SelectAllMemberWorkbookInActiveSubscriptionQuery import org.springframework.stereotype.Service @Service diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCase.kt b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCase.kt index 15a5aa002..320988a1f 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCase.kt @@ -1,5 +1,6 @@ package com.few.api.domain.workbook.usecase +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.service.WorkbookMemberService import com.few.api.domain.workbook.service.WorkbookSubscribeService import com.few.api.domain.workbook.service.dto.BrowseMemberSubscribeWorkbooksInDto @@ -11,11 +12,10 @@ import com.few.api.domain.workbook.usecase.dto.BrowseWorkbooksUseCaseOut import com.few.api.domain.workbook.usecase.dto.WriterDetail import com.few.api.domain.workbook.usecase.model.* import com.few.api.domain.workbook.usecase.model.order.* -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.query.BrowseWorkBookQueryWithSubscriptionCountQuery -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecordWithSubscriptionCount -import com.few.api.web.support.ViewCategory -import com.few.data.common.code.CategoryType +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.query.BrowseWorkBookQueryWithSubscriptionCountQuery +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecordWithSubscriptionCount +import com.few.api.domain.common.vo.ViewCategory import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCase.kt b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCase.kt index b2e4b160a..f091f953b 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCase.kt @@ -1,14 +1,14 @@ package com.few.api.domain.workbook.usecase +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseIn import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseOut import com.few.api.domain.workbook.service.* import com.few.api.domain.workbook.service.dto.BrowseWorkbookArticlesInDto import com.few.api.domain.workbook.service.dto.BrowseWriterRecordsInDto -import com.few.api.exception.common.NotFoundException -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.query.SelectWorkBookRecordQuery -import com.few.data.common.code.CategoryType +import com.few.api.domain.common.exception.NotFoundException +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.query.SelectWorkBookRecordQuery import org.springframework.stereotype.Component @Component diff --git a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/dto/BrowseWorkbooksUseCaseIn.kt b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/dto/BrowseWorkbooksUseCaseIn.kt index 4c073ab26..c1bd24c25 100644 --- a/api/src/main/kotlin/com/few/api/domain/workbook/usecase/dto/BrowseWorkbooksUseCaseIn.kt +++ b/api/src/main/kotlin/com/few/api/domain/workbook/usecase/dto/BrowseWorkbooksUseCaseIn.kt @@ -1,7 +1,7 @@ package com.few.api.domain.workbook.usecase.dto -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookCategory +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookCategory data class BrowseWorkbooksUseCaseIn( val category: WorkBookCategory, diff --git a/api/src/main/kotlin/com/few/api/exception/properties/NotSetPropertyException.kt b/api/src/main/kotlin/com/few/api/exception/properties/NotSetPropertyException.kt deleted file mode 100644 index 2be9cff32..000000000 --- a/api/src/main/kotlin/com/few/api/exception/properties/NotSetPropertyException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.few.api.exception.properties - -class NotSetPropertyException(property: String) : RuntimeException("$property is not set") \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/config/CorsConfigurationSourceProperties.kt b/api/src/main/kotlin/com/few/api/security/config/CorsConfigurationSourceProperties.kt deleted file mode 100644 index f96693927..000000000 --- a/api/src/main/kotlin/com/few/api/security/config/CorsConfigurationSourceProperties.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.few.api.security.config - -import org.springframework.beans.factory.annotation.Value -import org.springframework.stereotype.Component - -@Component -data class CorsConfigurationSourceProperties( - @Value("\${security.cors.path-patterns}") - val pathPattern: String, - @Value("\${security.cors.origin-patterns}") - val originPatterns: String, - @Value("\${security.cors.allowed-methods}") - val allowedMethods: String, - @Value("\${security.cors.allowed-headers}") - val allowedHeaders: String, - @Value("\${security.cors.exposed-headers}") - val exposedHeaders: String, - @Value("\${security.cors.allow-credentials}") - val allowCredentials: Boolean, - @Value("\${security.cors.max-age}") - val maxAge: Long, -) \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/config/WebSecurityConfig.kt b/api/src/main/kotlin/com/few/api/security/config/WebSecurityConfig.kt deleted file mode 100644 index 041612160..000000000 --- a/api/src/main/kotlin/com/few/api/security/config/WebSecurityConfig.kt +++ /dev/null @@ -1,223 +0,0 @@ -package com.few.api.security.config - -import com.few.api.security.authentication.token.TokenAuthProvider -import com.few.api.security.filter.exception.TokenInvalidExceptionHandlerFilter -import com.few.api.security.filter.token.TokenAuthenticationFilter -import com.few.api.security.handler.DelegatedAccessDeniedHandler -import com.few.api.security.handler.DelegatedAuthenticationEntryPoint -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Profile -import org.springframework.http.HttpMethod -import org.springframework.security.authentication.ProviderManager -import org.springframework.security.config.annotation.web.builders.HttpSecurity -import org.springframework.security.config.annotation.web.builders.WebSecurity -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity -import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer -import org.springframework.security.config.http.SessionCreationPolicy -import org.springframework.security.web.SecurityFilterChain -import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter -import org.springframework.security.web.util.matcher.AntPathRequestMatcher -import org.springframework.web.cors.CorsConfiguration -import org.springframework.web.cors.CorsConfigurationSource -import org.springframework.web.cors.UrlBasedCorsConfigurationSource -import org.springframework.web.filter.OncePerRequestFilter - -@EnableWebSecurity -@Configuration -class WebSecurityConfig( - private val authenticationEntryPoint: DelegatedAuthenticationEntryPoint, - private val accessDeniedHandler: DelegatedAccessDeniedHandler, - private val tokenAuthProvider: TokenAuthProvider, - private val corsProperties: CorsConfigurationSourceProperties, -) { - - @Bean - @Profile("!prod") - fun localSecurityFilterChain(http: HttpSecurity): SecurityFilterChain { - http.csrf { - it.disable() - } - http.formLogin { - it.disable() - } - http.httpBasic { - it.disable() - } - http.cors { - it.configurationSource(corsConfigurationSource()) - } - http.authorizeHttpRequests { - it.requestMatchers( - AntPathRequestMatcher("/api/v1/**") - ).authenticated().anyRequest().denyAll() - } - http.addFilterBefore( - tokenInvalidExceptionHandlerFilter, - AbstractPreAuthenticatedProcessingFilter::class.java - ) - http.addFilterAt( - generateAuthenticationFilter(), - AbstractPreAuthenticatedProcessingFilter::class.java - ) - http.exceptionHandling { - it.authenticationEntryPoint(authenticationEntryPoint) - it.accessDeniedHandler(accessDeniedHandler) - } - http.sessionManagement { - it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) - } - - return http.build() - } - - @Bean - @Profile(value = ["prod"]) - fun prdSecurityFilterChain(http: HttpSecurity): SecurityFilterChain { - http.csrf { - it.disable() - } - http.formLogin { - it.disable() - } - http.httpBasic { - it.disable() - } - http.cors { - it.configurationSource(corsConfigurationSource()) - } - http.authorizeHttpRequests { - it.requestMatchers( - AntPathRequestMatcher("/api/v1/**") - ).authenticated().anyRequest().denyAll() - } - http.addFilterBefore( - tokenInvalidExceptionHandlerFilter, - AbstractPreAuthenticatedProcessingFilter::class.java - ) - http.addFilterAt( - generateAuthenticationFilter(), - AbstractPreAuthenticatedProcessingFilter::class.java - ) - http.exceptionHandling { - it.authenticationEntryPoint(authenticationEntryPoint) - it.accessDeniedHandler(accessDeniedHandler) - } - http.sessionManagement { - it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) - } - return http.build() - } - - private fun generateAuthenticationFilter(): TokenAuthenticationFilter { - val tokenAuthenticationFilter = TokenAuthenticationFilter() - tokenAuthenticationFilter.setAuthenticationManager(ProviderManager(tokenAuthProvider)) - return tokenAuthenticationFilter - } - - val tokenInvalidExceptionHandlerFilter: OncePerRequestFilter - get() = TokenInvalidExceptionHandlerFilter() - - @Bean - @Profile("!prod") - fun localWebSecurityFilterIgnoreCustomizer(): WebSecurityCustomizer { - return WebSecurityCustomizer { web: WebSecurity -> - web.ignoring() - .requestMatchers( - AntPathRequestMatcher("/actuator/health", HttpMethod.GET.name()), - AntPathRequestMatcher("/error", HttpMethod.GET.name()), - AntPathRequestMatcher("/docs/swagger-ui/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/swagger-ui/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/swagger-resources/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/v3/api-docs/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/openapi3.yaml", HttpMethod.GET.name()), - AntPathRequestMatcher("/reports/**", HttpMethod.GET.name()), - - /** 인증/비인증 모두 허용 */ - AntPathRequestMatcher( - "/api/v1/subscriptions/workbooks/main", - HttpMethod.GET.name() - ), - AntPathRequestMatcher("/api/v1/workbooks", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/articles/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), - - /** 어드민 */ - AntPathRequestMatcher("/api/v1/admin/**", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/articles/views", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/logs", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/logs/email/articles", HttpMethod.POST.name()), - AntPathRequestMatcher("/batch/**"), - - /** 인증 불필요 */ - AntPathRequestMatcher("/api/v1/members", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/members/token", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/articles", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/articles/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/problems/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/problems/*", HttpMethod.POST.name()) - ) - } - } - - @Bean - @Profile("prd") - fun prdWebSecurityFilterIgnoreCustomizer(): WebSecurityCustomizer { - return WebSecurityCustomizer { web: WebSecurity -> - web.ignoring() - .requestMatchers( - AntPathRequestMatcher("/actuator/health", HttpMethod.GET.name()), - AntPathRequestMatcher("/error", HttpMethod.GET.name()), - AntPathRequestMatcher("/docs/swagger-ui/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/swagger-ui/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/swagger-resources/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/v3/api-docs/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/openapi3.yaml", HttpMethod.GET.name()), - AntPathRequestMatcher("/reports/**", HttpMethod.GET.name()), - - /** 인증/비인증 모두 허용 */ - AntPathRequestMatcher( - "/api/v1/subscriptions/workbooks/main", - HttpMethod.GET.name() - ), - AntPathRequestMatcher("/api/v1/workbooks", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/articles/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), - - /** 어드민 */ - AntPathRequestMatcher("/api/v1/admin/**", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/articles/views", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/logs/email/articles", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/logs", HttpMethod.POST.name()), - AntPathRequestMatcher("/batch/**"), - - /** 인증 불필요 */ - AntPathRequestMatcher("/api/v1/members", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/members/token", HttpMethod.POST.name()), - AntPathRequestMatcher("/api/v1/articles", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/articles/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/problems/**", HttpMethod.GET.name()), - AntPathRequestMatcher("/api/v1/problems/*", HttpMethod.POST.name()) - ) - } - } - - fun corsConfigurationSource(): CorsConfigurationSource { - val configuration = CorsConfiguration() - configuration.addAllowedOriginPattern(corsProperties.originPatterns) - configuration.addAllowedHeader(corsProperties.allowedHeaders) - configuration.addAllowedMethod(corsProperties.allowedMethods) - configuration.allowCredentials = corsProperties.allowCredentials - val source = UrlBasedCorsConfigurationSource() - source.registerCorsConfiguration(corsProperties.pathPattern, configuration) - return source - } -} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/exception/AccessTokenInvalidException.kt b/api/src/main/kotlin/com/few/api/security/exception/AccessTokenInvalidException.kt deleted file mode 100644 index 18acfe507..000000000 --- a/api/src/main/kotlin/com/few/api/security/exception/AccessTokenInvalidException.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.few.api.security.exception - -import org.springframework.security.core.AuthenticationException - -class AccessTokenInvalidException(msg: String?) : AuthenticationException(msg) \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/support/ApiResponseGenerator.kt b/api/src/main/kotlin/com/few/api/web/support/ApiResponseGenerator.kt deleted file mode 100644 index 84aad361f..000000000 --- a/api/src/main/kotlin/com/few/api/web/support/ApiResponseGenerator.kt +++ /dev/null @@ -1,112 +0,0 @@ -package com.few.api.web.support - -import org.springframework.http.HttpStatus - -/** API 응답 객체 생성기 */ -object ApiResponseGenerator { - /** - * Http 상태 코드만 포함하는 API 응답 성공 객체 생성한다. - * - * @param status Http 상태 코드 - * @return API 응답 객체 - */ - fun success(status: HttpStatus): ApiResponse { - return ApiResponse( - ApiResponse.Success(MessageCode.SUCCESS.value), - status - ) - } - - /** - * Http 상태 코드와 메시지 코드를 포함하는 API 응답 성공 객체 생성한다. - * - * @param status Http 상태 코드 - * @param code 메시지 코드 - * @return API 응답 객체 - */ - fun success( - status: HttpStatus, - code: MessageCode, - ): ApiResponse { - return ApiResponse(ApiResponse.Success(code.value), status) - } - - /** - * Http 상태 코드와 데이터를 포함하는 API 응답 성공 객체 생성한다. - * - * @param data 데이터 - * @param status Http 상태 코드 - * @return API 응답 객체 - * @param 데이터 타입 - */ - fun success( - data: D, - status: HttpStatus, - ): ApiResponse> { - return ApiResponse( - ApiResponse.SuccessBody( - data, - MessageCode.SUCCESS.value - ), - status - ) - } - - /** - * Http 상태 코드, 데이터, 메시지 코드를 포함하는 API 응답 성공 객체 생성한다. - * - * @param data 데이터 - * @param status Http 상태 코드 - * @param code 메시지 코드 - * @return API 응답 객체 - * @param 데이터 타입 - */ - fun success( - data: D, - status: HttpStatus, - code: MessageCode, - ): ApiResponse> { - return ApiResponse( - ApiResponse.SuccessBody(data, code.value), - status - ) - } - - /** - * Http 상태 코드만 포함하는 API 응답 실패 객체 생성한다. - * - * @param status Http 상태 코드 - * @return API 응답 객체 - */ - fun fail(status: HttpStatus): ApiResponse { - return ApiResponse(status) - } - - /** - * Http 상태 코드와 응답 실패 바디를 포함하는 API 응답 실패 객체 생성한다. - * - * @param body 응답 실패 바디 - * @param status Http 상태 코드 - * @return API 응답 객체 - */ - fun fail( - body: ApiResponse.FailureBody, - status: HttpStatus, - ): ApiResponse { - return ApiResponse(body, status) - } - - /** - * Http 상태 코드와 코드 그리고 응답 실패 바디를 포함하는 API 응답 실패 객체 생성한다. - * - * @param message 메시지 - * @param status Http 상태 코드 - * @return API 응답 객체 - */ - fun fail( - message: String, - status: HttpStatus, - ): ApiResponse { - return ApiResponse(ApiResponse.FailureBody(message), status) - } -} \ No newline at end of file diff --git a/api/src/main/resources/application-security-local.yml b/api/src/main/resources/application-security-local.yml deleted file mode 100644 index 936ef9375..000000000 --- a/api/src/main/resources/application-security-local.yml +++ /dev/null @@ -1,21 +0,0 @@ -security: - jwt: - token: - validtime: - access: 31557600000 - refresh: 31557600000 - secretkey: jwtsecretKeyhastolonghowlongidontknow - cors: - path-patterns: "/**" - origin-patterns: "http://localhost:3000" - allowed-methods: "*" - allowed-headers: "*" - exposed-headers: "Set-Cookie, Authorization, Content-Type, X-Requested-With, Accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials" - allow-credentials: true - max-age: 1800 - encryption: - algorithm: AES - secretKey: encryptionsecret - transformation: AES/CBC/PKCS5Padding - keySize: 128 - iv: AAAAAAAAAAAAAAAA diff --git a/api/src/main/resources/application-client-local.yml b/api/src/main/resources/application-thread-local.yml similarity index 65% rename from api/src/main/resources/application-client-local.yml rename to api/src/main/resources/application-thread-local.yml index 332cf3815..2e26b4532 100644 --- a/api/src/main/resources/application-client-local.yml +++ b/api/src/main/resources/application-thread-local.yml @@ -1,23 +1,13 @@ -client: - timeout: - connect: 5000 - read: 5000 - -webhook: - discord: "localhost:8080/webhook/discord/unused" - -discord: - thread-pool: - core-pool-size: 5 - max-pool-size: 15 - queue-capacity: 30 - wait-for-tasks-to-complete-on-shutdown: true - await-termination-seconds: 60 - -database: - thread-pool: +thread-pool: + database: core-pool-size: 10 max-pool-size: 30 queue-capacity: 70 wait-for-tasks-to-complete-on-shutdown: true await-termination-seconds: 60 + discord: + core-pool-size: 5 + max-pool-size: 15 + queue-capacity: 30 + wait-for-tasks-to-complete-on-shutdown: true + await-termination-seconds: 60 diff --git a/api/src/main/resources/application-client-prd.yml b/api/src/main/resources/application-thread-prd.yml similarity index 74% rename from api/src/main/resources/application-client-prd.yml rename to api/src/main/resources/application-thread-prd.yml index 871d97be1..113d88e96 100644 --- a/api/src/main/resources/application-client-prd.yml +++ b/api/src/main/resources/application-thread-prd.yml @@ -1,23 +1,13 @@ -client: - timeout: - connect: ${TIMEOUT_CONNECT:5000} - read: ${TIMEOUT_READ:5000} - -webhook: - discord: ${WEBHOOK_DISCORD} - -discord: - thread-pool: - core-pool-size: ${DISCORD_THREAD_POOL_CORE_POOL_SIZE:5} - max-pool-size: ${DISCORD_THREAD_POOL_MAX_POOL_SIZE:15} - queue-capacity: ${DISCORD_THREAD_POOL_QUEUE_CAPACITY:30} - wait-for-tasks-to-complete-on-shutdown: ${DISCORD_THREAD_POOL_WAIT_FOR_TASKS_TO_COMPLETE_ON_SHUTDOWN:true} - await-termination-seconds: ${DISCORD_THREAD_POOL_AWAIT_TERMINATION_SECONDS:60} - -database: - thread-pool: +thread-pool: + database: core-pool-size: 10 max-pool-size: 30 queue-capacity: 70 wait-for-tasks-to-complete-on-shutdown: true await-termination-seconds: 60 + discord: + core-pool-size: ${DISCORD_THREAD_POOL_CORE_POOL_SIZE:5} + max-pool-size: ${DISCORD_THREAD_POOL_MAX_POOL_SIZE:15} + queue-capacity: ${DISCORD_THREAD_POOL_QUEUE_CAPACITY:30} + wait-for-tasks-to-complete-on-shutdown: ${DISCORD_THREAD_POOL_WAIT_FOR_TASKS_TO_COMPLETE_ON_SHUTDOWN:true} + await-termination-seconds: ${DISCORD_THREAD_POOL_AWAIT_TERMINATION_SECONDS:60} diff --git a/api/src/main/resources/application.yml b/api/src/main/resources/application.yml index 482a8220b..c0d996c06 100644 --- a/api/src/main/resources/application.yml +++ b/api/src/main/resources/application.yml @@ -5,18 +5,23 @@ spring: profiles: group: local: + # module - security-local - - client-local - - api-repo-local + - web-local - email-local - storage-local + - api-repo-local + # api + - thread-local prd: + # module - security-prd - - client-prd - - api-repo-prd + - web-prd - email-prd - storage-prd - + - api-repo-prd + # api + - thread-prd auth: batch: ${AUTH_BATCH:0518} diff --git a/api/src/main/resources/messages/article.properties b/api/src/main/resources/messages/api/article.properties similarity index 100% rename from api/src/main/resources/messages/article.properties rename to api/src/main/resources/messages/api/article.properties diff --git a/api/src/main/resources/messages/document.properties b/api/src/main/resources/messages/api/document.properties similarity index 100% rename from api/src/main/resources/messages/document.properties rename to api/src/main/resources/messages/api/document.properties diff --git a/api/src/main/resources/messages/external.properties b/api/src/main/resources/messages/api/external.properties similarity index 100% rename from api/src/main/resources/messages/external.properties rename to api/src/main/resources/messages/api/external.properties diff --git a/api/src/main/resources/messages/image.properties b/api/src/main/resources/messages/api/image.properties similarity index 100% rename from api/src/main/resources/messages/image.properties rename to api/src/main/resources/messages/api/image.properties diff --git a/api/src/main/resources/messages/member.properties b/api/src/main/resources/messages/api/member.properties similarity index 100% rename from api/src/main/resources/messages/member.properties rename to api/src/main/resources/messages/api/member.properties diff --git a/api/src/main/resources/messages/problem.properties b/api/src/main/resources/messages/api/problem.properties similarity index 100% rename from api/src/main/resources/messages/problem.properties rename to api/src/main/resources/messages/api/problem.properties diff --git a/api/src/main/resources/messages/submit.properties b/api/src/main/resources/messages/api/submit.properties similarity index 100% rename from api/src/main/resources/messages/submit.properties rename to api/src/main/resources/messages/api/submit.properties diff --git a/api/src/main/resources/messages/subscribe.properties b/api/src/main/resources/messages/api/subscribe.properties similarity index 100% rename from api/src/main/resources/messages/subscribe.properties rename to api/src/main/resources/messages/api/subscribe.properties diff --git a/api/src/main/resources/messages/workbook.properties b/api/src/main/resources/messages/api/workbook.properties similarity index 100% rename from api/src/main/resources/messages/workbook.properties rename to api/src/main/resources/messages/api/workbook.properties diff --git a/api/src/test/kotlin/com/few/api/web/controller/ControllerTestContainerInitializer.kt b/api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestContainerInitializer.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/ControllerTestContainerInitializer.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestContainerInitializer.kt index fdbe8c5da..9bd53f297 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/ControllerTestContainerInitializer.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestContainerInitializer.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller +package com.few.api.config.web.controller import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.context.ApplicationContextInitializer diff --git a/api/src/test/kotlin/com/few/api/web/controller/ControllerTestSpec.kt b/api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestSpec.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/ControllerTestSpec.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestSpec.kt index a416af423..f6c608530 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/ControllerTestSpec.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/ControllerTestSpec.kt @@ -1,11 +1,11 @@ -package com.few.api.web.controller +package com.few.api.config.web.controller import com.fasterxml.jackson.databind.ObjectMapper import com.few.api.ApiMain -import com.few.api.domain.admin.document.usecase.* +import com.few.api.domain.admin.usecase.* import com.few.api.domain.article.usecase.ReadArticleUseCase import com.few.api.domain.article.usecase.BrowseArticlesUseCase -import com.few.api.domain.log.AddApiLogUseCase +import com.few.api.domain.log.usecase.AddApiLogUseCase import com.few.api.domain.member.usecase.SaveMemberUseCase import com.few.api.domain.member.usecase.TokenUseCase import com.few.api.domain.problem.usecase.BrowseProblemsUseCase @@ -19,7 +19,6 @@ import com.few.api.domain.subscription.usecase.UnsubscribeWorkbookUseCase import com.few.api.domain.workbook.article.usecase.ReadWorkBookArticleUseCase import com.few.api.domain.workbook.usecase.BrowseWorkbooksUseCase import com.few.api.domain.workbook.usecase.ReadWorkbookUseCase -import com.few.api.security.token.TokenResolver import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs @@ -30,6 +29,7 @@ import org.springframework.restdocs.RestDocumentationExtension import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration import org.springframework.test.web.servlet.MockMvc +import security.TokenResolver @ActiveProfiles(value = ["test", "new"]) @AutoConfigureRestDocs diff --git a/api/src/test/kotlin/com/few/api/web/controller/TestTokenUserDetailsService.kt b/api/src/test/kotlin/com/few/api/config/web/controller/TestTokenUserDetailsService.kt similarity index 77% rename from api/src/test/kotlin/com/few/api/web/controller/TestTokenUserDetailsService.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/TestTokenUserDetailsService.kt index b55b5600e..38375bed7 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/TestTokenUserDetailsService.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/TestTokenUserDetailsService.kt @@ -1,10 +1,10 @@ -package com.few.api.web.controller +package com.few.api.config.web.controller -import com.few.api.security.authentication.authority.Roles -import com.few.api.security.authentication.token.TokenUserDetails import org.springframework.boot.test.context.TestComponent import org.springframework.security.core.userdetails.UserDetails import org.springframework.security.core.userdetails.UserDetailsService +import security.Roles +import security.TokenUserDetails @TestComponent class TestTokenUserDetailsService : UserDetailsService { diff --git a/api/src/test/kotlin/com/few/api/web/controller/description/Description.kt b/api/src/test/kotlin/com/few/api/config/web/controller/description/Description.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/description/Description.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/description/Description.kt index cd570da85..fe9620531 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/description/Description.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/description/Description.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.description +package com.few.api.config.web.controller.description import com.epages.restdocs.apispec.HeaderDescriptorWithType import com.epages.restdocs.apispec.ResourceDocumentation.headerWithName diff --git a/api/src/test/kotlin/com/few/api/web/controller/helper/ApiDefinitionExtension.kt b/api/src/test/kotlin/com/few/api/config/web/controller/helper/ApiDefinitionExtension.kt similarity index 88% rename from api/src/test/kotlin/com/few/api/web/controller/helper/ApiDefinitionExtension.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/helper/ApiDefinitionExtension.kt index a6948a8cf..b661c1d30 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/helper/ApiDefinitionExtension.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/helper/ApiDefinitionExtension.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.helper +package com.few.api.config.web.controller.helper fun String.toIdentifier(): String { return this + "Api" diff --git a/api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt b/api/src/test/kotlin/com/few/api/config/web/controller/helper/PayloadDocumentationExtension.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt rename to api/src/test/kotlin/com/few/api/config/web/controller/helper/PayloadDocumentationExtension.kt index d7b24f436..9605cd7ce 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/helper/PayloadDocumentationExtension.kt @@ -1,4 +1,4 @@ -package com.few.api.web.controller.helper +package com.few.api.config.web.controller.helper import org.springframework.restdocs.payload.FieldDescriptor import org.springframework.restdocs.payload.JsonFieldType diff --git a/api/src/test/kotlin/com/few/api/web/controller/admin/AdminControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminControllerTest.kt similarity index 96% rename from api/src/test/kotlin/com/few/api/web/controller/admin/AdminControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/admin/controller/AdminControllerTest.kt index d4567fd68..0dfee2a62 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/admin/AdminControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminControllerTest.kt @@ -1,14 +1,14 @@ -package com.few.api.web.controller.admin +package com.few.api.domain.admin.controller import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema -import com.few.api.domain.admin.document.usecase.dto.* -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.admin.request.* -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.data.common.code.CategoryType +import com.few.api.config.web.controller.helper.* +import com.few.api.domain.admin.controller.request.* +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.admin.usecase.dto.* +import com.few.api.domain.common.vo.CategoryType import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.doNothing @@ -41,7 +41,8 @@ class AdminControllerTest : ControllerTestSpec() { val mainImageUrl = URL("http://localhost:8080") val category = CategoryType.fromCode(0)!!.name val description = "description" - val request = AddWorkbookRequest(title, mainImageUrl, category, description) + val request = + AddWorkbookRequest(title, mainImageUrl, category, description) val body = objectMapper.writeValueAsString(request) val useCaseIn = AddWorkbookUseCaseIn(title, mainImageUrl, category, description) diff --git a/api/src/test/kotlin/com/few/api/web/controller/article/ArticleControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleControllerTest.kt similarity index 98% rename from api/src/test/kotlin/com/few/api/web/controller/article/ArticleControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/article/controller/ArticleControllerTest.kt index e4a920c80..c76a1710c 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/article/ArticleControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleControllerTest.kt @@ -1,15 +1,15 @@ -package com.few.api.web.controller.article +package com.few.api.domain.article.controller import com.epages.restdocs.apispec.ResourceDocumentation import com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.* import com.few.api.domain.article.usecase.dto.* -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.data.common.code.CategoryType +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.common.vo.CategoryType import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` diff --git a/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt index 5150daeeb..76c70f1d8 100644 --- a/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt @@ -7,9 +7,9 @@ import com.few.api.domain.article.service.ReadArticleWriterRecordService import com.few.api.domain.article.service.dto.BrowseArticleProblemsOutDto import com.few.api.domain.article.service.dto.ReadWriterOutDto import com.few.api.domain.article.usecase.dto.ReadArticleUseCaseIn -import com.few.api.repo.dao.article.ArticleDao -import com.few.api.repo.dao.article.record.SelectArticleRecord -import com.few.data.common.code.CategoryType +import com.few.api.domain.article.repo.ArticleDao +import com.few.api.domain.article.repo.record.SelectArticleRecord +import com.few.api.domain.common.vo.CategoryType import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec diff --git a/api/src/test/kotlin/com/few/api/web/controller/admin/ApiLogControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogControllerTest.kt similarity index 83% rename from api/src/test/kotlin/com/few/api/web/controller/admin/ApiLogControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogControllerTest.kt index 03da8a246..7506f2140 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/admin/ApiLogControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogControllerTest.kt @@ -1,13 +1,15 @@ -package com.few.api.web.controller.admin +package com.few.api.domain.log.controller import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.toIdentifier +import com.few.api.config.web.controller.helper.toRequestSchema +import com.few.api.config.web.controller.helper.toResponseSchema import com.few.api.domain.log.dto.AddApiLogUseCaseIn -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.admin.request.ApiLogRequest -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.domain.log.controller.request.ApiLogRequest +import com.few.api.config.web.controller.description.Description import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post import org.junit.jupiter.api.DisplayName diff --git a/api/src/test/kotlin/com/few/api/web/controller/member/MemberControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/member/controller/MemberControllerTest.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/member/MemberControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/member/controller/MemberControllerTest.kt index 1eeaff20d..abb06d78c 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/member/MemberControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/controller/MemberControllerTest.kt @@ -1,18 +1,18 @@ -package com.few.api.web.controller.member +package com.few.api.domain.member.controller import com.epages.restdocs.apispec.ResourceDocumentation import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.* import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseOut import com.few.api.domain.member.usecase.dto.TokenUseCaseIn import com.few.api.domain.member.usecase.dto.TokenUseCaseOut -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.api.web.controller.member.request.SaveMemberRequest -import com.few.api.web.controller.member.request.TokenRequest +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.member.controller.request.SaveMemberRequest +import com.few.api.domain.member.controller.request.TokenRequest import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` diff --git a/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt index 36ace2ed8..a72f0306a 100644 --- a/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt @@ -1,13 +1,13 @@ package com.few.api.domain.member.usecase -import com.few.api.config.crypto.IdEncryption +import security.IdEncryptor import com.few.api.domain.member.usecase.dto.SaveMemberTxCaseOut import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn import com.few.api.domain.member.usecase.transaction.SaveMemberTxCase -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.query.SelectMemberByEmailNotConsiderDeletedAtQuery -import com.few.api.repo.dao.member.record.MemberIdAndIsDeletedRecord -import com.few.email.service.member.SendAuthEmailService +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.query.SelectMemberByEmailNotConsiderDeletedAtQuery +import com.few.api.domain.member.repo.record.MemberIdAndIsDeletedRecord +import com.few.api.domain.member.email.SendAuthEmailService import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe @@ -19,14 +19,14 @@ import org.mockito.ArgumentMatchers.any class SaveMemberUseCaseTest : BehaviorSpec({ lateinit var memberDao: MemberDao lateinit var sendAuthEmailService: SendAuthEmailService - lateinit var idEncryption: IdEncryption + lateinit var idEncryption: IdEncryptor lateinit var saveMemberTxCase: SaveMemberTxCase lateinit var useCase: SaveMemberUseCase beforeContainer { memberDao = mockk() sendAuthEmailService = mockk() - idEncryption = mockk() + idEncryption = mockk() saveMemberTxCase = mockk() useCase = SaveMemberUseCase(memberDao, sendAuthEmailService, idEncryption, saveMemberTxCase) } diff --git a/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt index 9f0133b0d..b9e0d4109 100644 --- a/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt @@ -1,33 +1,33 @@ package com.few.api.domain.member.usecase -import com.few.api.config.crypto.IdEncryption +import com.few.api.domain.common.vo.MemberType +import security.IdEncryptor import com.few.api.domain.member.usecase.dto.TokenUseCaseIn -import com.few.api.repo.dao.member.MemberDao -import com.few.api.repo.dao.member.command.UpdateMemberTypeCommand -import com.few.api.repo.dao.member.record.MemberEmailAndTypeRecord -import com.few.api.security.token.AuthToken -import com.few.api.security.token.TokenGenerator -import com.few.api.security.token.TokenResolver -import com.few.data.common.code.MemberType +import com.few.api.domain.member.repo.MemberDao +import com.few.api.domain.member.repo.command.UpdateMemberTypeCommand +import com.few.api.domain.member.repo.record.MemberEmailAndTypeRecord import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import security.AuthToken +import security.TokenGenerator +import security.TokenResolver class TokenUseCaseTest : BehaviorSpec({ lateinit var tokenGenerator: TokenGenerator lateinit var tokenResolver: TokenResolver lateinit var memberDao: MemberDao - lateinit var idEncryption: IdEncryption + lateinit var idEncryption: IdEncryptor lateinit var useCase: TokenUseCase beforeContainer { tokenGenerator = mockk() tokenResolver = mockk() memberDao = mockk() - idEncryption = mockk() + idEncryption = mockk() useCase = TokenUseCase(tokenGenerator, tokenResolver, memberDao, idEncryption) } diff --git a/api/src/test/kotlin/com/few/api/web/controller/problem/ProblemControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemControllerTest.kt similarity index 97% rename from api/src/test/kotlin/com/few/api/web/controller/problem/ProblemControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemControllerTest.kt index 150f8bf1f..eefeb3162 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/problem/ProblemControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemControllerTest.kt @@ -1,14 +1,14 @@ -package com.few.api.web.controller.problem +package com.few.api.domain.problem.controller import com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.* import com.few.api.domain.problem.usecase.dto.* -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.api.web.controller.problem.request.CheckProblemRequest +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.problem.controller.request.CheckProblemRequest import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt index 6a75891cb..00115ab0c 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt @@ -1,8 +1,8 @@ package com.few.api.domain.problem.usecase import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseIn -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.record.ProblemIdsRecord +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.record.ProblemIdsRecord import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt index c9ada1d0f..1dfbe36cc 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt @@ -1,13 +1,13 @@ package com.few.api.domain.problem.usecase -import com.few.api.domain.problem.service.ArticleService -import com.few.api.domain.problem.service.SubscriptionService +import com.few.api.domain.problem.service.ProblemArticleService +import com.few.api.domain.problem.service.ProblemSubscriptionService import com.few.api.domain.problem.service.dto.SubscriptionProgressOutDto import com.few.api.domain.problem.usecase.dto.BrowseUndoneProblemsUseCaseIn -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.SubmitHistoryDao -import com.few.api.repo.dao.problem.record.ProblemIdAndArticleIdRecord -import com.few.api.repo.dao.problem.record.SubmittedProblemIdsRecord +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.SubmitHistoryDao +import com.few.api.domain.problem.repo.record.ProblemIdAndArticleIdRecord +import com.few.api.domain.problem.repo.record.SubmittedProblemIdsRecord import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.mockk.every @@ -16,17 +16,17 @@ import io.mockk.verify class BrowseUndoneProblemsUseCaseTest : BehaviorSpec({ lateinit var problemDao: ProblemDao - lateinit var subscriptionService: SubscriptionService - lateinit var articleService: ArticleService + lateinit var problemSubscriptionService: ProblemSubscriptionService + lateinit var problemArticleService: ProblemArticleService lateinit var submitHistoryDao: SubmitHistoryDao lateinit var useCase: BrowseUndoneProblemsUseCase beforeContainer { problemDao = mockk() - subscriptionService = mockk() - articleService = mockk() + problemSubscriptionService = mockk() + problemArticleService = mockk() submitHistoryDao = mockk() - useCase = BrowseUndoneProblemsUseCase(problemDao, subscriptionService, articleService, submitHistoryDao) + useCase = BrowseUndoneProblemsUseCase(problemDao, problemSubscriptionService, problemArticleService, submitHistoryDao) } given("밀린 문제 ID 조회 요청이 온 상황에서") { @@ -34,14 +34,14 @@ class BrowseUndoneProblemsUseCaseTest : BehaviorSpec({ val useCaseIn = BrowseUndoneProblemsUseCaseIn(memberId = memberId) `when`("밀린 문제가 존재할 경우") { - every { subscriptionService.browseWorkbookIdAndProgress(any()) } returns listOf( + every { problemSubscriptionService.browseWorkbookIdAndProgress(any()) } returns listOf( SubscriptionProgressOutDto(1L, 3), SubscriptionProgressOutDto(2L, 3), SubscriptionProgressOutDto(3L, 5), SubscriptionProgressOutDto(4L, 7) ) - every { articleService.browseArticleIdByWorkbookIdLimitDay(any()) } returns listOf(1L, 2L) + every { problemArticleService.browseArticleIdByWorkbookIdLimitDay(any()) } returns listOf(1L, 2L) every { problemDao.selectProblemIdByArticleIds(any()) } returns listOf( ProblemIdAndArticleIdRecord(1L, 2L), @@ -58,17 +58,17 @@ class BrowseUndoneProblemsUseCaseTest : BehaviorSpec({ then("밀린 문제 ID 목록을 반환한다") { useCase.execute(useCaseIn) - verify(exactly = 1) { subscriptionService.browseWorkbookIdAndProgress(any()) } - verify(exactly = 4) { articleService.browseArticleIdByWorkbookIdLimitDay(any()) } + verify(exactly = 1) { problemSubscriptionService.browseWorkbookIdAndProgress(any()) } + verify(exactly = 4) { problemArticleService.browseArticleIdByWorkbookIdLimitDay(any()) } verify(exactly = 1) { problemDao.selectProblemIdByArticleIds(any()) } verify(exactly = 1) { submitHistoryDao.selectProblemIdByProblemIds(any()) } } } `when`("구독중이 워크북이 없을 경우") { - every { subscriptionService.browseWorkbookIdAndProgress(any()) } returns emptyList() + every { problemSubscriptionService.browseWorkbookIdAndProgress(any()) } returns emptyList() - every { articleService.browseArticleIdByWorkbookIdLimitDay(any()) } returns listOf(1L, 2L) + every { problemArticleService.browseArticleIdByWorkbookIdLimitDay(any()) } returns listOf(1L, 2L) every { problemDao.selectProblemIdByArticleIds(any()) } returns listOf( ProblemIdAndArticleIdRecord(1L, 2L), @@ -85,8 +85,8 @@ class BrowseUndoneProblemsUseCaseTest : BehaviorSpec({ then("에러를 반환한다") { shouldThrow { useCase.execute(useCaseIn) } - verify(exactly = 1) { subscriptionService.browseWorkbookIdAndProgress(any()) } - verify(exactly = 0) { articleService.browseArticleIdByWorkbookIdLimitDay(any()) } + verify(exactly = 1) { problemSubscriptionService.browseWorkbookIdAndProgress(any()) } + verify(exactly = 0) { problemArticleService.browseArticleIdByWorkbookIdLimitDay(any()) } verify(exactly = 0) { problemDao.selectProblemIdByArticleIds(any()) } verify(exactly = 0) { submitHistoryDao.selectProblemIdByProblemIds(any()) } } diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt index 0a3ffd12f..8b1c59911 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt @@ -1,9 +1,9 @@ package com.few.api.domain.problem.usecase import com.few.api.domain.problem.usecase.dto.CheckProblemUseCaseIn -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.SubmitHistoryDao -import com.few.api.repo.dao.problem.record.SelectProblemAnswerRecord +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.SubmitHistoryDao +import com.few.api.domain.problem.repo.record.SelectProblemAnswerRecord import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt index 79acdfdf6..a119d6785 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt @@ -1,11 +1,11 @@ package com.few.api.domain.problem.usecase import com.few.api.domain.problem.usecase.dto.ReadProblemUseCaseIn -import com.few.api.repo.dao.problem.ProblemDao -import com.few.api.repo.dao.problem.record.SelectProblemRecord -import com.few.api.repo.dao.problem.support.Content -import com.few.api.repo.dao.problem.support.Contents -import com.few.api.repo.dao.problem.support.ContentsJsonMapper +import com.few.api.domain.problem.repo.ProblemDao +import com.few.api.domain.problem.repo.record.SelectProblemRecord +import com.few.api.domain.problem.repo.support.Content +import com.few.api.domain.problem.repo.support.Contents +import com.few.api.domain.problem.repo.support.ContentsJsonMapper import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe diff --git a/api/src/test/kotlin/com/few/api/web/controller/subscription/SubscriptionControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionControllerTest.kt similarity index 97% rename from api/src/test/kotlin/com/few/api/web/controller/subscription/SubscriptionControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionControllerTest.kt index b8136735e..9079f9c62 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/subscription/SubscriptionControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionControllerTest.kt @@ -1,19 +1,19 @@ -package com.few.api.web.controller.subscription +package com.few.api.domain.subscription.controller import com.epages.restdocs.apispec.ResourceDocumentation import com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.subscription.request.UnsubscribeWorkbookRequest +import com.few.api.config.web.controller.helper.* +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.subscription.controller.request.UnsubscribeWorkbookRequest import com.few.api.domain.subscription.usecase.dto.* -import com.few.api.web.controller.helper.* -import com.few.api.web.controller.subscription.request.UpdateSubscriptionDayRequest -import com.few.api.web.controller.subscription.request.UpdateSubscriptionTimeRequest -import com.few.api.web.support.DayCode -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookStatus +import com.few.api.domain.subscription.controller.request.UpdateSubscriptionDayRequest +import com.few.api.domain.subscription.controller.request.UpdateSubscriptionTimeRequest +import com.few.api.domain.common.vo.DayCode +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookStatus import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.doNothing diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt index 11f0794ad..0f59a6169 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt @@ -6,12 +6,12 @@ import com.few.api.domain.subscription.service.SubscriptionWorkbookService import com.few.api.domain.subscription.usecase.dto.BrowseSubscribeWorkbooksUseCaseIn import com.few.api.domain.subscription.usecase.dto.MainCardSubscribeWorkbookDetail import com.few.api.domain.subscription.usecase.dto.MyPageSubscribeWorkbookDetail -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.record.MemberWorkbookSubscriptionStatusRecord -import com.few.api.repo.dao.subscription.record.SubscriptionSendStatusRecord -import com.few.api.web.support.DayCode -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookStatus +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.record.MemberWorkbookSubscriptionStatusRecord +import com.few.api.domain.subscription.repo.record.SubscriptionSendStatusRecord +import com.few.api.domain.common.vo.DayCode +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookStatus import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt index 61ba5bf79..4f2ed9de7 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt @@ -1,11 +1,11 @@ package com.few.api.domain.subscription.usecase +import com.few.api.domain.common.vo.DayCode import com.few.api.domain.subscription.event.dto.WorkbookSubscriptionEvent import com.few.api.domain.subscription.usecase.dto.SubscribeWorkbookUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao -import com.few.api.repo.dao.subscription.record.SubscriptionSendStatus -import com.few.api.repo.dao.subscription.record.WorkbookSubscriptionStatus -import com.few.data.common.code.DayCode +import com.few.api.domain.subscription.repo.SubscriptionDao +import com.few.api.domain.subscription.repo.record.SubscriptionSendStatus +import com.few.api.domain.subscription.repo.record.WorkbookSubscriptionStatus import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt index 37b7ea8dd..6a31b7e2b 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt @@ -1,7 +1,7 @@ package com.few.api.domain.subscription.usecase import com.few.api.domain.subscription.usecase.dto.UnsubscribeAllUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao +import com.few.api.domain.subscription.repo.SubscriptionDao import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.core.spec.style.BehaviorSpec import io.mockk.every diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt index 94224f0bb..4b479eb7b 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt @@ -1,11 +1,10 @@ package com.few.api.domain.subscription.usecase import com.few.api.domain.subscription.usecase.dto.UnsubscribeWorkbookUseCaseIn -import com.few.api.repo.dao.subscription.SubscriptionDao +import com.few.api.domain.subscription.repo.SubscriptionDao import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.core.spec.style.BehaviorSpec import io.mockk.* -import org.junit.jupiter.api.Assertions.* class UnsubscribeWorkbookUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleControllerTest.kt similarity index 95% rename from api/src/test/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleControllerTest.kt index 0ce3c75c2..09622f444 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/workbook/article/WorkBookArticleControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleControllerTest.kt @@ -1,16 +1,16 @@ -package com.few.api.web.controller.workbook.article +package com.few.api.domain.workbook.article.controller import com.epages.restdocs.apispec.ResourceDocumentation import com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.* import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleUseCaseIn import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleOut import com.few.api.domain.workbook.article.dto.WriterDetail -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.data.common.code.CategoryType +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.common.vo.CategoryType import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` diff --git a/api/src/test/kotlin/com/few/api/web/controller/workbook/WorkBookControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookControllerTest.kt similarity index 97% rename from api/src/test/kotlin/com/few/api/web/controller/workbook/WorkBookControllerTest.kt rename to api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookControllerTest.kt index 1126263cf..8ce590c47 100644 --- a/api/src/test/kotlin/com/few/api/web/controller/workbook/WorkBookControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookControllerTest.kt @@ -1,18 +1,18 @@ -package com.few.api.web.controller.workbook +package com.few.api.domain.workbook.controller import com.epages.restdocs.apispec.ResourceDocumentation import com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName import com.epages.restdocs.apispec.ResourceDocumentation.resource import com.epages.restdocs.apispec.ResourceSnippetParameters import com.epages.restdocs.apispec.Schema +import com.few.api.config.web.controller.helper.* import com.few.api.domain.workbook.usecase.dto.* -import com.few.api.web.controller.ControllerTestSpec -import com.few.api.web.controller.description.Description -import com.few.api.web.controller.helper.* -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookCategory +import com.few.api.config.web.controller.ControllerTestSpec +import com.few.api.config.web.controller.description.Description +import com.few.api.domain.common.vo.CategoryType +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookCategory import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get -import com.few.data.common.code.CategoryType import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt index 54c704948..45a8f499f 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt @@ -1,15 +1,15 @@ package com.few.api.domain.workbook.usecase +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.service.WorkbookMemberService import com.few.api.domain.workbook.service.WorkbookSubscribeService import com.few.api.domain.workbook.service.dto.BrowseMemberSubscribeWorkbooksOutDto import com.few.api.domain.workbook.service.dto.WriterMappedWorkbookOutDto import com.few.api.domain.workbook.usecase.dto.BrowseWorkbooksUseCaseIn -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecordWithSubscriptionCount -import com.few.api.web.support.ViewCategory -import com.few.api.web.support.WorkBookCategory -import com.few.data.common.code.CategoryType +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecordWithSubscriptionCount +import com.few.api.domain.common.vo.ViewCategory +import com.few.api.domain.common.vo.WorkBookCategory import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe import io.mockk.every diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt index add8efdbc..0cc4ec2fd 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt @@ -1,13 +1,13 @@ package com.few.api.domain.workbook.usecase +import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.service.WorkbookArticleService import com.few.api.domain.workbook.service.WorkbookMemberService import com.few.api.domain.workbook.service.dto.WorkBookArticleOutDto import com.few.api.domain.workbook.service.dto.WriterOutDto import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseIn -import com.few.api.repo.dao.workbook.WorkbookDao -import com.few.api.repo.dao.workbook.record.SelectWorkBookRecord -import com.few.data.common.code.CategoryType +import com.few.api.domain.workbook.repo.WorkbookDao +import com.few.api.domain.workbook.repo.record.SelectWorkBookRecord import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe diff --git a/api/src/test/resources/application-test.yml b/api/src/test/resources/application-test.yml index a667b419a..b0aee2ece 100644 --- a/api/src/test/resources/application-test.yml +++ b/api/src/test/resources/application-test.yml @@ -54,24 +54,19 @@ client: connect: 5000 read: 5000 -webhook: - discord: https://discord.com/api/webhooks/1234567890/abcdefg - -discord: - thread-pool: - core-pool-size: 5 - max-pool-size: 15 - queue-capacity: 30 - wait-for-tasks-to-complete-on-shutdown: true - await-termination-seconds: 60 - -database: - thread-pool: +thread-pool: + database: core-pool-size: 10 max-pool-size: 30 queue-capacity: 70 wait-for-tasks-to-complete-on-shutdown: true await-termination-seconds: 60 + discord: + core-pool-size: 5 + max-pool-size: 15 + queue-capacity: 30 + wait-for-tasks-to-complete-on-shutdown: true + await-termination-seconds: 60 security: jwt: @@ -80,17 +75,27 @@ security: access: 31557600000 refresh: 31557600000 secretkey: jwtsecretKeyhastolonghowlongidontknow - cors: - path-patterns: "/**" - origin-patterns: "http://localhost:3000" - allowed-methods: "*" - allowed-headers: "*" - exposed-headers: "Set-Cookie, Authorization, Content-Type, X-Requested-With, Accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials" - allow-credentials: true - max-age: 1800 encryption: algorithm: AES secretKey: encryptionsecret transformation: AES/CBC/PKCS5Padding keySize: 128 iv: AAAAAAAAAAAAAAAA + +web: + security: + cors: + path-patterns: "/**" + origin-patterns: "http://localhost:3000" + allowed-methods: "*" + allowed-headers: "*" + exposed-headers: "Set-Cookie, Authorization, Content-Type, X-Requested-With, Accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials" + allow-credentials: true + max-age: 1800 + client: + timeout: + connect: 5000 + read: 5000 + +webhook: + discord: "localhost:8080/webhook/discord/unused" diff --git a/batch/build.gradle.kts b/batch/build.gradle.kts deleted file mode 100644 index 3cd31b458..000000000 --- a/batch/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -tasks.getByName("bootJar") { - enabled = false -} - -tasks.getByName("jar") { - enabled = true -} - -dependencies { - /** module */ - implementation(project(":email")) - - /** mysql */ - implementation("com.mysql:mysql-connector-j") - - /** jooq */ - api("org.springframework.boot:spring-boot-starter-jooq") - jooqCodegen("org.jooq:jooq-meta-extensions:${DependencyVersion.JOOQ}") - - /** test container */ - implementation(platform("org.testcontainers:testcontainers-bom:${DependencyVersion.TEST_CONTAINER}")) - testImplementation("org.testcontainers:mysql") - - /** aspectj */ - implementation("org.aspectj:aspectjweaver") - - /** test flyway */ - testImplementation("org.flywaydb:flyway-core:${DependencyVersion.FLYWAY}") - testImplementation("org.flywaydb:flyway-mysql") -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/config/BatchConfig.kt b/batch/src/main/kotlin/com/few/batch/config/BatchConfig.kt deleted file mode 100644 index 6d34f2bb3..000000000 --- a/batch/src/main/kotlin/com/few/batch/config/BatchConfig.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.few.batch.config - -import com.few.email.config.MailConfig -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Import - -@Configuration -@ComponentScan(basePackages = [BatchConfig.BASE_PACKAGE]) -@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class]) -@Import(MailConfig::class) -class BatchConfig { - companion object { - const val BASE_PACKAGE = "com.few.batch" - const val SERVICE_NAME = "few" - const val MODULE_NAME = "few-batch" - const val BEAN_NAME_PREFIX = "fewBatch" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME - } -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchCategoryType.kt b/batch/src/main/kotlin/com/few/batch/data/common/code/BatchCategoryType.kt deleted file mode 100644 index 98da10bfb..000000000 --- a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchCategoryType.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.few.batch.data.common.code - -/** - * BatchCategoryType is origin from CategoryType in few-data module. - * @see com.few.data.common.code.CategoryType - */ -enum class BatchCategoryType(val code: Byte, val displayName: String) { - ECONOMY(0, "경제"), - IT(10, "IT"), - MARKETING(20, "마케팅"), - LANGUAGE(25, "외국어"), - CULTURE(30, "교양"), - SCIENCE(40, "과학"), - ; - - companion object { - fun fromCode(code: Byte): BatchCategoryType? { - return entries.find { it.code == code } - } - - fun convertToCode(displayName: String): Byte { - return entries.find { it.name == displayName }?.code ?: throw IllegalArgumentException("Invalid category name $displayName") - } - - fun convertToDisplayName(code: Byte): String { - return entries.find { it.code == code }?.displayName ?: throw IllegalArgumentException("Invalid category code $code") - } - } -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchDayCode.kt b/batch/src/main/kotlin/com/few/batch/data/common/code/BatchDayCode.kt deleted file mode 100644 index f9871b232..000000000 --- a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchDayCode.kt +++ /dev/null @@ -1,140 +0,0 @@ -package com.few.batch.data.common.code - -/** - * @see com.few.data.common.code.DayCode - */ -enum class BatchDayCode(val code: String, val days: String) { - MON("0000001", "월"), - TUE("0000010", "화"), - MON_TUE("0000011", "월,화"), - WED("0000100", "수"), - MON_WED("0000101", "월,수"), - TUE_WED("0000110", "화,수"), - MON_TUE_WED("0000111", "월,화,수"), - THU("0001000", "목"), - MON_THU("0001001", "월,목"), - TUE_THU("0001010", "화,목"), - MON_TUE_THU("0001011", "월,화,목"), - WED_THU("0001100", "수,목"), - MON_WED_THU("0001101", "월,수,목"), - TUE_WED_THU("0001110", "화,수,목"), - MON_TUE_WED_THU("0001111", "월,화,수,목"), - FRI("0010000", "금"), - MON_FRI("0010001", "월,금"), - TUE_FRI("0010010", "화,금"), - MON_TUE_FRI("0010011", "월,화,금"), - WED_FRI("0010100", "수,금"), - MON_WED_FRI("0010101", "월,수,금"), - TUE_WED_FRI("0010110", "화,수,금"), - MON_TUE_WED_FRI("0010111", "월,화,수,금"), - THU_FRI("0011000", "목,금"), - MON_THU_FRI("0011001", "월,목,금"), - TUE_THU_FRI("0011010", "화,목,금"), - MON_TUE_THU_FRI("0011011", "월,화,목,금"), - WED_THU_FRI("0011100", "수,목,금"), - MON_WED_THU_FRI("0011101", "월,수,목,금"), - TUE_WED_THU_FRI("0011110", "화,수,목,금"), - MON_TUE_WED_THU_FRI("0011111", "월,화,수,목,금"), - SAT("0100000", "토"), - MON_SAT("0100001", "월,토"), - TUE_SAT("0100010", "화,토"), - MON_TUE_SAT("0100011", "월,화,토"), - WED_SAT("0100100", "수,토"), - MON_WED_SAT("0100101", "월,수,토"), - TUE_WED_SAT("0100110", "화,수,토"), - MON_TUE_WED_SAT("0100111", "월,화,수,토"), - THU_SAT("0101000", "목,토"), - MON_THU_SAT("0101001", "월,목,토"), - TUE_THU_SAT("0101010", "화,목,토"), - MON_TUE_THU_SAT("0101011", "월,화,목,토"), - WED_THU_SAT("0101100", "수,목,토"), - MON_WED_THU_SAT("0101101", "월,수,목,토"), - TUE_WED_THU_SAT("0101110", "화,수,목,토"), - MON_TUE_WED_THU_SAT("0101111", "월,화,수,목,토"), - FRI_SAT("0110000", "금,토"), - MON_FRI_SAT("0110001", "월,금,토"), - TUE_FRI_SAT("0110010", "화,금,토"), - MON_TUE_FRI_SAT("0110011", "월,화,금,토"), - WED_FRI_SAT("0110100", "수,금,토"), - MON_WED_FRI_SAT("0110101", "월,수,금,토"), - TUE_WED_FRI_SAT("0110110", "화,수,금,토"), - MON_TUE_WED_FRI_SAT("0110111", "월,화,수,금,토"), - THU_FRI_SAT("0111000", "목,금,토"), - MON_THU_FRI_SAT("0111001", "월,목,금,토"), - TUE_THU_FRI_SAT("0111010", "화,목,금,토"), - MON_TUE_THU_FRI_SAT("0111011", "월,화,목,금,토"), - WED_THU_FRI_SAT("0111100", "수,목,금,토"), - MON_WED_THU_FRI_SAT("0111101", "월,수,목,금,토"), - TUE_WED_THU_FRI_SAT("0111110", "화,수,목,금,토"), - MON_TUE_WED_THU_FRI_SAT("0111111", "월,화,수,목,금,토"), - SUN("1000000", "일"), - MON_SUN("1000001", "월,일"), - TUE_SUN("1000010", "화,일"), - MON_TUE_SUN("1000011", "월,화,일"), - WED_SUN("1000100", "수,일"), - MON_WED_SUN("1000101", "월,수,일"), - TUE_WED_SUN("1000110", "화,수,일"), - MON_TUE_WED_SUN("1000111", "월,화,수,일"), - THU_SUN("1001000", "목,일"), - MON_THU_SUN("1001001", "월,목,일"), - TUE_THU_SUN("1001010", "화,목,일"), - MON_TUE_THU_SUN("1001011", "월,화,목,일"), - WED_THU_SUN("1001100", "수,목,일"), - MON_WED_THU_SUN("1001101", "월,수,목,일"), - TUE_WED_THU_SUN("1001110", "화,수,목,일"), - MON_TUE_WED_THU_SUN("1001111", "월,화,수,목,일"), - FRI_SUN("1010000", "금,일"), - MON_FRI_SUN("1010001", "월,금,일"), - TUE_FRI_SUN("1010010", "화,금,일"), - MON_TUE_FRI_SUN("1010011", "월,화,금,일"), - WED_FRI_SUN("1010100", "수,금,일"), - MON_WED_FRI_SUN("1010101", "월,수,금,일"), - TUE_WED_FRI_SUN("1010110", "화,수,금,일"), - MON_TUE_WED_FRI_SUN("1010111", "월,화,수,금,일"), - THU_FRI_SUN("1011000", "목,금,일"), - MON_THU_FRI_SUN("1011001", "월,목,금,일"), - TUE_THU_FRI_SUN("1011010", "화,목,금,일"), - MON_TUE_THU_FRI_SUN("1011011", "월,화,목,금,일"), - WED_THU_FRI_SUN("1011100", "수,목,금,일"), - MON_WED_THU_FRI_SUN("1011101", "월,수,목,금,일"), - TUE_WED_THU_FRI_SUN("1011110", "화,수,목,금,일"), - MON_TUE_WED_THU_FRI_SUN("1011111", "월,화,수,목,금,일"), - SAT_SUN("1100000", "토,일"), - MON_SAT_SUN("1100001", "월,토,일"), - TUE_SAT_SUN("1100010", "화,토,일"), - MON_TUE_SAT_SUN("1100011", "월,화,토,일"), - WED_SAT_SUN("1100100", "수,토,일"), - MON_WED_SAT_SUN("1100101", "월,수,토,일"), - TUE_WED_SAT_SUN("1100110", "화,수,토,일"), - MON_TUE_WED_SAT_SUN("1100111", "월,화,수,토,일"), - THU_SAT_SUN("1101000", "목,토,일"), - MON_THU_SAT_SUN("1101001", "월,목,토,일"), - TUE_THU_SAT_SUN("1101010", "화,목,토,일"), - MON_TUE_THU_SAT_SUN("1101011", "월,화,목,토,일"), - WED_THU_SAT_SUN("1101100", "수,목,토,일"), - MON_WED_THU_SAT_SUN("1101101", "월,수,목,토,일"), - TUE_WED_THU_SAT_SUN("1101110", "화,수,목,토,일"), - MON_TUE_WED_THU_SAT_SUN("1101111", "월,화,수,목,토,일"), - FRI_SAT_SUN("1110000", "금,토,일"), - MON_FRI_SAT_SUN("1110001", "월,금,토,일"), - TUE_FRI_SAT_SUN("1110010", "화,금,토,일"), - MON_TUE_FRI_SAT_SUN("1110011", "월,화,금,토,일"), - WED_FRI_SAT_SUN("1110100", "수,금,토,일"), - MON_WED_FRI_SAT_SUN("1110101", "월,수,금,토,일"), - TUE_WED_FRI_SAT_SUN("1110110", "화,수,금,토,일"), - MON_TUE_WED_FRI_SAT_SUN("1110111", "월,화,수,금,토,일"), - THU_FRI_SAT_SUN("1111000", "목,금,토,일"), - MON_THU_FRI_SAT_SUN("1111001", "월,목,금,토,일"), - TUE_THU_FRI_SAT_SUN("1111010", "화,목,금,토,일"), - MON_TUE_THU_FRI_SAT_SUN("1111011", "월,화,목,금,토,일"), - WED_THU_FRI_SAT_SUN("1111100", "수,목,금,토,일"), - MON_WED_THU_FRI_SAT_SUN("1111101", "월,수,목,금,토,일"), - TUE_WED_THU_FRI_SAT_SUN("1111110", "화,수,목,금,토,일"), - MON_TUE_WED_THU_FRI_SAT_SUN("1111111", "월,화,수,목,금,토,일"), - ; - companion object { - fun fromCode(code: String): BatchDayCode { - return entries.first { it.code == code } - } - } -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchMemberType.kt b/batch/src/main/kotlin/com/few/batch/data/common/code/BatchMemberType.kt deleted file mode 100644 index 7ad920f24..000000000 --- a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchMemberType.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.few.batch.data.common.code - -/** - * BatchMemberType is origin from MemberType in few-data module. - * @see com.few.data.common.code.MemberType - */ -enum class BatchMemberType(val code: Byte, val displayName: String) { - NORMAL(60, "일반멤버"), - ADMIN(0, "어드민멤버"), - WRITER(120, "작가멤버"), - ; - - companion object { - fun fromCode(code: Byte): BatchMemberType? { - return values().find { it.code == code } - } - } -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendEventType.kt b/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendEventType.kt deleted file mode 100644 index e42be88c7..000000000 --- a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendEventType.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.few.batch.data.common.code - -/** - * @see com.few.data.common.code.SendEventType - */ -enum class BatchSendEventType(val code: Byte, val type: String) { - - OPEN(0, "open"), - DELIVERY(1, "delivery"), - CLICK(2, "click"), - SEND(3, "send"), - DELIVERYDELAY(4, "deliverydelay"), - ; - - companion object { - fun fromType(type: String): BatchSendEventType? { - return entries.find { it.type == type } - } - - fun fromCode(code: Byte): BatchSendEventType? { - return entries.find { it.code == code } - } - } -} \ No newline at end of file diff --git a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendType.kt b/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendType.kt deleted file mode 100644 index dd85d8e7c..000000000 --- a/batch/src/main/kotlin/com/few/batch/data/common/code/BatchSendType.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.few.batch.data.common.code - -/** - * @see com.few.data.common.code.SendType - */ -enum class BatchSendType(val code: Byte) { - EMAIL(0), - AWSSES(1), -} \ No newline at end of file diff --git a/batch/src/test/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilterTest.kt b/batch/src/test/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilterTest.kt deleted file mode 100644 index 12b1e9281..000000000 --- a/batch/src/test/kotlin/com/few/batch/service/article/writer/model/ReceiveLastArticleRecordFilterTest.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.few.batch.service.article.writer.model - -import com.few.batch.service.article.dto.WorkBookSubscriberItem -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test -import java.util.stream.IntStream - -class ReceiveLastArticleRecordFilterTest { - - @Test - fun `학습지의 마지막 아티클을 받은 구독자 정보를 필터링 한다`() { - // given - val targetWorkbookId = 1L - val subscriberItemCount = 5 - // 가장 큰 아이디를 가진 구독자는 마지막 아티클을 받은 상태 - val items = IntStream.range(1, 1 + subscriberItemCount).mapToObj { - WorkBookSubscriberItem(it.toLong(), targetWorkbookId, it.toLong() - 1) - }.toList() - val workbooksMappedLastDayCol = mapOf(1L to subscriberItemCount) - - val filter = ReceiveLastArticleRecordFilter(items, workbooksMappedLastDayCol) - - // when - val result = filter.filter() - - // then - assertEquals(1, result.size) - assertEquals(subscriberItemCount.toLong(), result[0].memberId) - assertEquals(targetWorkbookId, result[0].targetWorkBookId) - } -} \ No newline at end of file diff --git a/batch/src/test/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilterTest.kt b/batch/src/test/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilterTest.kt deleted file mode 100644 index f8c3f1003..000000000 --- a/batch/src/test/kotlin/com/few/batch/service/article/writer/model/UpdateProgressRecordFilterTest.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.few.batch.service.article.writer.model - -import com.few.batch.service.article.dto.WorkBookSubscriberItem -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test -import java.util.stream.Collectors.toSet -import java.util.stream.IntStream - -class UpdateProgressRecordFilterTest { - - @Test - fun `진행률을 업데이트할 구독자 정보를 필터링한다`() { - // given - val targetWorkbookId = 1L - val subscriberItemCount = 5 - // 가장 큰 아이디를 가진 구독자는 마지막 아티클을 받은 상태 - val successMemberIds = - IntStream.range(1, 1 + subscriberItemCount).mapToObj { it.toLong() }.collect(toSet()) - val receiveLastDayArticleRecordMemberIds = setOf(subscriberItemCount.toLong()) - val items = (1..subscriberItemCount).map { - WorkBookSubscriberItem(it.toLong(), targetWorkbookId, it.toLong() - 1) - } - - val filter = UpdateProgressRecordFilter(items, successMemberIds, receiveLastDayArticleRecordMemberIds) - - // when - val result = filter.filter() - - // then - assertEquals(4, result.size) - result.forEach { - assertTrue(it.memberId in successMemberIds) - assertFalse(it.memberId in receiveLastDayArticleRecordMemberIds) - } - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7a7ccaf80..bee2721a4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -116,6 +116,9 @@ subprojects { /** Kotlin Logger **/ implementation("io.github.oshai:kotlin-logging-jvm:${DependencyVersion.KOTLIN_LOGGING}") + + /** apache common */ + implementation("org.apache.commons:commons-lang3:${DependencyVersion.COMMONS_LANG3}") } /** copy data migration */ @@ -209,15 +212,13 @@ subprojects { /** do all copy data migration */ tasks.register("copyDataMigrationAll") { - dependsOn(":api-repo:copyDataMigration") - dependsOn(":batch:copyDataMigration") + dependsOn(":api:copyDataMigration") } /** do all jooq codegen */ tasks.register("jooqCodegenAll") { dependsOn("copyDataMigrationAll") - dependsOn(":api-repo:jooqCodegen") - dependsOn(":batch:jooqCodegen") + dependsOn(":api:jooqCodegen") } /** git hooks */ diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index 26de6fd7d..121abae01 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -42,8 +42,9 @@ object DependencyVersion { /** minio */ const val MINIO = "8.5.5" - /** aws-sdk */ + /** aws */ const val AWS_SDK = "1.12.220" + const val AWS_SES = "1.12.765" /** commonmark */ const val COMMONMARK = "0.22.0" @@ -53,4 +54,7 @@ object DependencyVersion { /** Local Cache **/ const val EHCACHE = "3.10.0" + + /** Apache Commons **/ + const val COMMONS_LANG3 = "3.13.0" } diff --git a/data/src/main/kotlin/com/few/data/common/code/DayCode.kt b/data/src/main/kotlin/com/few/data/common/code/DayCode.kt deleted file mode 100644 index ff2da17fb..000000000 --- a/data/src/main/kotlin/com/few/data/common/code/DayCode.kt +++ /dev/null @@ -1,141 +0,0 @@ -package com.few.data.common.code - -/** - * @see com.few.api.web.support.DayCode - * @see com.few.batch.data.common.code.BatchDayCode - */ -enum class DayCode(val code: String, val days: String) { - MON("0000001", "월"), - TUE("0000010", "화"), - MON_TUE("0000011", "월,화"), - WED("0000100", "수"), - MON_WED("0000101", "월,수"), - TUE_WED("0000110", "화,수"), - MON_TUE_WED("0000111", "월,화,수"), - THU("0001000", "목"), - MON_THU("0001001", "월,목"), - TUE_THU("0001010", "화,목"), - MON_TUE_THU("0001011", "월,화,목"), - WED_THU("0001100", "수,목"), - MON_WED_THU("0001101", "월,수,목"), - TUE_WED_THU("0001110", "화,수,목"), - MON_TUE_WED_THU("0001111", "월,화,수,목"), - FRI("0010000", "금"), - MON_FRI("0010001", "월,금"), - TUE_FRI("0010010", "화,금"), - MON_TUE_FRI("0010011", "월,화,금"), - WED_FRI("0010100", "수,금"), - MON_WED_FRI("0010101", "월,수,금"), - TUE_WED_FRI("0010110", "화,수,금"), - MON_TUE_WED_FRI("0010111", "월,화,수,금"), - THU_FRI("0011000", "목,금"), - MON_THU_FRI("0011001", "월,목,금"), - TUE_THU_FRI("0011010", "화,목,금"), - MON_TUE_THU_FRI("0011011", "월,화,목,금"), - WED_THU_FRI("0011100", "수,목,금"), - MON_WED_THU_FRI("0011101", "월,수,목,금"), - TUE_WED_THU_FRI("0011110", "화,수,목,금"), - MON_TUE_WED_THU_FRI("0011111", "월,화,수,목,금"), - SAT("0100000", "토"), - MON_SAT("0100001", "월,토"), - TUE_SAT("0100010", "화,토"), - MON_TUE_SAT("0100011", "월,화,토"), - WED_SAT("0100100", "수,토"), - MON_WED_SAT("0100101", "월,수,토"), - TUE_WED_SAT("0100110", "화,수,토"), - MON_TUE_WED_SAT("0100111", "월,화,수,토"), - THU_SAT("0101000", "목,토"), - MON_THU_SAT("0101001", "월,목,토"), - TUE_THU_SAT("0101010", "화,목,토"), - MON_TUE_THU_SAT("0101011", "월,화,목,토"), - WED_THU_SAT("0101100", "수,목,토"), - MON_WED_THU_SAT("0101101", "월,수,목,토"), - TUE_WED_THU_SAT("0101110", "화,수,목,토"), - MON_TUE_WED_THU_SAT("0101111", "월,화,수,목,토"), - FRI_SAT("0110000", "금,토"), - MON_FRI_SAT("0110001", "월,금,토"), - TUE_FRI_SAT("0110010", "화,금,토"), - MON_TUE_FRI_SAT("0110011", "월,화,금,토"), - WED_FRI_SAT("0110100", "수,금,토"), - MON_WED_FRI_SAT("0110101", "월,수,금,토"), - TUE_WED_FRI_SAT("0110110", "화,수,금,토"), - MON_TUE_WED_FRI_SAT("0110111", "월,화,수,금,토"), - THU_FRI_SAT("0111000", "목,금,토"), - MON_THU_FRI_SAT("0111001", "월,목,금,토"), - TUE_THU_FRI_SAT("0111010", "화,목,금,토"), - MON_TUE_THU_FRI_SAT("0111011", "월,화,목,금,토"), - WED_THU_FRI_SAT("0111100", "수,목,금,토"), - MON_WED_THU_FRI_SAT("0111101", "월,수,목,금,토"), - TUE_WED_THU_FRI_SAT("0111110", "화,수,목,금,토"), - MON_TUE_WED_THU_FRI_SAT("0111111", "월,화,수,목,금,토"), - SUN("1000000", "일"), - MON_SUN("1000001", "월,일"), - TUE_SUN("1000010", "화,일"), - MON_TUE_SUN("1000011", "월,화,일"), - WED_SUN("1000100", "수,일"), - MON_WED_SUN("1000101", "월,수,일"), - TUE_WED_SUN("1000110", "화,수,일"), - MON_TUE_WED_SUN("1000111", "월,화,수,일"), - THU_SUN("1001000", "목,일"), - MON_THU_SUN("1001001", "월,목,일"), - TUE_THU_SUN("1001010", "화,목,일"), - MON_TUE_THU_SUN("1001011", "월,화,목,일"), - WED_THU_SUN("1001100", "수,목,일"), - MON_WED_THU_SUN("1001101", "월,수,목,일"), - TUE_WED_THU_SUN("1001110", "화,수,목,일"), - MON_TUE_WED_THU_SUN("1001111", "월,화,수,목,일"), - FRI_SUN("1010000", "금,일"), - MON_FRI_SUN("1010001", "월,금,일"), - TUE_FRI_SUN("1010010", "화,금,일"), - MON_TUE_FRI_SUN("1010011", "월,화,금,일"), - WED_FRI_SUN("1010100", "수,금,일"), - MON_WED_FRI_SUN("1010101", "월,수,금,일"), - TUE_WED_FRI_SUN("1010110", "화,수,금,일"), - MON_TUE_WED_FRI_SUN("1010111", "월,화,수,금,일"), - THU_FRI_SUN("1011000", "목,금,일"), - MON_THU_FRI_SUN("1011001", "월,목,금,일"), - TUE_THU_FRI_SUN("1011010", "화,목,금,일"), - MON_TUE_THU_FRI_SUN("1011011", "월,화,목,금,일"), - WED_THU_FRI_SUN("1011100", "수,목,금,일"), - MON_WED_THU_FRI_SUN("1011101", "월,수,목,금,일"), - TUE_WED_THU_FRI_SUN("1011110", "화,수,목,금,일"), - MON_TUE_WED_THU_FRI_SUN("1011111", "월,화,수,목,금,일"), - SAT_SUN("1100000", "토,일"), - MON_SAT_SUN("1100001", "월,토,일"), - TUE_SAT_SUN("1100010", "화,토,일"), - MON_TUE_SAT_SUN("1100011", "월,화,토,일"), - WED_SAT_SUN("1100100", "수,토,일"), - MON_WED_SAT_SUN("1100101", "월,수,토,일"), - TUE_WED_SAT_SUN("1100110", "화,수,토,일"), - MON_TUE_WED_SAT_SUN("1100111", "월,화,수,토,일"), - THU_SAT_SUN("1101000", "목,토,일"), - MON_THU_SAT_SUN("1101001", "월,목,토,일"), - TUE_THU_SAT_SUN("1101010", "화,목,토,일"), - MON_TUE_THU_SAT_SUN("1101011", "월,화,목,토,일"), - WED_THU_SAT_SUN("1101100", "수,목,토,일"), - MON_WED_THU_SAT_SUN("1101101", "월,수,목,토,일"), - TUE_WED_THU_SAT_SUN("1101110", "화,수,목,토,일"), - MON_TUE_WED_THU_SAT_SUN("1101111", "월,화,수,목,토,일"), - FRI_SAT_SUN("1110000", "금,토,일"), - MON_FRI_SAT_SUN("1110001", "월,금,토,일"), - TUE_FRI_SAT_SUN("1110010", "화,금,토,일"), - MON_TUE_FRI_SAT_SUN("1110011", "월,화,금,토,일"), - WED_FRI_SAT_SUN("1110100", "수,금,토,일"), - MON_WED_FRI_SAT_SUN("1110101", "월,수,금,토,일"), - TUE_WED_FRI_SAT_SUN("1110110", "화,수,금,토,일"), - MON_TUE_WED_FRI_SAT_SUN("1110111", "월,화,수,금,토,일"), - THU_FRI_SAT_SUN("1111000", "목,금,토,일"), - MON_THU_FRI_SAT_SUN("1111001", "월,목,금,토,일"), - TUE_THU_FRI_SAT_SUN("1111010", "화,목,금,토,일"), - MON_TUE_THU_FRI_SAT_SUN("1111011", "월,화,목,금,토,일"), - WED_THU_FRI_SAT_SUN("1111100", "수,목,금,토,일"), - MON_WED_THU_FRI_SAT_SUN("1111101", "월,수,목,금,토,일"), - TUE_WED_THU_FRI_SAT_SUN("1111110", "화,수,목,금,토,일"), - MON_TUE_WED_THU_FRI_SAT_SUN("1111111", "월,화,수,목,금,토,일"), - ; - companion object { - fun fromCode(code: String): DayCode { - return entries.first { it.code == code } - } - } -} \ No newline at end of file diff --git a/data/src/main/kotlin/com/few/data/common/code/SendType.kt b/data/src/main/kotlin/com/few/data/common/code/SendType.kt deleted file mode 100644 index 7ec20a82a..000000000 --- a/data/src/main/kotlin/com/few/data/common/code/SendType.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.few.data.common.code - -/** - * @see com.few.api.web.support.SendType - * @see com.few.batch.data.common.code.BatchSendType - */ -enum class SendType(val code: Byte) { - EMAIL(0), - AWSSES(1), -} \ No newline at end of file diff --git a/data/src/main/kotlin/com/few/data/config/DataConfig.kt b/data/src/main/kotlin/com/few/data/config/DataConfig.kt deleted file mode 100644 index 1bf66d0b2..000000000 --- a/data/src/main/kotlin/com/few/data/config/DataConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.few.data.config - -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan(basePackages = [DataConfig.BASE_PACKAGE]) -class DataConfig { - companion object { - const val BASE_PACKAGE = "com.few.data" - const val SERVICE_NAME = "few" - const val MODULE_NAME = "few-data" - const val BEAN_NAME_PREFIX = "fewData" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME - } -} \ No newline at end of file diff --git a/data/src/main/kotlin/data/config/DataConfig.kt b/data/src/main/kotlin/data/config/DataConfig.kt new file mode 100644 index 000000000..b03499126 --- /dev/null +++ b/data/src/main/kotlin/data/config/DataConfig.kt @@ -0,0 +1,13 @@ +package data.config + +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration + +@Configuration +@ComponentScan(basePackages = [DataConfig.BASE_PACKAGE]) +class DataConfig { + companion object { + const val BASE_PACKAGE = "data" + const val BEAN_NAME_PREFIX = "data" + } +} \ No newline at end of file diff --git a/email/build.gradle.kts b/email/build.gradle.kts index 4d45874c0..992ec27e4 100644 --- a/email/build.gradle.kts +++ b/email/build.gradle.kts @@ -8,9 +8,9 @@ tasks.getByName("jar") { dependencies { /** starter */ - implementation("org.springframework.boot:spring-boot-starter-mail") - implementation("org.springframework.boot:spring-boot-starter-thymeleaf") + api("org.springframework.boot:spring-boot-starter-mail") + api("org.springframework.boot:spring-boot-starter-thymeleaf") /** aws ses */ - implementation("com.amazonaws:aws-java-sdk-ses:1.12.765") + implementation("com.amazonaws:aws-java-sdk-ses:${DependencyVersion.AWS_SES}") } \ No newline at end of file diff --git a/email/src/main/kotlin/com/few/email/config/MailConfig.kt b/email/src/main/kotlin/com/few/email/config/MailConfig.kt deleted file mode 100644 index 76bc54dfb..000000000 --- a/email/src/main/kotlin/com/few/email/config/MailConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.few.email.config - -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan(basePackages = [MailConfig.BASE_PACKAGE]) -class MailConfig { - - companion object { - const val BASE_PACKAGE = "com.few.email" - const val SERVICE_NAME = "few" - const val MODULE_NAME = "few-email" - const val BEAN_NAME_PREFIX = "fewEmail" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME - } -} \ No newline at end of file diff --git a/email/src/main/kotlin/com/few/email/config/porperty/AwsEmailProviderProperties.kt b/email/src/main/kotlin/com/few/email/config/porperty/AwsEmailProviderProperties.kt deleted file mode 100644 index 491af48f1..000000000 --- a/email/src/main/kotlin/com/few/email/config/porperty/AwsEmailProviderProperties.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.few.email.config.porperty - -import org.springframework.boot.context.properties.ConfigurationProperties - -@ConfigurationProperties(prefix = "spring.mail.provider.aws") -data class AwsEmailProviderProperties( - var accessKey: String = "", - var secretKey: String = "", - var region: String = "", -) \ No newline at end of file diff --git a/email/src/main/kotlin/com/few/email/sender/EmailSender.kt b/email/src/main/kotlin/email/EmailSender.kt similarity index 86% rename from email/src/main/kotlin/com/few/email/sender/EmailSender.kt rename to email/src/main/kotlin/email/EmailSender.kt index a4a47e173..4c51facf5 100644 --- a/email/src/main/kotlin/com/few/email/sender/EmailSender.kt +++ b/email/src/main/kotlin/email/EmailSender.kt @@ -1,7 +1,6 @@ -package com.few.email.sender +package email -import com.few.email.sender.dto.SendMailArgs -import com.few.email.sender.provider.EmailSendProvider +import email.provider.EmailSendProvider import org.springframework.boot.autoconfigure.mail.MailProperties abstract class EmailSender>( diff --git a/email/src/main/kotlin/com/few/email/sender/dto/SendMailArgs.kt b/email/src/main/kotlin/email/SendMailArgs.kt similarity index 81% rename from email/src/main/kotlin/com/few/email/sender/dto/SendMailArgs.kt rename to email/src/main/kotlin/email/SendMailArgs.kt index fb46f2513..7541a1b53 100644 --- a/email/src/main/kotlin/com/few/email/sender/dto/SendMailArgs.kt +++ b/email/src/main/kotlin/email/SendMailArgs.kt @@ -1,4 +1,4 @@ -package com.few.email.sender.dto +package email interface SendMailArgs { val to: String diff --git a/email/src/main/kotlin/email/config/MailConfig.kt b/email/src/main/kotlin/email/config/MailConfig.kt new file mode 100644 index 000000000..d593e69ff --- /dev/null +++ b/email/src/main/kotlin/email/config/MailConfig.kt @@ -0,0 +1,14 @@ +package email.config + +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration + +@Configuration +@ComponentScan(basePackages = [MailConfig.BASE_PACKAGE]) +class MailConfig { + + companion object { + const val BASE_PACKAGE = "email" + const val BEAN_NAME_PREFIX = "email" + } +} \ No newline at end of file diff --git a/email/src/main/kotlin/com/few/email/config/MailSenderConfig.kt b/email/src/main/kotlin/email/config/MailSenderConfig.kt similarity index 94% rename from email/src/main/kotlin/com/few/email/config/MailSenderConfig.kt rename to email/src/main/kotlin/email/config/MailSenderConfig.kt index d7342eddb..2ec5aa389 100644 --- a/email/src/main/kotlin/com/few/email/config/MailSenderConfig.kt +++ b/email/src/main/kotlin/email/config/MailSenderConfig.kt @@ -1,13 +1,14 @@ -package com.few.email.config +package email.config import com.amazonaws.auth.AWSStaticCredentialsProvider import com.amazonaws.auth.BasicAWSCredentials import com.amazonaws.services.simpleemail.AmazonSimpleEmailService import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder -import com.few.email.config.MailConfig.Companion.BEAN_NAME_PREFIX -import com.few.email.config.porperty.AwsEmailProviderProperties +import email.config.MailConfig.Companion.BEAN_NAME_PREFIX +import email.config.properties.AwsEmailProviderProperties import org.springframework.beans.factory.annotation.Value import org.springframework.boot.autoconfigure.mail.MailProperties +import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.mail.javamail.JavaMailSender @@ -72,6 +73,7 @@ class MailSenderConfig { } @Bean(name = [AWS_EMAIL_PROVIDER_PROPERTIES]) + @ConfigurationProperties(prefix = "spring.mail.provider.aws") fun awsProviderProperties(): AwsEmailProviderProperties { return AwsEmailProviderProperties() } diff --git a/email/src/main/kotlin/com/few/email/config/ThymeleafConfig.kt b/email/src/main/kotlin/email/config/ThymeleafConfig.kt similarity index 97% rename from email/src/main/kotlin/com/few/email/config/ThymeleafConfig.kt rename to email/src/main/kotlin/email/config/ThymeleafConfig.kt index bcd76aad7..00ff77815 100644 --- a/email/src/main/kotlin/com/few/email/config/ThymeleafConfig.kt +++ b/email/src/main/kotlin/email/config/ThymeleafConfig.kt @@ -1,4 +1,4 @@ -package com.few.email.config +package email.config import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration diff --git a/email/src/main/kotlin/email/config/properties/AwsEmailProviderProperties.kt b/email/src/main/kotlin/email/config/properties/AwsEmailProviderProperties.kt new file mode 100644 index 000000000..fd47e89c1 --- /dev/null +++ b/email/src/main/kotlin/email/config/properties/AwsEmailProviderProperties.kt @@ -0,0 +1,7 @@ +package email.config.properties + +data class AwsEmailProviderProperties( + var accessKey: String = "", + var secretKey: String = "", + var region: String = "", +) \ No newline at end of file diff --git a/email/src/main/kotlin/com/few/email/sender/provider/ArticleAwsSESEmailSendProvider.kt b/email/src/main/kotlin/email/provider/ArticleAwsSESEmailSendProvider.kt similarity index 92% rename from email/src/main/kotlin/com/few/email/sender/provider/ArticleAwsSESEmailSendProvider.kt rename to email/src/main/kotlin/email/provider/ArticleAwsSESEmailSendProvider.kt index f725045c1..794e0d60a 100644 --- a/email/src/main/kotlin/com/few/email/sender/provider/ArticleAwsSESEmailSendProvider.kt +++ b/email/src/main/kotlin/email/provider/ArticleAwsSESEmailSendProvider.kt @@ -1,4 +1,4 @@ -package com.few.email.sender.provider +package email.provider import com.amazonaws.services.simpleemail.AmazonSimpleEmailService import org.springframework.stereotype.Component diff --git a/email/src/main/kotlin/com/few/email/sender/provider/AwsSESEmailSendProvider.kt b/email/src/main/kotlin/email/provider/AwsSESEmailSendProvider.kt similarity index 98% rename from email/src/main/kotlin/com/few/email/sender/provider/AwsSESEmailSendProvider.kt rename to email/src/main/kotlin/email/provider/AwsSESEmailSendProvider.kt index b649fa16c..f0423df57 100644 --- a/email/src/main/kotlin/com/few/email/sender/provider/AwsSESEmailSendProvider.kt +++ b/email/src/main/kotlin/email/provider/AwsSESEmailSendProvider.kt @@ -1,4 +1,4 @@ -package com.few.email.sender.provider +package email.provider import com.amazonaws.services.simpleemail.AmazonSimpleEmailService import com.amazonaws.services.simpleemail.model.* diff --git a/email/src/main/kotlin/com/few/email/sender/provider/EmailSendProvider.kt b/email/src/main/kotlin/email/provider/EmailSendProvider.kt similarity index 83% rename from email/src/main/kotlin/com/few/email/sender/provider/EmailSendProvider.kt rename to email/src/main/kotlin/email/provider/EmailSendProvider.kt index 85fb4287a..6e050903c 100644 --- a/email/src/main/kotlin/com/few/email/sender/provider/EmailSendProvider.kt +++ b/email/src/main/kotlin/email/provider/EmailSendProvider.kt @@ -1,4 +1,4 @@ -package com.few.email.sender.provider +package email.provider interface EmailSendProvider { /** diff --git a/email/src/main/kotlin/com/few/email/sender/provider/JavaEmailSendProvider.kt b/email/src/main/kotlin/email/provider/JavaEmailSendProvider.kt similarity index 96% rename from email/src/main/kotlin/com/few/email/sender/provider/JavaEmailSendProvider.kt rename to email/src/main/kotlin/email/provider/JavaEmailSendProvider.kt index fd9274d71..69eec426c 100644 --- a/email/src/main/kotlin/com/few/email/sender/provider/JavaEmailSendProvider.kt +++ b/email/src/main/kotlin/email/provider/JavaEmailSendProvider.kt @@ -1,4 +1,4 @@ -package com.few.email.sender.provider +package email.provider import jakarta.mail.MessagingException import jakarta.mail.internet.MimeMessage diff --git a/email/src/test/kotlin/com/few/email/service/SendAEmailTestSpec.kt b/email/src/test/kotlin/com/few/email/service/SendAEmailTestSpec.kt deleted file mode 100644 index 5201ddb3b..000000000 --- a/email/src/test/kotlin/com/few/email/service/SendAEmailTestSpec.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.few.email.service - -import com.few.email.config.MailConfig -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.test.context.ActiveProfiles - -@ActiveProfiles("test") -@SpringBootTest(classes = [MailConfig::class]) -abstract class SendAEmailTestSpec \ No newline at end of file diff --git a/email/src/test/kotlin/com/few/email/service/article/SendArticleEmailServiceTest.kt b/email/src/test/kotlin/com/few/email/service/article/SendArticleEmailServiceTest.kt deleted file mode 100644 index 34b0ab75b..000000000 --- a/email/src/test/kotlin/com/few/email/service/article/SendArticleEmailServiceTest.kt +++ /dev/null @@ -1,128 +0,0 @@ -package com.few.email.service.article - -import com.few.email.service.SendAEmailTestSpec -import com.few.email.service.article.dto.Content -import com.few.email.service.article.dto.SendArticleEmailArgs -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import org.springframework.beans.factory.annotation.Autowired -import java.net.URL -import java.time.LocalDate -import java.time.LocalDateTime - -class SendArticleEmailServiceTest : SendAEmailTestSpec() { - - @Autowired - private lateinit var sendArticleEmailService: SendArticleEmailService - - @Test - @Disabled - fun `아티클 이메일 전송 테스트`() { - // given - val args = SendArticleEmailArgs( - to = "test@gmail.com", - subject = "테스트" + LocalDateTime.now(), - content = Content( - articleLink = URL("https://www.google.com"), - currentDate = LocalDate.now(), - category = "경제", - articleDay = 1, - articleTitle = "제목", - writerName = "작성자", - writerLink = URL("https://www.google.com"), - articleContent = "내용", - problemLink = URL("https://www.google.com"), - unsubscribeLink = URL("https://www.google.com") - ), - template = "article" - ) - - // when - val result = sendArticleEmailService.send(args) - - // then - // check Mailtrap - } - - fun getStyle(): String { - return " * {\n" + - " box-sizing: border-box;\n" + - " }\n" + - "\n" + - " body {\n" + - " margin: 0;\n" + - " padding: 0;\n" + - " }\n" + - "\n" + - " a[x-apple-data-detectors] {\n" + - " color: inherit !important;\n" + - " text-decoration: inherit !important;\n" + - " }\n" + - "\n" + - " #MessageViewBody a {\n" + - " color: inherit;\n" + - " text-decoration: none;\n" + - " }\n" + - "\n" + - " p {\n" + - " line-height: inherit\n" + - " }\n" + - "\n" + - " .desktop_hide,\n" + - " .desktop_hide table {\n" + - " mso-hide: all;\n" + - " display: none;\n" + - " max-height: 0px;\n" + - " overflow: hidden;\n" + - " }\n" + - "\n" + - " .image_block img+div {\n" + - " display: none;\n" + - " }\n" + - "\n" + - " @media (max-width:720px) {\n" + - " .desktop_hide table.icons-inner {\n" + - " display: inline-block !important;\n" + - " }\n" + - "\n" + - " .icons-inner {\n" + - " text-align: center;\n" + - " }\n" + - "\n" + - " .icons-inner td {\n" + - " margin: 0 auto;\n" + - " }\n" + - "\n" + - " .image_block div.fullWidth {\n" + - " max-width: 100% !important;\n" + - " }\n" + - "\n" + - " .mobile_hide {\n" + - " display: none;\n" + - " }\n" + - "\n" + - " .row-content {\n" + - " width: 100% !important;\n" + - " }\n" + - "\n" + - " .stack .column {\n" + - " width: 100%;\n" + - " display: block;\n" + - " }\n" + - "\n" + - " .mobile_hide {\n" + - " min-height: 0;\n" + - " max-height: 0;\n" + - " max-width: 0;\n" + - " overflow: hidden;\n" + - " font-size: 0px;\n" + - " }\n" + - "\n" + - " .desktop_hide,\n" + - " .desktop_hide table {\n" + - " display: table !important;\n" + - " max-height: none !important;\n" + - " }\n" + - " }" - } -} \ No newline at end of file diff --git a/email/src/test/resources/application-test.yml b/email/src/test/resources/application-test.yml deleted file mode 100644 index 06f5a2520..000000000 --- a/email/src/test/resources/application-test.yml +++ /dev/null @@ -1,16 +0,0 @@ -spring: - mail: - host: sandbox.smtp.mailtrap.io - protocol: smtp - port: 25 - username: 36a1889f02050c - password: ${EMAIL_PASSWORD} - properties: - mail: - smtp: - auth: true - debug: true - starttls: - enable: true - EnableSSL: - enable: true diff --git a/email/src/test/resources/templates/test.html b/email/src/test/resources/templates/test.html deleted file mode 100644 index 7d8c63623..000000000 --- a/email/src/test/resources/templates/test.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/security/build.gradle.kts b/security/build.gradle.kts new file mode 100644 index 000000000..ad4fca90b --- /dev/null +++ b/security/build.gradle.kts @@ -0,0 +1,18 @@ + + +tasks.getByName("bootJar") { + enabled = false +} + +tasks.getByName("jar") { + enabled = true +} + +dependencies { + api("org.springframework.boot:spring-boot-starter-security") + + /** jwt */ + implementation("io.jsonwebtoken:jjwt-api:${DependencyVersion.JWT}") + implementation("io.jsonwebtoken:jjwt-impl:${DependencyVersion.JWT}") + implementation("io.jsonwebtoken:jjwt-jackson:${DependencyVersion.JWT}") +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/token/AuthToken.kt b/security/src/main/kotlin/security/AuthToken.kt similarity index 70% rename from api/src/main/kotlin/com/few/api/security/token/AuthToken.kt rename to security/src/main/kotlin/security/AuthToken.kt index a143f6a99..354b35e32 100644 --- a/api/src/main/kotlin/com/few/api/security/token/AuthToken.kt +++ b/security/src/main/kotlin/security/AuthToken.kt @@ -1,4 +1,4 @@ -package com.few.api.security.token +package security data class AuthToken( val accessToken: String, diff --git a/api/src/main/kotlin/com/few/api/security/authentication/authority/AuthorityUtils.kt b/security/src/main/kotlin/security/AuthorityUtils.kt similarity index 91% rename from api/src/main/kotlin/com/few/api/security/authentication/authority/AuthorityUtils.kt rename to security/src/main/kotlin/security/AuthorityUtils.kt index e2ca7f594..e19eaf9a5 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/authority/AuthorityUtils.kt +++ b/security/src/main/kotlin/security/AuthorityUtils.kt @@ -1,4 +1,4 @@ -package com.few.api.security.authentication.authority +package security import org.apache.commons.lang3.StringUtils import org.springframework.security.core.GrantedAuthority diff --git a/api/src/main/kotlin/com/few/api/config/crypto/Encryption.kt b/security/src/main/kotlin/security/Encryptor.kt similarity index 54% rename from api/src/main/kotlin/com/few/api/config/crypto/Encryption.kt rename to security/src/main/kotlin/security/Encryptor.kt index 62b7482aa..813e8f860 100644 --- a/api/src/main/kotlin/com/few/api/config/crypto/Encryption.kt +++ b/security/src/main/kotlin/security/Encryptor.kt @@ -1,6 +1,6 @@ -package com.few.api.config.crypto +package security -interface Encryption { +interface Encryptor { fun encrypt(plainText: T): R diff --git a/api/src/main/kotlin/com/few/api/config/crypto/IdEncryption.kt b/security/src/main/kotlin/security/IdEncryptor.kt similarity index 90% rename from api/src/main/kotlin/com/few/api/config/crypto/IdEncryption.kt rename to security/src/main/kotlin/security/IdEncryptor.kt index 1827c6310..403e5dbdb 100644 --- a/api/src/main/kotlin/com/few/api/config/crypto/IdEncryption.kt +++ b/security/src/main/kotlin/security/IdEncryptor.kt @@ -1,4 +1,4 @@ -package com.few.api.config.crypto +package security import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component @@ -8,24 +8,24 @@ import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.SecretKeySpec @Component -class IdEncryption( +class IdEncryptor( @Value("\${security.encryption.algorithm}") private val algorithm: String, @Value("\${security.encryption.secretKey}") private val secretKey: String, @Value("\${security.encryption.transformation}") private val transformation: String, @Value("\${security.encryption.keySize}") private val keySize: Int, @Value("\${security.encryption.iv}") private val iv: String, -) : Encryption { +) : Encryptor { private var key: SecretKeySpec = KeyGenerator.getInstance(algorithm).apply { init(keySize) }.run { - SecretKeySpec(secretKey.toByteArray(), this@IdEncryption.algorithm) + SecretKeySpec(secretKey.toByteArray(), this@IdEncryptor.algorithm) } private var encodeCipher: Cipher = Cipher.getInstance(transformation).apply { - init(Cipher.ENCRYPT_MODE, key, IvParameterSpec(this@IdEncryption.iv.toByteArray())) + init(Cipher.ENCRYPT_MODE, key, IvParameterSpec(this@IdEncryptor.iv.toByteArray())) } private var decodeCipher: Cipher = Cipher.getInstance(transformation).apply { - init(Cipher.DECRYPT_MODE, key, IvParameterSpec(this@IdEncryption.iv.toByteArray())) + init(Cipher.DECRYPT_MODE, key, IvParameterSpec(this@IdEncryptor.iv.toByteArray())) } override fun encrypt(plainText: String): String { diff --git a/api/src/main/kotlin/com/few/api/security/authentication/authority/Roles.kt b/security/src/main/kotlin/security/Roles.kt similarity index 83% rename from api/src/main/kotlin/com/few/api/security/authentication/authority/Roles.kt rename to security/src/main/kotlin/security/Roles.kt index 7a98d2df2..7494bdac5 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/authority/Roles.kt +++ b/security/src/main/kotlin/security/Roles.kt @@ -1,4 +1,4 @@ -package com.few.api.security.authentication.authority +package security import org.springframework.security.core.GrantedAuthority diff --git a/api/src/main/kotlin/com/few/api/security/context/TokenAuditHolder.kt b/security/src/main/kotlin/security/TokenAuditHolder.kt similarity index 89% rename from api/src/main/kotlin/com/few/api/security/context/TokenAuditHolder.kt rename to security/src/main/kotlin/security/TokenAuditHolder.kt index 440efe2a2..a2ca38700 100644 --- a/api/src/main/kotlin/com/few/api/security/context/TokenAuditHolder.kt +++ b/security/src/main/kotlin/security/TokenAuditHolder.kt @@ -1,6 +1,5 @@ -package com.few.api.security.context +package security -import com.few.api.security.authentication.token.TokenUserDetails import org.springframework.security.core.GrantedAuthority import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.core.context.SecurityContextHolder @@ -10,6 +9,7 @@ object TokenAuditHolder { private const val NOT_USE_ID_VALUE = "0" private const val NOT_USE_EMAIL_VALUE = "" private val NOT_USE_AUTHORITY: GrantedAuthority = SimpleGrantedAuthority("NOT_USE") + fun get(): UserDetails { val authentication = SecurityContextHolder.getContext().authentication return if (authentication == null || !authentication.isAuthenticated || authentication.principal == "anonymousUser") { diff --git a/security/src/main/kotlin/security/TokenClaim.kt b/security/src/main/kotlin/security/TokenClaim.kt new file mode 100644 index 000000000..c8c9c4dea --- /dev/null +++ b/security/src/main/kotlin/security/TokenClaim.kt @@ -0,0 +1,7 @@ +package security + +enum class TokenClaim(val key: String) { + MEMBER_ID_CLAIM("memberId"), + MEMBER_EMAIL_CLAIM("memberEmail"), + MEMBER_ROLE_CLAIM("memberRole"), +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/token/TokenGenerator.kt b/security/src/main/kotlin/security/TokenGenerator.kt similarity index 81% rename from api/src/main/kotlin/com/few/api/security/token/TokenGenerator.kt rename to security/src/main/kotlin/security/TokenGenerator.kt index ebf63bfbf..d20d262cd 100644 --- a/api/src/main/kotlin/com/few/api/security/token/TokenGenerator.kt +++ b/security/src/main/kotlin/security/TokenGenerator.kt @@ -1,6 +1,5 @@ -package com.few.api.security.token +package security -import com.few.api.security.authentication.authority.Roles import io.jsonwebtoken.Header import io.jsonwebtoken.Jwts import io.jsonwebtoken.security.Keys @@ -15,11 +14,6 @@ class TokenGenerator( @Value("\${security.jwt.token.validtime.refresh}") private val refreshTokenValidTime: Long, ) { - companion object { - private const val MEMBER_ID_CLAIM_KEY = "memberId" - private const val MEMBER_EMAIL_CLAIM_KEY = "memberEmail" - private const val MEMBER_ROLE_CLAIM_KEY = "memberRole" - } fun generateAuthToken(memberId: Long?, memberEmail: String?, memberRoles: List): AuthToken { return AuthToken( generateAccessToken( @@ -56,9 +50,9 @@ class TokenGenerator( val acValidTime = accessTokenValidTime ?: this.accessTokenValidTime return Jwts.builder() .setHeaderParam(Header.TYPE, Header.JWT_TYPE) - .claim(MEMBER_ID_CLAIM_KEY, memberId) - .claim(MEMBER_EMAIL_CLAIM_KEY, memberEmail) - .claim(MEMBER_ROLE_CLAIM_KEY, roles.toString()) + .claim(TokenClaim.MEMBER_ID_CLAIM.key, memberId) + .claim(TokenClaim.MEMBER_EMAIL_CLAIM.key, memberEmail) + .claim(TokenClaim.MEMBER_ROLE_CLAIM.key, roles.toString()) .setIssuedAt(now) .setExpiration(Date(now.time + acValidTime)) .signWith(Keys.hmacShaKeyFor(secretKey.toByteArray())) @@ -76,9 +70,9 @@ class TokenGenerator( val rfValidTime = refreshTokenValidTime ?: this.refreshTokenValidTime return Jwts.builder() .setHeaderParam(Header.TYPE, Header.JWT_TYPE) - .claim(MEMBER_ID_CLAIM_KEY, memberId) - .claim(MEMBER_EMAIL_CLAIM_KEY, memberEmail) - .claim(MEMBER_ROLE_CLAIM_KEY, roles.toString()) + .claim(TokenClaim.MEMBER_ID_CLAIM.key, memberId) + .claim(TokenClaim.MEMBER_EMAIL_CLAIM.key, memberEmail) + .claim(TokenClaim.MEMBER_ROLE_CLAIM.key, roles.toString()) .setIssuedAt(now) .setExpiration(Date(now.time + rfValidTime)) .signWith(Keys.hmacShaKeyFor(secretKey.toByteArray())) diff --git a/api/src/main/kotlin/com/few/api/security/token/TokenResolver.kt b/security/src/main/kotlin/security/TokenResolver.kt similarity index 80% rename from api/src/main/kotlin/com/few/api/security/token/TokenResolver.kt rename to security/src/main/kotlin/security/TokenResolver.kt index a74a6ddbc..d2875c4e9 100644 --- a/api/src/main/kotlin/com/few/api/security/token/TokenResolver.kt +++ b/security/src/main/kotlin/security/TokenResolver.kt @@ -1,23 +1,15 @@ -package com.few.api.security.token +package security import io.github.oshai.kotlinlogging.KotlinLogging import io.jsonwebtoken.Claims import io.jsonwebtoken.Jwts import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component -import java.util.* @Component class TokenResolver( @Value("\${security.jwt.token.secretkey}") private val secretKey: String, ) { - - companion object { - private const val MEMBER_ID_CLAIM_KEY = "memberId" - private const val MEMBER_EMAIL_CLAIM_KEY = "memberEmail" - private const val MEMBER_ROLE_CLAIM_KEY = "memberRole" - } - private val log = KotlinLogging.logger {} fun resolve(token: String?): Claims? { @@ -40,7 +32,7 @@ class TokenResolver( .build() .parseClaimsJws(token) .body - .get(MEMBER_ID_CLAIM_KEY, Integer::class.java) + .get(TokenClaim.MEMBER_ID_CLAIM.key, Integer::class.java) .toLong() } catch (e: Exception) { log.warn { "${"Failed to get memberId. token: {}"} $token" } @@ -55,7 +47,7 @@ class TokenResolver( .build() .parseClaimsJws(token) .body - .get(MEMBER_EMAIL_CLAIM_KEY, String::class.java) + .get(TokenClaim.MEMBER_EMAIL_CLAIM.key, String::class.java) } catch (e: Exception) { log.warn { "${"Failed to get memberId. token: {}"} $token" } return null @@ -69,7 +61,7 @@ class TokenResolver( .build() .parseClaimsJws(token) .body - .get(MEMBER_ROLE_CLAIM_KEY, String::class.java) + .get(TokenClaim.MEMBER_ROLE_CLAIM.key, String::class.java) } catch (e: Exception) { log.warn { "${"Failed to get memberId. token: {}"} $token" } return null diff --git a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetails.kt b/security/src/main/kotlin/security/TokenUserDetails.kt similarity index 94% rename from api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetails.kt rename to security/src/main/kotlin/security/TokenUserDetails.kt index f3eb5514f..6a7f4345e 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetails.kt +++ b/security/src/main/kotlin/security/TokenUserDetails.kt @@ -1,4 +1,4 @@ -package com.few.api.security.authentication.token +package security import org.springframework.security.core.GrantedAuthority import org.springframework.security.core.userdetails.UserDetails @@ -8,7 +8,6 @@ open class TokenUserDetails( val id: String, val email: String, ) : UserDetails { - companion object { private const val NOT_USE_PASSWORD_VALUE = "0" } diff --git a/api/src/main/kotlin/com/few/api/security/authentication/authority/UserAuthority.kt b/security/src/main/kotlin/security/UserAuthority.kt similarity index 77% rename from api/src/main/kotlin/com/few/api/security/authentication/authority/UserAuthority.kt rename to security/src/main/kotlin/security/UserAuthority.kt index 3b63b7cec..109438ef7 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/authority/UserAuthority.kt +++ b/security/src/main/kotlin/security/UserAuthority.kt @@ -1,4 +1,4 @@ -package com.few.api.security.authentication.authority +package security import org.springframework.security.core.GrantedAuthority diff --git a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenAuthProvider.kt b/security/src/main/kotlin/security/authentication/token/TokenAuthProvider.kt similarity index 97% rename from api/src/main/kotlin/com/few/api/security/authentication/token/TokenAuthProvider.kt rename to security/src/main/kotlin/security/authentication/token/TokenAuthProvider.kt index 6ca14a974..e7c2b58c6 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenAuthProvider.kt +++ b/security/src/main/kotlin/security/authentication/token/TokenAuthProvider.kt @@ -1,4 +1,4 @@ -package com.few.api.security.authentication.token +package security.authentication.token import org.springframework.security.access.AccessDeniedException import org.springframework.security.authentication.AuthenticationProvider @@ -14,6 +14,7 @@ import java.util.* class TokenAuthProvider( var tokenUserDetailsService: TokenUserDetailsService, ) : AuthenticationProvider { + @Throws(AuthenticationException::class, AccessDeniedException::class) override fun authenticate(authentication: Authentication): Authentication? { val token = Optional.ofNullable(authentication.principal) diff --git a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetailsService.kt b/security/src/main/kotlin/security/authentication/token/TokenUserDetailsService.kt similarity index 59% rename from api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetailsService.kt rename to security/src/main/kotlin/security/authentication/token/TokenUserDetailsService.kt index 66352a943..89ef8e31b 100644 --- a/api/src/main/kotlin/com/few/api/security/authentication/token/TokenUserDetailsService.kt +++ b/security/src/main/kotlin/security/authentication/token/TokenUserDetailsService.kt @@ -1,44 +1,39 @@ -package com.few.api.security.authentication.token +package security.authentication.token -import com.few.api.security.authentication.authority.AuthorityUtils -import com.few.api.security.exception.AccessTokenInvalidException -import com.few.api.security.token.TokenResolver +import security.AuthorityUtils import io.github.oshai.kotlinlogging.KotlinLogging import io.jsonwebtoken.Claims import org.springframework.security.core.userdetails.UserDetails import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.stereotype.Component +import security.exception.SecurityAccessTokenInvalidException +import security.TokenClaim +import security.TokenResolver +import security.TokenUserDetails @Component class TokenUserDetailsService( private val tokenResolver: TokenResolver, ) : UserDetailsService { - private val log = KotlinLogging.logger {} - companion object { - private const val MEMBER_ID_CLAIM_KEY = "memberId" - private const val MEMBER_EMAIL_CLAIM_KEY = "memberEmail" - private const val MEMBER_ROLE_CLAIM_KEY = "memberRole" - } - override fun loadUserByUsername(token: String?): UserDetails { val claims: Claims = tokenResolver .resolve(token) - ?: throw AccessTokenInvalidException("Invalid access token. accessToken: $token") + ?: throw SecurityAccessTokenInvalidException("Invalid access token. accessToken: $token") val id = claims.get( - MEMBER_ID_CLAIM_KEY, + TokenClaim.MEMBER_ID_CLAIM.key, Integer::class.java ).toLong() val roles = claims.get( - MEMBER_ROLE_CLAIM_KEY, + TokenClaim.MEMBER_ROLE_CLAIM.key, String::class.java ) val email = claims.get( - MEMBER_EMAIL_CLAIM_KEY, + TokenClaim.MEMBER_EMAIL_CLAIM.key, String::class.java ) diff --git a/security/src/main/kotlin/security/config/SecurityConfig.kt b/security/src/main/kotlin/security/config/SecurityConfig.kt new file mode 100644 index 000000000..f98e23ebf --- /dev/null +++ b/security/src/main/kotlin/security/config/SecurityConfig.kt @@ -0,0 +1,13 @@ +package security.config + +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration + +@Configuration +@ComponentScan(basePackages = [SecurityConfig.BASE_PACKAGE]) +class SecurityConfig { + companion object { + const val BASE_PACKAGE = " security" + const val BEAN_NAME_PREFIX = "security" + } +} \ No newline at end of file diff --git a/security/src/main/kotlin/security/exception/SecurityAccessTokenInvalidException.kt b/security/src/main/kotlin/security/exception/SecurityAccessTokenInvalidException.kt new file mode 100644 index 000000000..83ea5ea33 --- /dev/null +++ b/security/src/main/kotlin/security/exception/SecurityAccessTokenInvalidException.kt @@ -0,0 +1,5 @@ +package security.exception + +import org.springframework.security.core.AuthenticationException + +class SecurityAccessTokenInvalidException(msg: String?) : AuthenticationException(msg) \ No newline at end of file diff --git a/security/src/main/resources/application-security-local.yml b/security/src/main/resources/application-security-local.yml new file mode 100644 index 000000000..c3b5d455a --- /dev/null +++ b/security/src/main/resources/application-security-local.yml @@ -0,0 +1,13 @@ +security: + jwt: + token: + validtime: + access: 31557600000 + refresh: 31557600000 + secretkey: jwtsecretKeyhastolonghowlongidontknow + encryption: + algorithm: AES + secretKey: encryptionsecret + transformation: AES/CBC/PKCS5Padding + keySize: 128 + iv: AAAAAAAAAAAAAAAA diff --git a/api/src/main/resources/application-security-prd.yml b/security/src/main/resources/application-security-prd.yml similarity index 55% rename from api/src/main/resources/application-security-prd.yml rename to security/src/main/resources/application-security-prd.yml index 0537b0d68..2a7663cfa 100644 --- a/api/src/main/resources/application-security-prd.yml +++ b/security/src/main/resources/application-security-prd.yml @@ -5,14 +5,6 @@ security: access: ${ACCESS_TOKEN_VALIDTIME} refresh: ${REFRESH_TOKEN_VALIDTIME} secretkey: ${TOKEN_SECRETKEY} - cors: - path-patterns: ${CORS_PATH_PATTERNS} - origin-patterns: ${CORS_ORIGIN_PATTERNS} - allowed-methods: ${CORS_ALLOWED_METHODS} - allowed-headers: ${CORS_ALLOWED_HEADERS} - exposed-headers: ${CORS_EXPOSED_HEADERS} - allow-credentials: ${CORS_ALLOW_CREDENTIALS} - max-age: ${CORS_MAX_AGE} encryption: algorithm: ${ENCRYPTION_ALGORITHM} secretKey: ${ENCRYPTION_SECRETKEY} diff --git a/settings.gradle.kts b/settings.gradle.kts index f75608ce1..3a89cccaf 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,5 +4,6 @@ include("api") include("data") include("api-repo") include("email") -include("batch") -include("storage") \ No newline at end of file +include("storage") +include("web") +include("security") \ No newline at end of file diff --git a/storage/build.gradle.kts b/storage/build.gradle.kts index d49471f3a..695db26c9 100644 --- a/storage/build.gradle.kts +++ b/storage/build.gradle.kts @@ -9,10 +9,4 @@ tasks.getByName("jar") { dependencies { /** aws - s3 */ implementation("com.amazonaws:aws-java-sdk-s3:${DependencyVersion.AWS_SDK}") - - /** commonmark - markdown to html */ - implementation("org.commonmark:commonmark:${DependencyVersion.COMMONMARK}") - - /** jsoup - html parser */ - implementation("org.jsoup:jsoup:1.15.3") } \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/GetPreSignedObjectUrlService.kt b/storage/src/main/kotlin/com/few/storage/GetPreSignedObjectUrlService.kt deleted file mode 100644 index 1c4e2d7d9..000000000 --- a/storage/src/main/kotlin/com/few/storage/GetPreSignedObjectUrlService.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.few.storage - -interface GetPreSignedObjectUrlService { - - fun execute(image: String): String? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/RemoveObjectService.kt b/storage/src/main/kotlin/com/few/storage/RemoveObjectService.kt deleted file mode 100644 index 33e4c4a26..000000000 --- a/storage/src/main/kotlin/com/few/storage/RemoveObjectService.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.few.storage - -interface RemoveObjectService { - fun execute(name: String): Boolean -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/document/client/DocumentStoreClient.kt b/storage/src/main/kotlin/com/few/storage/document/client/DocumentStoreClient.kt deleted file mode 100644 index 0ac260369..000000000 --- a/storage/src/main/kotlin/com/few/storage/document/client/DocumentStoreClient.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.few.storage.document.client - -import com.few.storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs -import com.few.storage.document.client.dto.DocumentPutObjectArgs -import com.few.storage.document.client.dto.DocumentWriteResponse - -interface DocumentStoreClient { - fun getPreSignedObjectUrl(args: DocumentGetPreSignedObjectUrlArgs): String? - - fun putObject(args: DocumentPutObjectArgs): DocumentWriteResponse? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/document/service/GetPreSignedDocumentUrlService.kt b/storage/src/main/kotlin/com/few/storage/document/service/GetPreSignedDocumentUrlService.kt deleted file mode 100644 index 64680cd7b..000000000 --- a/storage/src/main/kotlin/com/few/storage/document/service/GetPreSignedDocumentUrlService.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.few.storage.document.service - -import com.few.storage.GetPreSignedObjectUrlService - -interface GetPreSignedDocumentUrlService : GetPreSignedObjectUrlService { - override fun execute(image: String): String? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/document/service/PutDocumentService.kt b/storage/src/main/kotlin/com/few/storage/document/service/PutDocumentService.kt deleted file mode 100644 index f9cce113a..000000000 --- a/storage/src/main/kotlin/com/few/storage/document/service/PutDocumentService.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.few.storage.document.service - -import com.few.storage.PutObjectService -import com.few.storage.document.client.dto.DocumentWriteResponse -import java.io.File - -interface PutDocumentService : PutObjectService { - override fun execute(name: String, file: File): DocumentWriteResponse? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/client/ImageStoreClient.kt b/storage/src/main/kotlin/com/few/storage/image/client/ImageStoreClient.kt deleted file mode 100644 index d55a6c6e6..000000000 --- a/storage/src/main/kotlin/com/few/storage/image/client/ImageStoreClient.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.few.storage.image.client - -import com.few.storage.image.client.dto.ImageGetPreSignedObjectUrlArgs -import com.few.storage.image.client.dto.ImagePutObjectArgs -import com.few.storage.image.client.dto.ImageRemoveObjectArgs -import com.few.storage.image.client.dto.ImageWriteResponse - -interface ImageStoreClient { - - fun getPreSignedObjectUrl(args: ImageGetPreSignedObjectUrlArgs): String? - - fun removeObject(args: ImageRemoveObjectArgs): Boolean - - fun putObject(args: ImagePutObjectArgs): ImageWriteResponse? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/service/GetPreSignedImageUrlService.kt b/storage/src/main/kotlin/com/few/storage/image/service/GetPreSignedImageUrlService.kt deleted file mode 100644 index 178cc38b2..000000000 --- a/storage/src/main/kotlin/com/few/storage/image/service/GetPreSignedImageUrlService.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.few.storage.image.service - -import com.few.storage.GetPreSignedObjectUrlService - -fun interface GetPreSignedImageUrlService : GetPreSignedObjectUrlService { - override fun execute(image: String): String? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/service/PutImageService.kt b/storage/src/main/kotlin/com/few/storage/image/service/PutImageService.kt deleted file mode 100644 index 58d2d672e..000000000 --- a/storage/src/main/kotlin/com/few/storage/image/service/PutImageService.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.few.storage.image.service - -import com.few.storage.PutObjectService -import com.few.storage.image.client.dto.ImageWriteResponse -import java.io.File - -fun interface PutImageService : PutObjectService { - override fun execute(name: String, file: File): ImageWriteResponse? -} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/service/RemoveImageService.kt b/storage/src/main/kotlin/com/few/storage/image/service/RemoveImageService.kt deleted file mode 100644 index 52b32e0dd..000000000 --- a/storage/src/main/kotlin/com/few/storage/image/service/RemoveImageService.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.few.storage.image.service - -import com.few.storage.RemoveObjectService - -fun interface RemoveImageService : RemoveObjectService { - override fun execute(image: String): Boolean -} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/GetPreSignedObjectUrlProvider.kt b/storage/src/main/kotlin/storage/GetPreSignedObjectUrlProvider.kt new file mode 100644 index 000000000..365ec0676 --- /dev/null +++ b/storage/src/main/kotlin/storage/GetPreSignedObjectUrlProvider.kt @@ -0,0 +1,6 @@ +package storage + +interface GetPreSignedObjectUrlProvider { + + fun execute(image: String): String? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/PutObjectService.kt b/storage/src/main/kotlin/storage/PutObjectProvider.kt similarity index 55% rename from storage/src/main/kotlin/com/few/storage/PutObjectService.kt rename to storage/src/main/kotlin/storage/PutObjectProvider.kt index ea0090987..054c11861 100644 --- a/storage/src/main/kotlin/com/few/storage/PutObjectService.kt +++ b/storage/src/main/kotlin/storage/PutObjectProvider.kt @@ -1,8 +1,8 @@ -package com.few.storage +package storage import java.io.File -interface PutObjectService { +interface PutObjectProvider { fun execute(name: String, file: File): T? } \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/RemoveObjectProvider.kt b/storage/src/main/kotlin/storage/RemoveObjectProvider.kt new file mode 100644 index 000000000..aee1519cf --- /dev/null +++ b/storage/src/main/kotlin/storage/RemoveObjectProvider.kt @@ -0,0 +1,5 @@ +package storage + +interface RemoveObjectProvider { + fun execute(name: String): Boolean +} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/config/ClientConfig.kt b/storage/src/main/kotlin/storage/config/StorageClientConfig.kt similarity index 97% rename from storage/src/main/kotlin/com/few/storage/config/ClientConfig.kt rename to storage/src/main/kotlin/storage/config/StorageClientConfig.kt index b95ab3f8a..b4f5a44e4 100644 --- a/storage/src/main/kotlin/com/few/storage/config/ClientConfig.kt +++ b/storage/src/main/kotlin/storage/config/StorageClientConfig.kt @@ -1,4 +1,4 @@ -package com.few.storage.config +package storage.config import com.amazonaws.auth.AWSStaticCredentialsProvider import com.amazonaws.auth.BasicAWSCredentials @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Profile @Configuration -class ClientConfig( +class StorageClientConfig( @Value("\${storage.url}") val url: String, @Value("\${storage.access-key}") val accessKey: String, @Value("\${storage.secret-key}") val secretKey: String, diff --git a/storage/src/main/kotlin/storage/document/GetPreSignedDocumentUrlProvider.kt b/storage/src/main/kotlin/storage/document/GetPreSignedDocumentUrlProvider.kt new file mode 100644 index 000000000..2ddf386cc --- /dev/null +++ b/storage/src/main/kotlin/storage/document/GetPreSignedDocumentUrlProvider.kt @@ -0,0 +1,7 @@ +package storage.document + +import storage.GetPreSignedObjectUrlProvider + +interface GetPreSignedDocumentUrlProvider : GetPreSignedObjectUrlProvider { + override fun execute(image: String): String? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/document/PutDocumentProvider.kt b/storage/src/main/kotlin/storage/document/PutDocumentProvider.kt new file mode 100644 index 000000000..4973ce29a --- /dev/null +++ b/storage/src/main/kotlin/storage/document/PutDocumentProvider.kt @@ -0,0 +1,9 @@ +package storage.document + +import storage.PutObjectProvider +import storage.document.client.dto.DocumentWriteResponse +import java.io.File + +interface PutDocumentProvider : PutObjectProvider { + override fun execute(name: String, file: File): DocumentWriteResponse? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/document/client/DocumentStoreClient.kt b/storage/src/main/kotlin/storage/document/client/DocumentStoreClient.kt new file mode 100644 index 000000000..ed00cad37 --- /dev/null +++ b/storage/src/main/kotlin/storage/document/client/DocumentStoreClient.kt @@ -0,0 +1,11 @@ +package storage.document.client + +import storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs +import storage.document.client.dto.DocumentPutObjectArgs +import storage.document.client.dto.DocumentWriteResponse + +interface DocumentStoreClient { + fun getPreSignedObjectUrl(args: DocumentGetPreSignedObjectUrlArgs): String? + + fun putObject(args: DocumentPutObjectArgs): DocumentWriteResponse? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/document/client/S3DocumentStoreClient.kt b/storage/src/main/kotlin/storage/document/client/S3DocumentStoreClient.kt similarity index 85% rename from storage/src/main/kotlin/com/few/storage/document/client/S3DocumentStoreClient.kt rename to storage/src/main/kotlin/storage/document/client/S3DocumentStoreClient.kt index 5dd8729eb..b155e63e3 100644 --- a/storage/src/main/kotlin/com/few/storage/document/client/S3DocumentStoreClient.kt +++ b/storage/src/main/kotlin/storage/document/client/S3DocumentStoreClient.kt @@ -1,10 +1,10 @@ -package com.few.storage.document.client +package storage.document.client import com.amazonaws.services.s3.AmazonS3Client -import com.few.storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs -import com.few.storage.document.client.dto.DocumentPutObjectArgs -import com.few.storage.document.client.dto.DocumentWriteResponse -import com.few.storage.document.client.dto.toS3Args +import storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs +import storage.document.client.dto.DocumentPutObjectArgs +import storage.document.client.dto.DocumentWriteResponse +import storage.document.client.dto.toS3Args import io.github.oshai.kotlinlogging.KotlinLogging class S3DocumentStoreClient( diff --git a/storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentObjectArgs.kt b/storage/src/main/kotlin/storage/document/client/dto/DocumentObjectArgs.kt similarity index 97% rename from storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentObjectArgs.kt rename to storage/src/main/kotlin/storage/document/client/dto/DocumentObjectArgs.kt index b45f6db06..648193ff8 100644 --- a/storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentObjectArgs.kt +++ b/storage/src/main/kotlin/storage/document/client/dto/DocumentObjectArgs.kt @@ -1,4 +1,4 @@ -package com.few.storage.document.client.dto +package storage.document.client.dto import com.amazonaws.HttpMethod import com.amazonaws.services.s3.model.DeleteObjectRequest diff --git a/storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentWriteResponse.kt b/storage/src/main/kotlin/storage/document/client/dto/DocumentWriteResponse.kt similarity index 78% rename from storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentWriteResponse.kt rename to storage/src/main/kotlin/storage/document/client/dto/DocumentWriteResponse.kt index 28dec8ebc..99cbdf652 100644 --- a/storage/src/main/kotlin/com/few/storage/document/client/dto/DocumentWriteResponse.kt +++ b/storage/src/main/kotlin/storage/document/client/dto/DocumentWriteResponse.kt @@ -1,4 +1,4 @@ -package com.few.storage.document.client.dto +package storage.document.client.dto data class DocumentWriteResponse( val bucket: String, diff --git a/storage/src/main/kotlin/com/few/storage/document/client/util/DocumentArgsGenerator.kt b/storage/src/main/kotlin/storage/document/client/util/DocumentArgsGenerator.kt similarity index 75% rename from storage/src/main/kotlin/com/few/storage/document/client/util/DocumentArgsGenerator.kt rename to storage/src/main/kotlin/storage/document/client/util/DocumentArgsGenerator.kt index 4f19a8bc6..e889b98f9 100644 --- a/storage/src/main/kotlin/com/few/storage/document/client/util/DocumentArgsGenerator.kt +++ b/storage/src/main/kotlin/storage/document/client/util/DocumentArgsGenerator.kt @@ -1,8 +1,8 @@ -package com.few.storage.document.client.util +package storage.document.client.util -import com.few.storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs -import com.few.storage.document.client.dto.DocumentPutObjectArgs -import com.few.storage.document.client.dto.DocumentRemoveObjectArgs +import storage.document.client.dto.DocumentGetPreSignedObjectUrlArgs +import storage.document.client.dto.DocumentPutObjectArgs +import storage.document.client.dto.DocumentRemoveObjectArgs import org.apache.http.entity.ContentType import java.io.BufferedInputStream import java.io.File diff --git a/storage/src/main/kotlin/com/few/storage/document/config/DocumentStorageConfig.kt b/storage/src/main/kotlin/storage/document/config/DocumentStorageConfig.kt similarity index 51% rename from storage/src/main/kotlin/com/few/storage/document/config/DocumentStorageConfig.kt rename to storage/src/main/kotlin/storage/document/config/DocumentStorageConfig.kt index d4da2861d..65099dae1 100644 --- a/storage/src/main/kotlin/com/few/storage/document/config/DocumentStorageConfig.kt +++ b/storage/src/main/kotlin/storage/document/config/DocumentStorageConfig.kt @@ -1,19 +1,16 @@ -package com.few.storage.document.config +package storage.document.config -import com.few.storage.config.ClientConfig +import storage.config.StorageClientConfig import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import @Configuration @ComponentScan(basePackages = [DocumentStorageConfig.BASE_PACKAGE]) -@Import(ClientConfig::class) +@Import(StorageClientConfig::class) class DocumentStorageConfig { companion object { - const val BASE_PACKAGE = "com.few.storage.document" - const val SERVICE_NAME = "documentStorage" - const val MODULE_NAME = "storage-document" + const val BASE_PACKAGE = "storage.document" const val BEAN_NAME_PREFIX = "documentStore" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME } } \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/document/config/S3DocumentStoreConfig.kt b/storage/src/main/kotlin/storage/document/config/S3DocumentStoreConfig.kt similarity index 85% rename from storage/src/main/kotlin/com/few/storage/document/config/S3DocumentStoreConfig.kt rename to storage/src/main/kotlin/storage/document/config/S3DocumentStoreConfig.kt index 2784625a0..cfb61be07 100644 --- a/storage/src/main/kotlin/com/few/storage/document/config/S3DocumentStoreConfig.kt +++ b/storage/src/main/kotlin/storage/document/config/S3DocumentStoreConfig.kt @@ -1,9 +1,9 @@ -package com.few.storage.document.config +package storage.document.config import com.amazonaws.services.s3.AmazonS3Client -import com.few.storage.config.ClientConfig -import com.few.storage.document.client.DocumentStoreClient -import com.few.storage.document.client.S3DocumentStoreClient +import storage.config.StorageClientConfig +import storage.document.client.DocumentStoreClient +import storage.document.client.S3DocumentStoreClient import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.beans.factory.annotation.Value import org.springframework.context.ApplicationListener @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import import org.springframework.context.event.ContextRefreshedEvent @Configuration -@Import(ClientConfig::class) +@Import(StorageClientConfig::class) class S3DocumentStoreConfig( @Value("\${document.store.bucket-name}") val bucket: String, @Value("\${storage.region}") val region: String, diff --git a/storage/src/main/kotlin/com/few/storage/document/service/s3/S3GetPreSignedDocumentUrlService.kt b/storage/src/main/kotlin/storage/document/provider/s3/S3GetPreSignedDocumentUrlProvider.kt similarity index 58% rename from storage/src/main/kotlin/com/few/storage/document/service/s3/S3GetPreSignedDocumentUrlService.kt rename to storage/src/main/kotlin/storage/document/provider/s3/S3GetPreSignedDocumentUrlProvider.kt index b82341a7d..0c2e93ead 100644 --- a/storage/src/main/kotlin/com/few/storage/document/service/s3/S3GetPreSignedDocumentUrlService.kt +++ b/storage/src/main/kotlin/storage/document/provider/s3/S3GetPreSignedDocumentUrlProvider.kt @@ -1,16 +1,16 @@ -package com.few.storage.document.service.s3 +package storage.document.provider.s3 -import com.few.storage.document.client.DocumentStoreClient -import com.few.storage.document.client.util.DocumentArgsGenerator -import com.few.storage.document.service.GetPreSignedDocumentUrlService +import storage.document.client.DocumentStoreClient +import storage.document.client.util.DocumentArgsGenerator +import storage.document.GetPreSignedDocumentUrlProvider import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service @Service -class S3GetPreSignedDocumentUrlService( +class S3GetPreSignedDocumentUrlProvider( @Value("\${document.store.bucket-name}") val bucket: String, private val documentStoreClient: DocumentStoreClient, -) : GetPreSignedDocumentUrlService { +) : GetPreSignedDocumentUrlProvider { override fun execute(image: String): String? { DocumentArgsGenerator.preSignedUrl(bucket, image).let { args -> return documentStoreClient.getPreSignedObjectUrl(args) diff --git a/storage/src/main/kotlin/com/few/storage/document/service/s3/S3PutDocumentService.kt b/storage/src/main/kotlin/storage/document/provider/s3/S3PutDocumentProvider.kt similarity index 58% rename from storage/src/main/kotlin/com/few/storage/document/service/s3/S3PutDocumentService.kt rename to storage/src/main/kotlin/storage/document/provider/s3/S3PutDocumentProvider.kt index 9e702245e..d4ac3ddc8 100644 --- a/storage/src/main/kotlin/com/few/storage/document/service/s3/S3PutDocumentService.kt +++ b/storage/src/main/kotlin/storage/document/provider/s3/S3PutDocumentProvider.kt @@ -1,18 +1,18 @@ -package com.few.storage.document.service.s3 +package storage.document.provider.s3 -import com.few.storage.document.client.DocumentStoreClient -import com.few.storage.document.client.dto.DocumentWriteResponse -import com.few.storage.document.client.util.DocumentArgsGenerator -import com.few.storage.document.service.PutDocumentService +import storage.document.client.DocumentStoreClient +import storage.document.client.dto.DocumentWriteResponse +import storage.document.client.util.DocumentArgsGenerator +import storage.document.PutDocumentProvider import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service import java.io.File @Service -class S3PutDocumentService( +class S3PutDocumentProvider( @Value("\${document.store.bucket-name}") val bucket: String, private val documentStoreClient: DocumentStoreClient, -) : PutDocumentService { +) : PutDocumentProvider { override fun execute(name: String, file: File): DocumentWriteResponse? { DocumentArgsGenerator.putDocument(bucket, name, file).let { args -> return documentStoreClient.putObject(args) diff --git a/storage/src/main/kotlin/storage/image/GetPreSignedImageUrlProvider.kt b/storage/src/main/kotlin/storage/image/GetPreSignedImageUrlProvider.kt new file mode 100644 index 000000000..9be22473d --- /dev/null +++ b/storage/src/main/kotlin/storage/image/GetPreSignedImageUrlProvider.kt @@ -0,0 +1,7 @@ +package storage.image + +import storage.GetPreSignedObjectUrlProvider + +fun interface GetPreSignedImageUrlProvider : GetPreSignedObjectUrlProvider { + override fun execute(image: String): String? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/image/PutImageProvider.kt b/storage/src/main/kotlin/storage/image/PutImageProvider.kt new file mode 100644 index 000000000..f7c839d2a --- /dev/null +++ b/storage/src/main/kotlin/storage/image/PutImageProvider.kt @@ -0,0 +1,9 @@ +package storage.image + +import storage.PutObjectProvider +import storage.image.client.dto.ImageWriteResponse +import java.io.File + +fun interface PutImageProvider : PutObjectProvider { + override fun execute(name: String, file: File): ImageWriteResponse? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/image/RemoveImageProvider.kt b/storage/src/main/kotlin/storage/image/RemoveImageProvider.kt new file mode 100644 index 000000000..3fccfa374 --- /dev/null +++ b/storage/src/main/kotlin/storage/image/RemoveImageProvider.kt @@ -0,0 +1,7 @@ +package storage.image + +import storage.RemoveObjectProvider + +fun interface RemoveImageProvider : RemoveObjectProvider { + override fun execute(image: String): Boolean +} \ No newline at end of file diff --git a/storage/src/main/kotlin/storage/image/client/ImageStoreClient.kt b/storage/src/main/kotlin/storage/image/client/ImageStoreClient.kt new file mode 100644 index 000000000..43fc2dce6 --- /dev/null +++ b/storage/src/main/kotlin/storage/image/client/ImageStoreClient.kt @@ -0,0 +1,15 @@ +package storage.image.client + +import storage.image.client.dto.ImageGetPreSignedObjectUrlArgs +import storage.image.client.dto.ImagePutObjectArgs +import storage.image.client.dto.ImageRemoveObjectArgs +import storage.image.client.dto.ImageWriteResponse + +interface ImageStoreClient { + + fun getPreSignedObjectUrl(args: ImageGetPreSignedObjectUrlArgs): String? + + fun removeObject(args: ImageRemoveObjectArgs): Boolean + + fun putObject(args: ImagePutObjectArgs): ImageWriteResponse? +} \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/client/S3ImageStoreClient.kt b/storage/src/main/kotlin/storage/image/client/S3ImageStoreClient.kt similarity index 96% rename from storage/src/main/kotlin/com/few/storage/image/client/S3ImageStoreClient.kt rename to storage/src/main/kotlin/storage/image/client/S3ImageStoreClient.kt index eb26cbb8a..d44b765b0 100644 --- a/storage/src/main/kotlin/com/few/storage/image/client/S3ImageStoreClient.kt +++ b/storage/src/main/kotlin/storage/image/client/S3ImageStoreClient.kt @@ -1,7 +1,7 @@ -package com.few.storage.image.client +package storage.image.client import com.amazonaws.services.s3.AmazonS3Client -import com.few.storage.image.client.dto.* +import storage.image.client.dto.* import io.github.oshai.kotlinlogging.KotlinLogging class S3ImageStoreClient( diff --git a/storage/src/main/kotlin/com/few/storage/image/client/dto/ImageObjectArgs.kt b/storage/src/main/kotlin/storage/image/client/dto/ImageObjectArgs.kt similarity index 97% rename from storage/src/main/kotlin/com/few/storage/image/client/dto/ImageObjectArgs.kt rename to storage/src/main/kotlin/storage/image/client/dto/ImageObjectArgs.kt index e4e971682..89037e2a5 100644 --- a/storage/src/main/kotlin/com/few/storage/image/client/dto/ImageObjectArgs.kt +++ b/storage/src/main/kotlin/storage/image/client/dto/ImageObjectArgs.kt @@ -1,4 +1,4 @@ -package com.few.storage.image.client.dto +package storage.image.client.dto import com.amazonaws.HttpMethod import com.amazonaws.services.s3.model.DeleteObjectRequest diff --git a/storage/src/main/kotlin/com/few/storage/image/client/dto/ImageWriteResponse.kt b/storage/src/main/kotlin/storage/image/client/dto/ImageWriteResponse.kt similarity index 79% rename from storage/src/main/kotlin/com/few/storage/image/client/dto/ImageWriteResponse.kt rename to storage/src/main/kotlin/storage/image/client/dto/ImageWriteResponse.kt index 2f42b6aee..6d186c81f 100644 --- a/storage/src/main/kotlin/com/few/storage/image/client/dto/ImageWriteResponse.kt +++ b/storage/src/main/kotlin/storage/image/client/dto/ImageWriteResponse.kt @@ -1,4 +1,4 @@ -package com.few.storage.image.client.dto +package storage.image.client.dto data class ImageWriteResponse( val bucket: String, diff --git a/storage/src/main/kotlin/com/few/storage/image/client/util/ImageArgsGenerator.kt b/storage/src/main/kotlin/storage/image/client/util/ImageArgsGenerator.kt similarity index 83% rename from storage/src/main/kotlin/com/few/storage/image/client/util/ImageArgsGenerator.kt rename to storage/src/main/kotlin/storage/image/client/util/ImageArgsGenerator.kt index cd55b43d0..f5345263d 100644 --- a/storage/src/main/kotlin/com/few/storage/image/client/util/ImageArgsGenerator.kt +++ b/storage/src/main/kotlin/storage/image/client/util/ImageArgsGenerator.kt @@ -1,8 +1,8 @@ -package com.few.storage.image.client.util +package storage.image.client.util -import com.few.storage.image.client.dto.ImageGetPreSignedObjectUrlArgs -import com.few.storage.image.client.dto.ImagePutObjectArgs -import com.few.storage.image.client.dto.ImageRemoveObjectArgs +import storage.image.client.dto.ImageGetPreSignedObjectUrlArgs +import storage.image.client.dto.ImagePutObjectArgs +import storage.image.client.dto.ImageRemoveObjectArgs import org.apache.http.entity.ContentType import java.io.BufferedInputStream import java.io.File diff --git a/storage/src/main/kotlin/com/few/storage/image/config/ImageStorageConfig.kt b/storage/src/main/kotlin/storage/image/config/ImageStorageConfig.kt similarity index 52% rename from storage/src/main/kotlin/com/few/storage/image/config/ImageStorageConfig.kt rename to storage/src/main/kotlin/storage/image/config/ImageStorageConfig.kt index b4605d1d8..8e8412628 100644 --- a/storage/src/main/kotlin/com/few/storage/image/config/ImageStorageConfig.kt +++ b/storage/src/main/kotlin/storage/image/config/ImageStorageConfig.kt @@ -1,19 +1,16 @@ -package com.few.storage.image.config +package storage.image.config -import com.few.storage.config.ClientConfig +import storage.config.StorageClientConfig import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import @Configuration @ComponentScan(basePackages = [ImageStorageConfig.BASE_PACKAGE]) -@Import(ClientConfig::class) +@Import(StorageClientConfig::class) class ImageStorageConfig { companion object { - const val BASE_PACKAGE = "com.few.storage.image" - const val SERVICE_NAME = "imageStorage" - const val MODULE_NAME = "storage-image" + const val BASE_PACKAGE = "storage.image" const val BEAN_NAME_PREFIX = "imageStore" - const val PROPERTY_PREFIX = SERVICE_NAME + "." + MODULE_NAME } } \ No newline at end of file diff --git a/storage/src/main/kotlin/com/few/storage/image/config/S3ImageStoreConfig.kt b/storage/src/main/kotlin/storage/image/config/S3ImageStoreConfig.kt similarity index 89% rename from storage/src/main/kotlin/com/few/storage/image/config/S3ImageStoreConfig.kt rename to storage/src/main/kotlin/storage/image/config/S3ImageStoreConfig.kt index 8a394fb1c..7234537dc 100644 --- a/storage/src/main/kotlin/com/few/storage/image/config/S3ImageStoreConfig.kt +++ b/storage/src/main/kotlin/storage/image/config/S3ImageStoreConfig.kt @@ -1,8 +1,8 @@ -package com.few.storage.image.config +package storage.image.config import com.amazonaws.services.s3.AmazonS3Client -import com.few.storage.image.client.ImageStoreClient -import com.few.storage.image.client.S3ImageStoreClient +import storage.image.client.ImageStoreClient +import storage.image.client.S3ImageStoreClient import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.beans.factory.annotation.Value import org.springframework.context.ApplicationListener diff --git a/storage/src/main/kotlin/com/few/storage/image/service/support/CdnProperty.kt b/storage/src/main/kotlin/storage/image/config/properties/CdnProperty.kt similarity index 80% rename from storage/src/main/kotlin/com/few/storage/image/service/support/CdnProperty.kt rename to storage/src/main/kotlin/storage/image/config/properties/CdnProperty.kt index 3fe8bdca4..a64781fcd 100644 --- a/storage/src/main/kotlin/com/few/storage/image/service/support/CdnProperty.kt +++ b/storage/src/main/kotlin/storage/image/config/properties/CdnProperty.kt @@ -1,4 +1,4 @@ -package com.few.storage.image.service.support +package storage.image.config.properties import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component diff --git a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3GetPreSignedImageUrlService.kt b/storage/src/main/kotlin/storage/image/provider/s3/S3GetPreSignedImageUrlProvider.kt similarity index 59% rename from storage/src/main/kotlin/com/few/storage/image/service/s3/S3GetPreSignedImageUrlService.kt rename to storage/src/main/kotlin/storage/image/provider/s3/S3GetPreSignedImageUrlProvider.kt index 77dd026e5..f99940022 100644 --- a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3GetPreSignedImageUrlService.kt +++ b/storage/src/main/kotlin/storage/image/provider/s3/S3GetPreSignedImageUrlProvider.kt @@ -1,16 +1,16 @@ -package com.few.storage.image.service.s3 +package storage.image.provider.s3 -import com.few.storage.image.client.ImageStoreClient -import com.few.storage.image.client.util.ImageArgsGenerator -import com.few.storage.image.service.GetPreSignedImageUrlService +import storage.image.client.ImageStoreClient +import storage.image.client.util.ImageArgsGenerator +import storage.image.GetPreSignedImageUrlProvider import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service @Service -class S3GetPreSignedImageUrlService( +class S3GetPreSignedImageUrlProvider( @Value("\${image.store.bucket-name}") val bucket: String, private val imageStoreClient: ImageStoreClient, -) : GetPreSignedImageUrlService { +) : GetPreSignedImageUrlProvider { override fun execute(image: String): String? { ImageArgsGenerator.preSignedUrl(bucket, image).let { args -> return imageStoreClient.getPreSignedObjectUrl(args) diff --git a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3PutImageService.kt b/storage/src/main/kotlin/storage/image/provider/s3/S3PutImageProvider.kt similarity index 59% rename from storage/src/main/kotlin/com/few/storage/image/service/s3/S3PutImageService.kt rename to storage/src/main/kotlin/storage/image/provider/s3/S3PutImageProvider.kt index 09fbc31e6..2f5d99512 100644 --- a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3PutImageService.kt +++ b/storage/src/main/kotlin/storage/image/provider/s3/S3PutImageProvider.kt @@ -1,18 +1,18 @@ -package com.few.storage.image.service.s3 +package storage.image.provider.s3 -import com.few.storage.image.client.ImageStoreClient -import com.few.storage.image.client.dto.ImageWriteResponse -import com.few.storage.image.client.util.ImageArgsGenerator -import com.few.storage.image.service.PutImageService +import storage.image.client.ImageStoreClient +import storage.image.client.dto.ImageWriteResponse +import storage.image.client.util.ImageArgsGenerator +import storage.image.PutImageProvider import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service import java.io.File @Service -class S3PutImageService( +class S3PutImageProvider( @Value("\${image.store.bucket-name}") val bucket: String, private val imageStoreClient: ImageStoreClient, -) : PutImageService { +) : PutImageProvider { override fun execute(name: String, file: File): ImageWriteResponse? { ImageArgsGenerator.putImage(bucket, name, file).let { args -> return imageStoreClient.putObject(args) diff --git a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3RemoveImageService.kt b/storage/src/main/kotlin/storage/image/provider/s3/S3RemoveImageProvider.kt similarity index 61% rename from storage/src/main/kotlin/com/few/storage/image/service/s3/S3RemoveImageService.kt rename to storage/src/main/kotlin/storage/image/provider/s3/S3RemoveImageProvider.kt index db1f80ffa..d4b922625 100644 --- a/storage/src/main/kotlin/com/few/storage/image/service/s3/S3RemoveImageService.kt +++ b/storage/src/main/kotlin/storage/image/provider/s3/S3RemoveImageProvider.kt @@ -1,16 +1,16 @@ -package com.few.storage.image.service.s3 +package storage.image.provider.s3 -import com.few.storage.image.client.ImageStoreClient -import com.few.storage.image.client.util.ImageArgsGenerator -import com.few.storage.image.service.RemoveImageService +import storage.image.client.ImageStoreClient +import storage.image.client.util.ImageArgsGenerator +import storage.image.RemoveImageProvider import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service @Service -class S3RemoveImageService( +class S3RemoveImageProvider( @Value("\${image.store.bucket-name}") val bucket: String, private val imageStoreClient: ImageStoreClient, -) : RemoveImageService { +) : RemoveImageProvider { override fun execute(image: String): Boolean { ImageArgsGenerator.remove(bucket, image).let { args -> return imageStoreClient.removeObject(args) diff --git a/web/build.gradle.kts b/web/build.gradle.kts new file mode 100644 index 000000000..35dfb37bc --- /dev/null +++ b/web/build.gradle.kts @@ -0,0 +1,14 @@ +tasks.getByName("bootJar") { + enabled = false +} + +tasks.getByName("jar") { + enabled = true +} + +dependencies { + api(project(":security")) + + /** spring starter */ + implementation("org.springframework.boot:spring-boot-starter-web") +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/support/ApiResponse.kt b/web/src/main/kotlin/web/ApiResponse.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/web/support/ApiResponse.kt rename to web/src/main/kotlin/web/ApiResponse.kt index 7a591efac..d6b0c9135 100644 --- a/api/src/main/kotlin/com/few/api/web/support/ApiResponse.kt +++ b/web/src/main/kotlin/web/ApiResponse.kt @@ -1,28 +1,20 @@ -package com.few.api.web.support +package web import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import java.io.Serializable -/** API 응답 객체 */ class ApiResponse : ResponseEntity { constructor(status: HttpStatus?) : super(status!!) constructor(body: B, status: HttpStatus?) : super(body, status!!) - /** API 응답 실패 객체 */ class FailureBody(val message: String) : Serializable - /** - * API 응답 성공 객체 - * - * @param 데이터 타입 - * */ class SuccessBody( val data: D, val message: String, ) : Serializable - /** API 응답 성공 객체 */ class Success( val message: String, ) : Serializable diff --git a/web/src/main/kotlin/web/ApiResponseGenerator.kt b/web/src/main/kotlin/web/ApiResponseGenerator.kt new file mode 100644 index 000000000..a961d1895 --- /dev/null +++ b/web/src/main/kotlin/web/ApiResponseGenerator.kt @@ -0,0 +1,62 @@ +package web + +import org.springframework.http.HttpStatus + +object ApiResponseGenerator { + + fun success(status: HttpStatus): ApiResponse { + return ApiResponse( + ApiResponse.Success(MessageCode.SUCCESS.value), + status + ) + } + + fun success( + status: HttpStatus, + code: MessageCode, + ): ApiResponse { + return ApiResponse(ApiResponse.Success(code.value), status) + } + + fun success( + data: D, + status: HttpStatus, + ): ApiResponse> { + return ApiResponse( + ApiResponse.SuccessBody( + data, + MessageCode.SUCCESS.value + ), + status + ) + } + + fun success( + data: D, + status: HttpStatus, + code: MessageCode, + ): ApiResponse> { + return ApiResponse( + ApiResponse.SuccessBody(data, code.value), + status + ) + } + + fun fail(status: HttpStatus): ApiResponse { + return ApiResponse(status) + } + + fun fail( + body: ApiResponse.FailureBody, + status: HttpStatus, + ): ApiResponse { + return ApiResponse(body, status) + } + + fun fail( + message: String, + status: HttpStatus, + ): ApiResponse { + return ApiResponse(ApiResponse.FailureBody(message), status) + } +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/support/MessageCode.kt b/web/src/main/kotlin/web/MessageCode.kt similarity index 60% rename from api/src/main/kotlin/com/few/api/web/support/MessageCode.kt rename to web/src/main/kotlin/web/MessageCode.kt index 008d3b432..be8c84f80 100644 --- a/api/src/main/kotlin/com/few/api/web/support/MessageCode.kt +++ b/web/src/main/kotlin/web/MessageCode.kt @@ -1,16 +1,8 @@ -package com.few.api.web.support +package web -/** 메시지 코드 */ enum class MessageCode(val code: String, val value: String) { - /** 성공 메시지 코드 */ SUCCESS("success", "성공"), - - /** 삭제 메시지 코드 */ RESOURCE_DELETED("resource.deleted", "삭제되었습니다."), - - /** 수정 메시지 코드 */ RESOURCE_UPDATED("resource.updated", "수정되었습니다."), - - /** 생성 메시지 코드 */ RESOURCE_CREATED("resource.created", "새로 생성되었습니다."), } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/support/method/UserArgument.kt b/web/src/main/kotlin/web/UserArgument.kt similarity index 74% rename from api/src/main/kotlin/com/few/api/web/support/method/UserArgument.kt rename to web/src/main/kotlin/web/UserArgument.kt index 1fd913a0b..0d8dfd190 100644 --- a/api/src/main/kotlin/com/few/api/web/support/method/UserArgument.kt +++ b/web/src/main/kotlin/web/UserArgument.kt @@ -1,4 +1,4 @@ -package com.few.api.web.support.method +package web @Target(AnnotationTarget.VALUE_PARAMETER) @Retention(AnnotationRetention.RUNTIME) diff --git a/api/src/main/kotlin/com/few/api/web/support/method/UserArgumentDetails.kt b/web/src/main/kotlin/web/UserArgumentDetails.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/web/support/method/UserArgumentDetails.kt rename to web/src/main/kotlin/web/UserArgumentDetails.kt index 2dfe9af73..4256b1c6a 100644 --- a/api/src/main/kotlin/com/few/api/web/support/method/UserArgumentDetails.kt +++ b/web/src/main/kotlin/web/UserArgumentDetails.kt @@ -1,7 +1,7 @@ -package com.few.api.web.support.method +package web -import com.few.api.security.authentication.token.TokenUserDetails import org.springframework.security.core.GrantedAuthority +import security.TokenUserDetails class UserArgumentDetails( val isAuth: Boolean, diff --git a/api/src/main/kotlin/com/few/api/web/support/method/UserArgumentHandlerMethodArgumentResolver.kt b/web/src/main/kotlin/web/UserArgumentHandlerMethodArgumentResolver.kt similarity index 89% rename from api/src/main/kotlin/com/few/api/web/support/method/UserArgumentHandlerMethodArgumentResolver.kt rename to web/src/main/kotlin/web/UserArgumentHandlerMethodArgumentResolver.kt index e44f5f555..43671ce23 100644 --- a/api/src/main/kotlin/com/few/api/web/support/method/UserArgumentHandlerMethodArgumentResolver.kt +++ b/web/src/main/kotlin/web/UserArgumentHandlerMethodArgumentResolver.kt @@ -1,8 +1,6 @@ -package com.few.api.web.support.method +package web -import com.few.api.security.authentication.authority.AuthorityUtils -import com.few.api.security.filter.token.AccessTokenResolver -import com.few.api.security.token.TokenResolver +import security.AuthorityUtils import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.core.MethodParameter import org.springframework.stereotype.Component @@ -10,6 +8,8 @@ import org.springframework.web.bind.support.WebDataBinderFactory import org.springframework.web.context.request.NativeWebRequest import org.springframework.web.method.support.HandlerMethodArgumentResolver import org.springframework.web.method.support.ModelAndViewContainer +import security.TokenResolver +import web.security.filter.token.AccessTokenResolver @Component class UserArgumentHandlerMethodArgumentResolver( diff --git a/api/src/main/kotlin/com/few/api/client/config/properties/DiscordBodyProperty.kt b/web/src/main/kotlin/web/client/DiscordBodyProperty.kt similarity index 78% rename from api/src/main/kotlin/com/few/api/client/config/properties/DiscordBodyProperty.kt rename to web/src/main/kotlin/web/client/DiscordBodyProperty.kt index fcef50e7c..6a02b88c5 100644 --- a/api/src/main/kotlin/com/few/api/client/config/properties/DiscordBodyProperty.kt +++ b/web/src/main/kotlin/web/client/DiscordBodyProperty.kt @@ -1,4 +1,4 @@ -package com.few.api.client.config.properties +package web.client data class DiscordBodyProperty( val content: String, diff --git a/api/src/main/kotlin/com/few/api/client/config/ClientConfig.kt b/web/src/main/kotlin/web/client/config/ClientConfig.kt similarity index 80% rename from api/src/main/kotlin/com/few/api/client/config/ClientConfig.kt rename to web/src/main/kotlin/web/client/config/ClientConfig.kt index da9507a0e..a24d0b65a 100644 --- a/api/src/main/kotlin/com/few/api/client/config/ClientConfig.kt +++ b/web/src/main/kotlin/web/client/config/ClientConfig.kt @@ -1,4 +1,4 @@ -package com.few.api.client.config +package web.client.config import org.springframework.beans.factory.annotation.Value import org.springframework.boot.web.client.RestTemplateBuilder @@ -13,8 +13,8 @@ class ClientConfig { @Bean fun restTemplate( restTemplateBuilder: RestTemplateBuilder, - @Value("\${client.timeout.connect}") connectTimeout: Int, - @Value("\${client.timeout.read}") readTimeout: Int, + @Value("\${web.client.timeout.connect}") connectTimeout: Int, + @Value("\${web.client.timeout.read}") readTimeout: Int, ): RestTemplate { return restTemplateBuilder .setConnectTimeout(Duration.ofSeconds(connectTimeout.toLong())) diff --git a/api/src/main/kotlin/com/few/api/config/ClonedTaskDecorator.kt b/web/src/main/kotlin/web/config/ClonedTaskDecorator.kt similarity index 93% rename from api/src/main/kotlin/com/few/api/config/ClonedTaskDecorator.kt rename to web/src/main/kotlin/web/config/ClonedTaskDecorator.kt index 2455ffd09..51989e9bc 100644 --- a/api/src/main/kotlin/com/few/api/config/ClonedTaskDecorator.kt +++ b/web/src/main/kotlin/web/config/ClonedTaskDecorator.kt @@ -1,4 +1,4 @@ -package com.few.api.config +package web.config import org.slf4j.MDC import org.springframework.core.task.TaskDecorator diff --git a/web/src/main/kotlin/web/config/WebConfig.kt b/web/src/main/kotlin/web/config/WebConfig.kt new file mode 100644 index 000000000..5fdea25c3 --- /dev/null +++ b/web/src/main/kotlin/web/config/WebConfig.kt @@ -0,0 +1,18 @@ +package web.config + +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Import +import security.config.SecurityConfig + +@Configuration +@ComponentScan(basePackages = [WebConfig.BASE_PACKAGE]) +@Import( + SecurityConfig::class +) +class WebConfig { + companion object { + const val BASE_PACKAGE = "web" + const val BEAN_NAME_PREFIX = "web" + } +} \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/web/config/WebConfig.kt b/web/src/main/kotlin/web/config/WebConfigurer.kt similarity index 69% rename from api/src/main/kotlin/com/few/api/web/config/WebConfig.kt rename to web/src/main/kotlin/web/config/WebConfigurer.kt index aec76da83..954acd4db 100644 --- a/api/src/main/kotlin/com/few/api/web/config/WebConfig.kt +++ b/web/src/main/kotlin/web/config/WebConfigurer.kt @@ -1,19 +1,18 @@ -package com.few.api.web.config +package web.config -import com.few.api.web.config.converter.* -import com.few.api.web.support.method.UserArgumentHandlerMethodArgumentResolver import org.springframework.context.annotation.Configuration -import org.springframework.format.FormatterRegistry import org.springframework.web.cors.CorsConfiguration import org.springframework.web.method.support.HandlerMethodArgumentResolver import org.springframework.web.servlet.config.annotation.CorsRegistry import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurer +import web.UserArgumentHandlerMethodArgumentResolver @Configuration -class WebConfig( +class WebConfigurer( private val userArgumentHandlerMethodArgumentResolver: UserArgumentHandlerMethodArgumentResolver, ) : WebMvcConfigurer { + override fun addCorsMappings(registry: CorsRegistry) { registry.addMapping("/**") .allowedOriginPatterns(CorsConfiguration.ALL) @@ -28,14 +27,6 @@ class WebConfig( .addResourceLocations("classpath:/static/") } - override fun addFormatters(registry: FormatterRegistry) { - registry.addConverter(WorkBookCategoryConverter()) - registry.addConverter(ViewConverter()) - registry.addConverter(DayCodeConverter()) - registry.addConverter(EmailLogEventTypeConverter()) - registry.addConverter(SendTypeConverter()) - } - override fun addArgumentResolvers(argumentResolvers: MutableList) { argumentResolvers.add(userArgumentHandlerMethodArgumentResolver) } diff --git a/api/src/main/kotlin/com/few/api/web/filter/MDCFilter.kt b/web/src/main/kotlin/web/filter/MDCLogFilter.kt similarity index 94% rename from api/src/main/kotlin/com/few/api/web/filter/MDCFilter.kt rename to web/src/main/kotlin/web/filter/MDCLogFilter.kt index 3df596039..5a2124a79 100644 --- a/api/src/main/kotlin/com/few/api/web/filter/MDCFilter.kt +++ b/web/src/main/kotlin/web/filter/MDCLogFilter.kt @@ -1,4 +1,4 @@ -package com.few.api.web.filter +package web.filter import com.fasterxml.jackson.databind.ObjectMapper import io.github.oshai.kotlinlogging.KotlinLogging @@ -13,7 +13,7 @@ import org.springframework.http.HttpHeaders import org.springframework.stereotype.Component @Component -class MDCFilter(private val mapper: ObjectMapper) : Filter { +class MDCLogFilter(private val mapper: ObjectMapper) : Filter { private val log = KotlinLogging.logger {} override fun doFilter( diff --git a/api/src/main/kotlin/com/few/api/web/handler/ApiControllerExceptionHandler.kt b/web/src/main/kotlin/web/handler/ControllerExceptionHandler.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/web/handler/ApiControllerExceptionHandler.kt rename to web/src/main/kotlin/web/handler/ControllerExceptionHandler.kt index adfe9ada2..56c7e92ae 100644 --- a/api/src/main/kotlin/com/few/api/web/handler/ApiControllerExceptionHandler.kt +++ b/web/src/main/kotlin/web/handler/ControllerExceptionHandler.kt @@ -1,12 +1,5 @@ -package com.few.api.web.handler +package web.handler -import com.few.api.exception.common.ExternalIntegrationException -import com.few.api.exception.common.InsertException -import com.few.api.exception.common.NotFoundException -import com.few.api.exception.member.NotValidTokenException -import com.few.api.exception.subscribe.SubscribeIllegalArgumentException -import com.few.api.web.support.ApiResponse -import com.few.api.web.support.ApiResponseGenerator import jakarta.servlet.http.HttpServletRequest import jakarta.validation.ConstraintViolationException import org.springframework.beans.TypeMismatchException @@ -20,41 +13,15 @@ import org.springframework.web.bind.annotation.RestControllerAdvice import org.springframework.web.bind.support.WebExchangeBindException import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException import org.springframework.web.server.ServerWebInputException +import web.ApiResponse +import web.ApiResponseGenerator import java.nio.file.AccessDeniedException -/** API 요청 처리 중 발생하는 예외를 처리하는 핸들러 */ @RestControllerAdvice -class ApiControllerExceptionHandler( +class ControllerExceptionHandler( private val loggingHandler: LoggingHandler, ) { - @ExceptionHandler(ExternalIntegrationException::class, InsertException::class, NotFoundException::class) - fun handleCommonException( - ex: Exception, - request: HttpServletRequest, - ): ApiResponse { - loggingHandler.writeLog(ex, request) - return ApiResponseGenerator.fail(ex.message!!, HttpStatus.BAD_REQUEST) - } - - @ExceptionHandler(SubscribeIllegalArgumentException::class) - fun handleSubscribeException( - ex: Exception, - request: HttpServletRequest, - ): ApiResponse { - loggingHandler.writeLog(ex, request) - return ApiResponseGenerator.fail(ex.message!!, HttpStatus.BAD_REQUEST) - } - - @ExceptionHandler(NotValidTokenException::class) - fun handleTokenException( - ex: Exception, - request: HttpServletRequest, - ): ApiResponse { - loggingHandler.writeLog(ex, request) - return ApiResponseGenerator.fail(ex.message!!, HttpStatus.BAD_REQUEST) - } - @ExceptionHandler(IllegalArgumentException::class) fun handleBadRequest( ex: IllegalArgumentException, diff --git a/api/src/main/kotlin/com/few/api/web/handler/ExceptionMessage.kt b/web/src/main/kotlin/web/handler/ExceptionMessage.kt similarity index 96% rename from api/src/main/kotlin/com/few/api/web/handler/ExceptionMessage.kt rename to web/src/main/kotlin/web/handler/ExceptionMessage.kt index cf462a873..06201776a 100644 --- a/api/src/main/kotlin/com/few/api/web/handler/ExceptionMessage.kt +++ b/web/src/main/kotlin/web/handler/ExceptionMessage.kt @@ -1,4 +1,4 @@ -package com.few.api.web.handler +package web.handler enum class ExceptionMessage(val code: String, val message: String) { FAIL("fail", "알 수 없는 오류가 발생했어요."), diff --git a/api/src/main/kotlin/com/few/api/web/handler/LoggingHandler.kt b/web/src/main/kotlin/web/handler/LoggingHandler.kt similarity index 99% rename from api/src/main/kotlin/com/few/api/web/handler/LoggingHandler.kt rename to web/src/main/kotlin/web/handler/LoggingHandler.kt index 2f9c934b5..ed7ec2454 100644 --- a/api/src/main/kotlin/com/few/api/web/handler/LoggingHandler.kt +++ b/web/src/main/kotlin/web/handler/LoggingHandler.kt @@ -1,10 +1,9 @@ -package com.few.api.web.handler +package web.handler import io.github.oshai.kotlinlogging.KotlinLogging import jakarta.servlet.http.HttpServletRequest import org.springframework.stereotype.Component -/** 로깅을 담당하는 핸들러 */ @Component class LoggingHandler { private val log = KotlinLogging.logger {} diff --git a/web/src/main/kotlin/web/security/config/AbstractDelegatedSecurityConfig.kt b/web/src/main/kotlin/web/security/config/AbstractDelegatedSecurityConfig.kt new file mode 100644 index 000000000..ba8080670 --- /dev/null +++ b/web/src/main/kotlin/web/security/config/AbstractDelegatedSecurityConfig.kt @@ -0,0 +1,60 @@ +package web.security.config + +import org.springframework.security.authentication.ProviderManager +import org.springframework.security.config.annotation.web.builders.HttpSecurity +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer +import org.springframework.security.web.DefaultSecurityFilterChain +import org.springframework.web.cors.CorsConfiguration +import org.springframework.web.cors.CorsConfigurationSource +import org.springframework.web.cors.UrlBasedCorsConfigurationSource +import org.springframework.web.filter.OncePerRequestFilter +import security.authentication.token.TokenAuthProvider +import web.security.config.properties.CorsConfigurationSourceProperties +import web.security.exception.WebTokenInvalidExceptionHandlerFilter +import web.security.filter.token.TokenAuthenticationFilter + +/** + * Security 설정을 위임하는 인터페이스. + */ +interface AbstractDelegatedSecurityConfig { + + /** + * Security 설정을 반환한다. + */ + fun securityFilterChain(http: HttpSecurity): DefaultSecurityFilterChain + + /** + * Security 설정을 무시하는 Customizer를 반환한다. + */ + fun ignoreCustomizer(): WebSecurityCustomizer + + val authenticationFilter: TokenAuthenticationFilter + get() { + val tokenAuthenticationFilter = TokenAuthenticationFilter() + val tokenAuthProvider = getTokenAuthProvider() + tokenAuthenticationFilter.setAuthenticationManager(ProviderManager(tokenAuthProvider)) + return tokenAuthenticationFilter + } + + fun getTokenAuthProvider(): TokenAuthProvider + + val webTokenInvalidExceptionHandlerFilter: OncePerRequestFilter + get() { + return WebTokenInvalidExceptionHandlerFilter() + } + + val corsConfigurationSource: CorsConfigurationSource + get() { + val configuration = CorsConfiguration() + val corsProperties = getCorsProperties() + configuration.addAllowedOriginPattern(corsProperties.originPatterns) + configuration.addAllowedHeader(corsProperties.allowedHeaders) + configuration.addAllowedMethod(corsProperties.allowedMethods) + configuration.allowCredentials = corsProperties.allowCredentials + val source = UrlBasedCorsConfigurationSource() + source.registerCorsConfiguration(corsProperties.pathPattern, configuration) + return source + } + + fun getCorsProperties(): CorsConfigurationSourceProperties +} \ No newline at end of file diff --git a/web/src/main/kotlin/web/security/config/LocalDelegatedSecurityConfig.kt b/web/src/main/kotlin/web/security/config/LocalDelegatedSecurityConfig.kt new file mode 100644 index 000000000..a24e5dbb0 --- /dev/null +++ b/web/src/main/kotlin/web/security/config/LocalDelegatedSecurityConfig.kt @@ -0,0 +1,115 @@ +package web.security.config + +import org.springframework.context.annotation.Profile +import org.springframework.http.HttpMethod +import org.springframework.security.config.annotation.web.builders.HttpSecurity +import org.springframework.security.config.annotation.web.builders.WebSecurity +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer +import org.springframework.security.config.http.SessionCreationPolicy +import org.springframework.security.web.DefaultSecurityFilterChain +import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter +import org.springframework.security.web.util.matcher.AntPathRequestMatcher +import org.springframework.stereotype.Component +import security.authentication.token.TokenAuthProvider +import web.security.config.properties.CorsConfigurationSourceProperties +import web.security.handler.DelegatedAccessDeniedHandler +import web.security.handler.DelegatedAuthenticationEntryPoint + +@Component +@Profile("!prod") +class LocalDelegatedSecurityConfig( + private val authenticationEntryPoint: DelegatedAuthenticationEntryPoint, + private val accessDeniedHandler: DelegatedAccessDeniedHandler, + private val tokenAuthProvider: TokenAuthProvider, + private val corsProperties: CorsConfigurationSourceProperties, +) : AbstractDelegatedSecurityConfig { + + override fun securityFilterChain(http: HttpSecurity): DefaultSecurityFilterChain { + http.csrf { + it.disable() + } + http.formLogin { + it.disable() + } + http.httpBasic { + it.disable() + } + http.cors { + it.configurationSource(corsConfigurationSource) + } + http.authorizeHttpRequests { + it.requestMatchers( + AntPathRequestMatcher("/api/v1/**") + ).authenticated().anyRequest().denyAll() + } + http.addFilterBefore( + webTokenInvalidExceptionHandlerFilter, + AbstractPreAuthenticatedProcessingFilter::class.java + ) + http.addFilterAt( + authenticationFilter, + AbstractPreAuthenticatedProcessingFilter::class.java + ) + http.exceptionHandling { + it.authenticationEntryPoint(authenticationEntryPoint) + it.accessDeniedHandler(accessDeniedHandler) + } + http.sessionManagement { + it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) + } + + return http.build() + } + + override fun ignoreCustomizer(): WebSecurityCustomizer { + return WebSecurityCustomizer { web: WebSecurity -> + web.ignoring() + .requestMatchers( + AntPathRequestMatcher("/actuator/health", HttpMethod.GET.name()), + AntPathRequestMatcher("/error", HttpMethod.GET.name()), + AntPathRequestMatcher("/docs/swagger-ui/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/swagger-ui/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/swagger-resources/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/v3/api-docs/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/openapi3.yaml", HttpMethod.GET.name()), + AntPathRequestMatcher("/reports/**", HttpMethod.GET.name()), + + /** 인증/비인증 모두 허용 */ + AntPathRequestMatcher( + "/api/v1/subscriptions/workbooks/main", + HttpMethod.GET.name() + ), + AntPathRequestMatcher("/api/v1/workbooks", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/articles/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), + + /** 어드민 */ + AntPathRequestMatcher("/api/v1/admin/**", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/articles/views", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/logs", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/logs/email/articles", HttpMethod.POST.name()), + AntPathRequestMatcher("/batch/**"), + + /** 인증 불필요 */ + AntPathRequestMatcher("/api/v1/members", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/members/token", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/articles", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/articles/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/problems/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/problems/*", HttpMethod.POST.name()) + ) + } + } + + override fun getTokenAuthProvider(): TokenAuthProvider { + return tokenAuthProvider + } + + override fun getCorsProperties(): CorsConfigurationSourceProperties { + return corsProperties + } +} \ No newline at end of file diff --git a/web/src/main/kotlin/web/security/config/ProdDelegatedSecurityConfig.kt b/web/src/main/kotlin/web/security/config/ProdDelegatedSecurityConfig.kt new file mode 100644 index 000000000..b570fd1d9 --- /dev/null +++ b/web/src/main/kotlin/web/security/config/ProdDelegatedSecurityConfig.kt @@ -0,0 +1,114 @@ +package web.security.config + +import org.springframework.context.annotation.Profile +import org.springframework.http.HttpMethod +import org.springframework.security.config.annotation.web.builders.HttpSecurity +import org.springframework.security.config.annotation.web.builders.WebSecurity +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer +import org.springframework.security.config.http.SessionCreationPolicy +import org.springframework.security.web.DefaultSecurityFilterChain +import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter +import org.springframework.security.web.util.matcher.AntPathRequestMatcher +import org.springframework.stereotype.Component +import security.authentication.token.TokenAuthProvider +import web.security.config.properties.CorsConfigurationSourceProperties +import web.security.handler.DelegatedAccessDeniedHandler +import web.security.handler.DelegatedAuthenticationEntryPoint + +@Component +@Profile("prod") +class ProdDelegatedSecurityConfig( + private val authenticationEntryPoint: DelegatedAuthenticationEntryPoint, + private val accessDeniedHandler: DelegatedAccessDeniedHandler, + private val tokenAuthProvider: TokenAuthProvider, + private val corsProperties: CorsConfigurationSourceProperties, +) : AbstractDelegatedSecurityConfig { + + override fun securityFilterChain(http: HttpSecurity): DefaultSecurityFilterChain { + http.csrf { + it.disable() + } + http.formLogin { + it.disable() + } + http.httpBasic { + it.disable() + } + http.cors { + it.configurationSource(corsConfigurationSource) + } + http.authorizeHttpRequests { + it.requestMatchers( + AntPathRequestMatcher("/api/v1/**") + ).authenticated().anyRequest().denyAll() + } + http.addFilterBefore( + webTokenInvalidExceptionHandlerFilter, + AbstractPreAuthenticatedProcessingFilter::class.java + ) + http.addFilterAt( + authenticationFilter, + AbstractPreAuthenticatedProcessingFilter::class.java + ) + http.exceptionHandling { + it.authenticationEntryPoint(authenticationEntryPoint) + it.accessDeniedHandler(accessDeniedHandler) + } + http.sessionManagement { + it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) + } + return http.build() + } + + override fun getTokenAuthProvider(): TokenAuthProvider { + return tokenAuthProvider + } + + override fun getCorsProperties(): CorsConfigurationSourceProperties { + return corsProperties + } + + override fun ignoreCustomizer(): WebSecurityCustomizer { + return WebSecurityCustomizer { web: WebSecurity -> + web.ignoring() + .requestMatchers( + AntPathRequestMatcher("/actuator/health", HttpMethod.GET.name()), + AntPathRequestMatcher("/error", HttpMethod.GET.name()), + AntPathRequestMatcher("/docs/swagger-ui/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/swagger-ui/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/swagger-resources/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/v3/api-docs/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/openapi3.yaml", HttpMethod.GET.name()), + AntPathRequestMatcher("/reports/**", HttpMethod.GET.name()), + + /** 인증/비인증 모두 허용 */ + AntPathRequestMatcher( + "/api/v1/subscriptions/workbooks/main", + HttpMethod.GET.name() + ), + AntPathRequestMatcher("/api/v1/workbooks", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/articles/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), + + /** 어드민 */ + AntPathRequestMatcher("/api/v1/admin/**", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/articles/views", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/logs/email/articles", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/logs", HttpMethod.POST.name()), + AntPathRequestMatcher("/batch/**"), + + /** 인증 불필요 */ + AntPathRequestMatcher("/api/v1/members", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/members/token", HttpMethod.POST.name()), + AntPathRequestMatcher("/api/v1/articles", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/articles/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/categories", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/workbooks/*/articles/*", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/problems/**", HttpMethod.GET.name()), + AntPathRequestMatcher("/api/v1/problems/*", HttpMethod.POST.name()) + ) + } + } +} \ No newline at end of file diff --git a/web/src/main/kotlin/web/security/config/WebSecurityConfig.kt b/web/src/main/kotlin/web/security/config/WebSecurityConfig.kt new file mode 100644 index 000000000..c535597c8 --- /dev/null +++ b/web/src/main/kotlin/web/security/config/WebSecurityConfig.kt @@ -0,0 +1,31 @@ +package web.security.config + +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Import +import org.springframework.security.config.annotation.web.builders.HttpSecurity +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer +import org.springframework.security.web.SecurityFilterChain +import web.config.WebConfig + +@EnableWebSecurity +@Configuration +@Import( + ProdDelegatedSecurityConfig::class, + LocalDelegatedSecurityConfig::class +) +class WebSecurityConfig( + private val securityFilterChainDelegator: AbstractDelegatedSecurityConfig, +) { + + @Bean(name = [WebConfig.BEAN_NAME_PREFIX + "SecurityFilterChain"]) + fun securityFilterChain(http: HttpSecurity): SecurityFilterChain { + return securityFilterChainDelegator.securityFilterChain(http) + } + + @Bean(name = [WebConfig.BEAN_NAME_PREFIX + "WebSecurityCustomizer"]) + fun webSecurityFilterIgnoreCustomizer(): WebSecurityCustomizer { + return securityFilterChainDelegator.ignoreCustomizer() + } +} \ No newline at end of file diff --git a/web/src/main/kotlin/web/security/config/properties/CorsConfigurationSourceProperties.kt b/web/src/main/kotlin/web/security/config/properties/CorsConfigurationSourceProperties.kt new file mode 100644 index 000000000..172e5f7c1 --- /dev/null +++ b/web/src/main/kotlin/web/security/config/properties/CorsConfigurationSourceProperties.kt @@ -0,0 +1,22 @@ +package web.security.config.properties + +import org.springframework.beans.factory.annotation.Value +import org.springframework.stereotype.Component + +@Component +data class CorsConfigurationSourceProperties( + @Value("\${web.security.cors.path-patterns}") + val pathPattern: String, + @Value("\${web.security.cors.origin-patterns}") + val originPatterns: String, + @Value("\${web.security.cors.allowed-methods}") + val allowedMethods: String, + @Value("\${web.security.cors.allowed-headers}") + val allowedHeaders: String, + @Value("\${web.security.cors.exposed-headers}") + val exposedHeaders: String, + @Value("\${web.security.cors.allow-credentials}") + val allowCredentials: Boolean, + @Value("\${web.security.cors.max-age}") + val maxAge: Long, +) \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/filter/exception/TokenInvalidExceptionHandlerFilter.kt b/web/src/main/kotlin/web/security/exception/WebTokenInvalidExceptionHandlerFilter.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/security/filter/exception/TokenInvalidExceptionHandlerFilter.kt rename to web/src/main/kotlin/web/security/exception/WebTokenInvalidExceptionHandlerFilter.kt index 8a18baa71..04f0f469c 100644 --- a/api/src/main/kotlin/com/few/api/security/filter/exception/TokenInvalidExceptionHandlerFilter.kt +++ b/web/src/main/kotlin/web/security/exception/WebTokenInvalidExceptionHandlerFilter.kt @@ -1,13 +1,13 @@ -package com.few.api.security.filter.exception +package web.security.exception -import com.few.api.security.exception.AccessTokenInvalidException import jakarta.servlet.FilterChain import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import org.springframework.web.filter.OncePerRequestFilter +import security.exception.SecurityAccessTokenInvalidException import java.io.IOException -class TokenInvalidExceptionHandlerFilter : OncePerRequestFilter() { +class WebTokenInvalidExceptionHandlerFilter : OncePerRequestFilter() { companion object { private const val CONTENT_TYPE = "application/json; charset=UTF-8" } @@ -19,7 +19,7 @@ class TokenInvalidExceptionHandlerFilter : OncePerRequestFilter() { ) { try { filterChain.doFilter(request, response) - } catch (e: AccessTokenInvalidException) { + } catch (e: SecurityAccessTokenInvalidException) { setError(response, e) } } @@ -33,12 +33,8 @@ class TokenInvalidExceptionHandlerFilter : OncePerRequestFilter() { } private class ErrorResponse { - - companion object { - private const val message = "인증이 필요해요." - } override fun toString(): String { - return "{ \"message\": \"$message\" }" + return "{ \"message\": \"Invalid access token\" }" } } } \ No newline at end of file diff --git a/api/src/main/kotlin/com/few/api/security/filter/token/AccessTokenResolver.kt b/web/src/main/kotlin/web/security/filter/token/AccessTokenResolver.kt similarity index 72% rename from api/src/main/kotlin/com/few/api/security/filter/token/AccessTokenResolver.kt rename to web/src/main/kotlin/web/security/filter/token/AccessTokenResolver.kt index e0bc9e28c..31e4e1d94 100644 --- a/api/src/main/kotlin/com/few/api/security/filter/token/AccessTokenResolver.kt +++ b/web/src/main/kotlin/web/security/filter/token/AccessTokenResolver.kt @@ -1,25 +1,25 @@ -package com.few.api.security.filter.token +package web.security.filter.token -import com.few.api.security.exception.AccessTokenInvalidException import io.github.oshai.kotlinlogging.KotlinLogging +import security.exception.SecurityAccessTokenInvalidException import java.util.regex.Pattern object AccessTokenResolver { - private val log = KotlinLogging.logger {} - private val PATTERN_AUTHORIZATION_HEADER = Pattern.compile("^[Bb]earer (.*)$") + fun resolve(authorization: String): String { val matcher = PATTERN_AUTHORIZATION_HEADER.matcher(authorization) if (!matcher.matches()) { - val exception: AccessTokenInvalidException = + val exception: SecurityAccessTokenInvalidException = getAccessTokenInvalidException("Authorization header is not a Bearer token") throw exception } return matcher.group(1) } - private fun getAccessTokenInvalidException(message: String): AccessTokenInvalidException { - val exception = AccessTokenInvalidException(message) + + private fun getAccessTokenInvalidException(message: String): SecurityAccessTokenInvalidException { + val exception = SecurityAccessTokenInvalidException(message) log.warn { exception.message } return exception } diff --git a/api/src/main/kotlin/com/few/api/security/filter/token/TokenAuthenticationFilter.kt b/web/src/main/kotlin/web/security/filter/token/TokenAuthenticationFilter.kt similarity index 80% rename from api/src/main/kotlin/com/few/api/security/filter/token/TokenAuthenticationFilter.kt rename to web/src/main/kotlin/web/security/filter/token/TokenAuthenticationFilter.kt index acc507376..80138a494 100644 --- a/api/src/main/kotlin/com/few/api/security/filter/token/TokenAuthenticationFilter.kt +++ b/web/src/main/kotlin/web/security/filter/token/TokenAuthenticationFilter.kt @@ -1,13 +1,11 @@ -package com.few.api.security.filter.token +package web.security.filter.token -import com.few.api.security.exception.AccessTokenInvalidException import io.github.oshai.kotlinlogging.KotlinLogging import jakarta.servlet.http.HttpServletRequest import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter -import java.util.* +import security.exception.SecurityAccessTokenInvalidException class TokenAuthenticationFilter : AbstractPreAuthenticatedProcessingFilter() { - private val log = KotlinLogging.logger {} override fun getPreAuthenticatedPrincipal(request: HttpServletRequest): Any { @@ -23,14 +21,14 @@ class TokenAuthenticationFilter : AbstractPreAuthenticatedProcessingFilter() { return authorization?.let { AccessTokenResolver.resolve(it) } ?: run { - val exception: AccessTokenInvalidException = + val exception: SecurityAccessTokenInvalidException = getAccessTokenInvalidException("Authorization header is missing") throw exception } } - private fun getAccessTokenInvalidException(message: String): AccessTokenInvalidException { - val exception = AccessTokenInvalidException(message) + private fun getAccessTokenInvalidException(message: String): SecurityAccessTokenInvalidException { + val exception = SecurityAccessTokenInvalidException(message) log.warn { exception.message } return exception } diff --git a/api/src/main/kotlin/com/few/api/security/handler/DelegatedAccessDeniedHandler.kt b/web/src/main/kotlin/web/security/handler/DelegatedAccessDeniedHandler.kt similarity index 95% rename from api/src/main/kotlin/com/few/api/security/handler/DelegatedAccessDeniedHandler.kt rename to web/src/main/kotlin/web/security/handler/DelegatedAccessDeniedHandler.kt index b7c7df610..36ff5bc36 100644 --- a/api/src/main/kotlin/com/few/api/security/handler/DelegatedAccessDeniedHandler.kt +++ b/web/src/main/kotlin/web/security/handler/DelegatedAccessDeniedHandler.kt @@ -1,11 +1,11 @@ -package com.few.api.security.handler +package web.security.handler import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import org.springframework.security.access.AccessDeniedException import org.springframework.security.web.access.AccessDeniedHandler import org.springframework.stereotype.Component import org.springframework.web.servlet.HandlerExceptionResolver +import org.springframework.security.access.AccessDeniedException @Component class DelegatedAccessDeniedHandler( diff --git a/api/src/main/kotlin/com/few/api/security/handler/DelegatedAuthenticationEntryPoint.kt b/web/src/main/kotlin/web/security/handler/DelegatedAuthenticationEntryPoint.kt similarity index 95% rename from api/src/main/kotlin/com/few/api/security/handler/DelegatedAuthenticationEntryPoint.kt rename to web/src/main/kotlin/web/security/handler/DelegatedAuthenticationEntryPoint.kt index 1545feda1..d42326ee3 100644 --- a/api/src/main/kotlin/com/few/api/security/handler/DelegatedAuthenticationEntryPoint.kt +++ b/web/src/main/kotlin/web/security/handler/DelegatedAuthenticationEntryPoint.kt @@ -1,4 +1,4 @@ -package com.few.api.security.handler +package web.security.handler import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse diff --git a/web/src/main/resources/application-web-local.yml b/web/src/main/resources/application-web-local.yml new file mode 100644 index 000000000..c4a75d6e2 --- /dev/null +++ b/web/src/main/resources/application-web-local.yml @@ -0,0 +1,17 @@ +web: + security: + cors: + path-patterns: "/**" + origin-patterns: "http://localhost:3000" + allowed-methods: "*" + allowed-headers: "*" + exposed-headers: "Set-Cookie, Authorization, Content-Type, X-Requested-With, Accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials" + allow-credentials: true + max-age: 1800 + client: + timeout: + connect: 5000 + read: 5000 + +webhook: + discord: "localhost:8080/webhook/discord/unused" diff --git a/web/src/main/resources/application-web-prd.yml b/web/src/main/resources/application-web-prd.yml new file mode 100644 index 000000000..4a9cb7862 --- /dev/null +++ b/web/src/main/resources/application-web-prd.yml @@ -0,0 +1,17 @@ +web: + security: + cors: + path-patterns: ${CORS_PATH_PATTERNS} + origin-patterns: ${CORS_ORIGIN_PATTERNS} + allowed-methods: ${CORS_ALLOWED_METHODS} + allowed-headers: ${CORS_ALLOWED_HEADERS} + exposed-headers: ${CORS_EXPOSED_HEADERS} + allow-credentials: ${CORS_ALLOW_CREDENTIALS} + max-age: ${CORS_MAX_AGE} + client: + timeout: + connect: ${TIMEOUT_CONNECT:5000} + read: ${TIMEOUT_READ:5000} + +webhook: + discord: ${WEBHOOK_DISCORD}