From 999a00b444c5ba953330de91d895aded97fa3c46 Mon Sep 17 00:00:00 2001 From: Serwio YK <56473255+Serwios@users.noreply.github.com> Date: Wed, 17 Apr 2024 00:15:17 +0300 Subject: [PATCH] [MIC] Microservices : separated to modules --- com-bot/pom.xml | 46 ++++++++ .../bot/CommunityBotApplication.java | 11 +- .../cache/ActiveRegistrationProcessCache.java | 6 +- .../bot}/cache/ActiveViewingData.java | 2 +- .../archivision/bot}/cache/CacheService.java | 2 +- .../cache/ConcurrentHashMapCacheService.java | 2 +- .../bot}/cache/InputTopicsCache.java | 2 +- .../bot}/command/AdminCommands.java | 2 +- .../bot}/command/ResponseTemplate.java | 2 +- .../bot}/command/UserCommands.java | 2 +- .../archivision/bot}/config/AWSConfig.java | 2 +- .../archivision/bot}/config/AppConfig.java | 9 +- .../archivision/bot}/config/RabbitConfig.java | 2 +- .../archivision/bot}/config/RedisConfig.java | 2 +- .../exception/MissingTelegramIdException.java | 2 +- .../exception/UnableSendMessageException.java | 2 +- .../handler/CallbackTelegramEventHandler.java | 4 +- .../handler/MessageTelegramEventHandler.java | 4 +- .../bot}/handler/TelegramEventHandler.java | 2 +- .../bot}/listener/LikesEventListener.java | 8 +- .../bot}/listener/PaymentEventListener.java | 10 +- .../archivision/bot}/mapper/TopicMapper.java | 6 +- .../archivision/bot}/mapper/UserMapper.java | 10 +- .../archivision/bot}/model/FilterResult.java | 2 +- .../com/archivision/bot/model}/LikeEvent.java | 2 +- .../com/archivision/bot}/model/Reply.java | 2 +- .../archivision/bot}/model/Subscription.java | 2 +- .../processor/TelegramUpdateProcessor.java | 8 +- .../bot}/processor/UpdateProcessor.java | 2 +- .../bot/repository}/TopicRepository.java | 5 +- .../bot/repository}/UserLikeRepo.java | 4 +- .../bot/repository}/UserRepository.java | 5 +- .../bot/sender}/MessageSender.java | 4 +- .../bot/sender}/TgMessageSender.java | 8 +- .../bot/service}/BotRegistrar.java | 2 +- .../archivision/bot/service}/BotStarter.java | 4 +- .../bot/service}/CommunityBot.java | 4 +- .../bot}/service/KeyboardBuilderService.java | 12 +-- .../bot}/service/NotificationService.java | 7 +- .../bot}/service/ProfileSender.java | 13 +-- .../archivision/bot}/service/S3Service.java | 2 +- .../bot}/service/ServiceCommandChecker.java | 9 +- .../bot}/service/StateManagerService.java | 7 +- .../bot}/service/SubscriptionService.java | 8 +- .../bot}/service/TelegramImageS3Service.java | 3 +- .../service/user/UserInteractionService.java | 8 +- .../bot}/service/user/UserLikeService.java | 12 +-- .../bot}/service/user/UserService.java | 13 +-- .../bot}/service/user/UserTopicService.java | 10 +- .../bot}/state/AbstractStateHandler.java | 17 ++- .../archivision/bot}/state/OptionalState.java | 4 +- .../archivision/bot}/state/StateHandler.java | 4 +- .../archivision/bot}/state/Validatable.java | 2 +- .../bot}/state/WithReplyOptions.java | 2 +- .../bot}/state/impl/MatchStateHandler.java | 23 ++-- .../bot}/state/impl/SettingsStateHandler.java | 21 ++-- .../impl/initial/AgeInputStateHandler.java | 26 ++--- .../impl/initial/ApproveStateHandler.java | 27 ++--- .../impl/initial/CityInputStateHandler.java | 24 ++--- .../impl/initial/DescriptionStateHandler.java | 23 ++-- .../impl/initial/GenderInputStateHandler.java | 25 ++--- .../initial/LookingForInoutStateHandler.java | 24 ++--- .../impl/initial/NameInputStateHandler.java | 24 ++--- .../impl/initial/PhotoInputStateHandler.java | 28 ++--- .../impl/initial/TopicsInputStateHandler.java | 30 +++--- .../strategy/message/MessageStrategy.java | 2 +- .../message/impl/PhotoMessageStrategy.java | 12 +-- .../message/impl/TextMessageStrategy.java | 28 ++--- .../bot}/util/DataInitializer.java | 4 +- .../bot}/util/HandlerRegister.java | 2 +- .../archivision/bot}/util/InputValidator.java | 2 +- .../bot}/util/ResourceLoaderService.java | 2 +- .../src}/main/resources/application.yml | 0 .../src}/main/resources/no_image.jpg | Bin com-common/pom.xml | 20 ++++ .../common/model}/bot/UserFlowState.java | 2 +- .../common/model}/dto/PaymentRequestDto.java | 2 +- .../common/model}/dto/TopicDto.java | 2 +- .../common/model}/dto/UserDto.java | 7 +- .../common/model}/entity/Gender.java | 2 +- .../common/model}/entity/Topic.java | 2 +- .../common/model}/entity/User.java | 4 +- .../common/model}/entity/UserLike.java | 2 +- com-matcher/pom.xml | 34 ++++++ .../matcher/CommunityMatcherApplication.java | 13 +++ .../matcher/bias/MatchingBias.java | 2 +- .../matcher/model}/MatchResult.java | 2 +- .../matcher/model}/MatchStatus.java | 2 +- .../model/UserWithMatchedProbability.java | 6 ++ .../matcher/nlp/LevenshteinAlgorithm.java | 2 +- .../matcher/nlp/TopicComparator.java | 2 +- .../service}/MatchedUsersListResolver.java | 7 +- .../matcher/service}/UserComparator.java | 4 +- .../matcher/service}/UserMatcher.java | 12 ++- com-payment/pom.xml | 28 +++++ .../payment/CommunityPaymentApplication.java | 13 +++ .../payment}/config/PayPalConfig.java | 2 +- .../payment}/controller/PayPalController.java | 8 +- .../payment/model}/PaymentEvent.java | 2 +- .../payment}/service/PayPalService.java | 4 +- pom.xml | 11 +- .../model/UserWithMatchedProbability.java | 6 -- .../community/CommunityApplicationTests.java | 11 -- .../community/matcher/UserMatcherTest.java | 98 ------------------ .../matcher/nlp/LevenshteinAlgorithmTest.java | 54 ---------- 105 files changed, 517 insertions(+), 503 deletions(-) create mode 100644 com-bot/pom.xml rename src/main/java/com/archivision/community/CommunityApplication.java => com-bot/src/main/java/com/archivision/bot/CommunityBotApplication.java (55%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/cache/ActiveRegistrationProcessCache.java (82%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/cache/ActiveViewingData.java (78%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/cache/CacheService.java (78%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/cache/ConcurrentHashMapCacheService.java (92%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/cache/InputTopicsCache.java (81%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/command/AdminCommands.java (91%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/command/ResponseTemplate.java (95%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/command/UserCommands.java (82%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/config/AWSConfig.java (96%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/config/AppConfig.java (78%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/config/RabbitConfig.java (90%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/config/RedisConfig.java (95%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/exception/MissingTelegramIdException.java (77%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/exception/UnableSendMessageException.java (80%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/handler/CallbackTelegramEventHandler.java (88%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/handler/MessageTelegramEventHandler.java (89%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/handler/TelegramEventHandler.java (62%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/listener/LikesEventListener.java (74%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/listener/PaymentEventListener.java (76%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/mapper/TopicMapper.java (79%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/mapper/UserMapper.java (90%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/model/FilterResult.java (78%) rename {src/main/java/com/archivision/community/event => com-bot/src/main/java/com/archivision/bot/model}/LikeEvent.java (72%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/model/Reply.java (94%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/model/Subscription.java (80%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/processor/TelegramUpdateProcessor.java (83%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/processor/UpdateProcessor.java (75%) rename {src/main/java/com/archivision/community/repo => com-bot/src/main/java/com/archivision/bot/repository}/TopicRepository.java (70%) rename {src/main/java/com/archivision/community/repo => com-bot/src/main/java/com/archivision/bot/repository}/UserLikeRepo.java (83%) rename {src/main/java/com/archivision/community/repo => com-bot/src/main/java/com/archivision/bot/repository}/UserRepository.java (86%) rename {src/main/java/com/archivision/community/messagesender => com-bot/src/main/java/com/archivision/bot/sender}/MessageSender.java (85%) rename {src/main/java/com/archivision/community/messagesender => com-bot/src/main/java/com/archivision/bot/sender}/TgMessageSender.java (91%) rename {src/main/java/com/archivision/community/bot => com-bot/src/main/java/com/archivision/bot/service}/BotRegistrar.java (96%) rename {src/main/java/com/archivision/community/bot => com-bot/src/main/java/com/archivision/bot/service}/BotStarter.java (86%) rename {src/main/java/com/archivision/community/bot => com-bot/src/main/java/com/archivision/bot/service}/CommunityBot.java (90%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/KeyboardBuilderService.java (87%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/NotificationService.java (85%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/ProfileSender.java (88%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/S3Service.java (97%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/ServiceCommandChecker.java (86%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/StateManagerService.java (80%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/SubscriptionService.java (91%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/TelegramImageS3Service.java (97%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/user/UserInteractionService.java (85%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/user/UserLikeService.java (72%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/user/UserService.java (88%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/service/user/UserTopicService.java (88%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/AbstractStateHandler.java (66%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/OptionalState.java (76%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/StateHandler.java (63%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/Validatable.java (62%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/WithReplyOptions.java (69%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/MatchStateHandler.java (79%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/SettingsStateHandler.java (76%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/AgeInputStateHandler.java (71%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/ApproveStateHandler.java (77%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/CityInputStateHandler.java (72%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/DescriptionStateHandler.java (79%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/GenderInputStateHandler.java (72%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/LookingForInoutStateHandler.java (71%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/NameInputStateHandler.java (70%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/PhotoInputStateHandler.java (79%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/state/impl/initial/TopicsInputStateHandler.java (78%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/strategy/message/MessageStrategy.java (77%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/strategy/message/impl/PhotoMessageStrategy.java (77%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/strategy/message/impl/TextMessageStrategy.java (74%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/util/DataInitializer.java (89%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/util/HandlerRegister.java (80%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/util/InputValidator.java (96%) rename {src/main/java/com/archivision/community => com-bot/src/main/java/com/archivision/bot}/util/ResourceLoaderService.java (94%) rename {src => com-bot/src}/main/resources/application.yml (100%) rename {src => com-bot/src}/main/resources/no_image.jpg (100%) create mode 100644 com-common/pom.xml rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/bot/UserFlowState.java (90%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/dto/PaymentRequestDto.java (78%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/dto/TopicDto.java (79%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/dto/UserDto.java (76%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/entity/Gender.java (95%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/entity/Topic.java (92%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/entity/User.java (93%) rename {src/main/java/com/archivision/community => com-common/src/main/java/com/archivision/common/model}/entity/UserLike.java (88%) create mode 100644 com-matcher/pom.xml create mode 100644 com-matcher/src/main/java/com/archivision/matcher/CommunityMatcherApplication.java rename {src/main/java/com/archivision/community => com-matcher/src/main/java/com/archivision}/matcher/bias/MatchingBias.java (83%) rename {src/main/java/com/archivision/community/matcher => com-matcher/src/main/java/com/archivision/matcher/model}/MatchResult.java (95%) rename {src/main/java/com/archivision/community/matcher => com-matcher/src/main/java/com/archivision/matcher/model}/MatchStatus.java (68%) create mode 100644 com-matcher/src/main/java/com/archivision/matcher/model/UserWithMatchedProbability.java rename {src/main/java/com/archivision/community => com-matcher/src/main/java/com/archivision}/matcher/nlp/LevenshteinAlgorithm.java (95%) rename {src/main/java/com/archivision/community => com-matcher/src/main/java/com/archivision}/matcher/nlp/TopicComparator.java (64%) rename {src/main/java/com/archivision/community/matcher => com-matcher/src/main/java/com/archivision/matcher/service}/MatchedUsersListResolver.java (83%) rename {src/main/java/com/archivision/community/matcher => com-matcher/src/main/java/com/archivision/matcher/service}/UserComparator.java (86%) rename {src/main/java/com/archivision/community/matcher => com-matcher/src/main/java/com/archivision/matcher/service}/UserMatcher.java (89%) create mode 100644 com-payment/pom.xml create mode 100644 com-payment/src/main/java/com/archivision/payment/CommunityPaymentApplication.java rename {src/main/java/com/archivision/community => com-payment/src/main/java/com/archivision/payment}/config/PayPalConfig.java (93%) rename {src/main/java/com/archivision/community => com-payment/src/main/java/com/archivision/payment}/controller/PayPalController.java (92%) rename {src/main/java/com/archivision/community/event => com-payment/src/main/java/com/archivision/payment/model}/PaymentEvent.java (76%) rename {src/main/java/com/archivision/community => com-payment/src/main/java/com/archivision/payment}/service/PayPalService.java (95%) delete mode 100644 src/main/java/com/archivision/community/matcher/model/UserWithMatchedProbability.java delete mode 100644 src/test/java/com/archivision/community/CommunityApplicationTests.java delete mode 100644 src/test/java/com/archivision/community/matcher/UserMatcherTest.java delete mode 100644 src/test/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithmTest.java diff --git a/com-bot/pom.xml b/com-bot/pom.xml new file mode 100644 index 0000000..a4fe439 --- /dev/null +++ b/com-bot/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + com.archivision + community + 0.0.1-SNAPSHOT + + + com-bot + + + 19 + 19 + UTF-8 + + + + com.archivision + com-common + 0.0.1-SNAPSHOT + compile + + + com.archivision + com-payment + 0.0.1-SNAPSHOT + compile + + + com.archivision + com-matcher + 0.0.1-SNAPSHOT + compile + + + com.archivision + com-matcher + 0.0.1-SNAPSHOT + compile + + + + \ No newline at end of file diff --git a/src/main/java/com/archivision/community/CommunityApplication.java b/com-bot/src/main/java/com/archivision/bot/CommunityBotApplication.java similarity index 55% rename from src/main/java/com/archivision/community/CommunityApplication.java rename to com-bot/src/main/java/com/archivision/bot/CommunityBotApplication.java index 6ab1adf..5dbe997 100644 --- a/src/main/java/com/archivision/community/CommunityApplication.java +++ b/com-bot/src/main/java/com/archivision/bot/CommunityBotApplication.java @@ -1,4 +1,4 @@ -package com.archivision.community; +package com.archivision.bot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,9 +6,8 @@ @SpringBootApplication @EnableScheduling -public class CommunityApplication { - public static void main(String[] args) { - - SpringApplication.run(CommunityApplication.class, args); - } +public class CommunityBotApplication { + public static void main(String[] args) { + SpringApplication.run(CommunityBotApplication.class, args); + } } diff --git a/src/main/java/com/archivision/community/cache/ActiveRegistrationProcessCache.java b/com-bot/src/main/java/com/archivision/bot/cache/ActiveRegistrationProcessCache.java similarity index 82% rename from src/main/java/com/archivision/community/cache/ActiveRegistrationProcessCache.java rename to com-bot/src/main/java/com/archivision/bot/cache/ActiveRegistrationProcessCache.java index 458f033..13bbfe5 100644 --- a/src/main/java/com/archivision/community/cache/ActiveRegistrationProcessCache.java +++ b/com-bot/src/main/java/com/archivision/bot/cache/ActiveRegistrationProcessCache.java @@ -1,7 +1,7 @@ -package com.archivision.community.cache; +package com.archivision.bot.cache; -import com.archivision.community.dto.UserDto; -import com.archivision.community.exception.MissingTelegramIdException; +import com.archivision.bot.exception.MissingTelegramIdException; +import com.archivision.common.model.dto.UserDto; import org.springframework.stereotype.Component; import java.util.Optional; diff --git a/src/main/java/com/archivision/community/cache/ActiveViewingData.java b/com-bot/src/main/java/com/archivision/bot/cache/ActiveViewingData.java similarity index 78% rename from src/main/java/com/archivision/community/cache/ActiveViewingData.java rename to com-bot/src/main/java/com/archivision/bot/cache/ActiveViewingData.java index 7291c61..84d1b7a 100644 --- a/src/main/java/com/archivision/community/cache/ActiveViewingData.java +++ b/com-bot/src/main/java/com/archivision/bot/cache/ActiveViewingData.java @@ -1,4 +1,4 @@ -package com.archivision.community.cache; +package com.archivision.bot.cache; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/cache/CacheService.java b/com-bot/src/main/java/com/archivision/bot/cache/CacheService.java similarity index 78% rename from src/main/java/com/archivision/community/cache/CacheService.java rename to com-bot/src/main/java/com/archivision/bot/cache/CacheService.java index 8872f9c..a535460 100644 --- a/src/main/java/com/archivision/community/cache/CacheService.java +++ b/com-bot/src/main/java/com/archivision/bot/cache/CacheService.java @@ -1,4 +1,4 @@ -package com.archivision.community.cache; +package com.archivision.bot.cache; import java.util.Optional; diff --git a/src/main/java/com/archivision/community/cache/ConcurrentHashMapCacheService.java b/com-bot/src/main/java/com/archivision/bot/cache/ConcurrentHashMapCacheService.java similarity index 92% rename from src/main/java/com/archivision/community/cache/ConcurrentHashMapCacheService.java rename to com-bot/src/main/java/com/archivision/bot/cache/ConcurrentHashMapCacheService.java index 958445f..7a7d359 100644 --- a/src/main/java/com/archivision/community/cache/ConcurrentHashMapCacheService.java +++ b/com-bot/src/main/java/com/archivision/bot/cache/ConcurrentHashMapCacheService.java @@ -1,4 +1,4 @@ -package com.archivision.community.cache; +package com.archivision.bot.cache; import java.util.Map; import java.util.Optional; diff --git a/src/main/java/com/archivision/community/cache/InputTopicsCache.java b/com-bot/src/main/java/com/archivision/bot/cache/InputTopicsCache.java similarity index 81% rename from src/main/java/com/archivision/community/cache/InputTopicsCache.java rename to com-bot/src/main/java/com/archivision/bot/cache/InputTopicsCache.java index ede7d1f..ff02331 100644 --- a/src/main/java/com/archivision/community/cache/InputTopicsCache.java +++ b/com-bot/src/main/java/com/archivision/bot/cache/InputTopicsCache.java @@ -1,4 +1,4 @@ -package com.archivision.community.cache; +package com.archivision.bot.cache; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/command/AdminCommands.java b/com-bot/src/main/java/com/archivision/bot/command/AdminCommands.java similarity index 91% rename from src/main/java/com/archivision/community/command/AdminCommands.java rename to com-bot/src/main/java/com/archivision/bot/command/AdminCommands.java index 69ddb27..a2f8cc3 100644 --- a/src/main/java/com/archivision/community/command/AdminCommands.java +++ b/com-bot/src/main/java/com/archivision/bot/command/AdminCommands.java @@ -1,4 +1,4 @@ -package com.archivision.community.command; +package com.archivision.bot.command; import java.util.Arrays; diff --git a/src/main/java/com/archivision/community/command/ResponseTemplate.java b/com-bot/src/main/java/com/archivision/bot/command/ResponseTemplate.java similarity index 95% rename from src/main/java/com/archivision/community/command/ResponseTemplate.java rename to com-bot/src/main/java/com/archivision/bot/command/ResponseTemplate.java index 975d785..0db87a3 100644 --- a/src/main/java/com/archivision/community/command/ResponseTemplate.java +++ b/com-bot/src/main/java/com/archivision/bot/command/ResponseTemplate.java @@ -1,4 +1,4 @@ -package com.archivision.community.command; +package com.archivision.bot.command; public interface ResponseTemplate { String START = """ diff --git a/src/main/java/com/archivision/community/command/UserCommands.java b/com-bot/src/main/java/com/archivision/bot/command/UserCommands.java similarity index 82% rename from src/main/java/com/archivision/community/command/UserCommands.java rename to com-bot/src/main/java/com/archivision/bot/command/UserCommands.java index 01bb382..38107a3 100644 --- a/src/main/java/com/archivision/community/command/UserCommands.java +++ b/com-bot/src/main/java/com/archivision/bot/command/UserCommands.java @@ -1,4 +1,4 @@ -package com.archivision.community.command; +package com.archivision.bot.command; public enum UserCommands { START("/start"); diff --git a/src/main/java/com/archivision/community/config/AWSConfig.java b/com-bot/src/main/java/com/archivision/bot/config/AWSConfig.java similarity index 96% rename from src/main/java/com/archivision/community/config/AWSConfig.java rename to com-bot/src/main/java/com/archivision/bot/config/AWSConfig.java index 615f91e..ab0e35a 100644 --- a/src/main/java/com/archivision/community/config/AWSConfig.java +++ b/com-bot/src/main/java/com/archivision/bot/config/AWSConfig.java @@ -1,4 +1,4 @@ -package com.archivision.community.config; +package com.archivision.bot.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/com/archivision/community/config/AppConfig.java b/com-bot/src/main/java/com/archivision/bot/config/AppConfig.java similarity index 78% rename from src/main/java/com/archivision/community/config/AppConfig.java rename to com-bot/src/main/java/com/archivision/bot/config/AppConfig.java index ced2cc3..e7e510d 100644 --- a/src/main/java/com/archivision/community/config/AppConfig.java +++ b/com-bot/src/main/java/com/archivision/bot/config/AppConfig.java @@ -1,10 +1,9 @@ -package com.archivision.community.config; +package com.archivision.bot.config; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.state.StateHandler; -import com.archivision.community.strategy.message.MessageStrategy; +import com.archivision.bot.state.StateHandler; +import com.archivision.bot.strategy.message.MessageStrategy; +import com.archivision.common.model.bot.UserFlowState; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/archivision/community/config/RabbitConfig.java b/com-bot/src/main/java/com/archivision/bot/config/RabbitConfig.java similarity index 90% rename from src/main/java/com/archivision/community/config/RabbitConfig.java rename to com-bot/src/main/java/com/archivision/bot/config/RabbitConfig.java index 4b64568..d698d9b 100644 --- a/src/main/java/com/archivision/community/config/RabbitConfig.java +++ b/com-bot/src/main/java/com/archivision/bot/config/RabbitConfig.java @@ -1,4 +1,4 @@ -package com.archivision.community.config; +package com.archivision.bot.config; import org.springframework.amqp.core.Queue; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/com/archivision/community/config/RedisConfig.java b/com-bot/src/main/java/com/archivision/bot/config/RedisConfig.java similarity index 95% rename from src/main/java/com/archivision/community/config/RedisConfig.java rename to com-bot/src/main/java/com/archivision/bot/config/RedisConfig.java index 617b674..80df225 100644 --- a/src/main/java/com/archivision/community/config/RedisConfig.java +++ b/com-bot/src/main/java/com/archivision/bot/config/RedisConfig.java @@ -1,4 +1,4 @@ -package com.archivision.community.config; +package com.archivision.bot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/archivision/community/exception/MissingTelegramIdException.java b/com-bot/src/main/java/com/archivision/bot/exception/MissingTelegramIdException.java similarity index 77% rename from src/main/java/com/archivision/community/exception/MissingTelegramIdException.java rename to com-bot/src/main/java/com/archivision/bot/exception/MissingTelegramIdException.java index ed35f90..8a97b73 100644 --- a/src/main/java/com/archivision/community/exception/MissingTelegramIdException.java +++ b/com-bot/src/main/java/com/archivision/bot/exception/MissingTelegramIdException.java @@ -1,4 +1,4 @@ -package com.archivision.community.exception; +package com.archivision.bot.exception; public class MissingTelegramIdException extends RuntimeException { public MissingTelegramIdException(String message) { diff --git a/src/main/java/com/archivision/community/exception/UnableSendMessageException.java b/com-bot/src/main/java/com/archivision/bot/exception/UnableSendMessageException.java similarity index 80% rename from src/main/java/com/archivision/community/exception/UnableSendMessageException.java rename to com-bot/src/main/java/com/archivision/bot/exception/UnableSendMessageException.java index dce568d..c8829f2 100644 --- a/src/main/java/com/archivision/community/exception/UnableSendMessageException.java +++ b/com-bot/src/main/java/com/archivision/bot/exception/UnableSendMessageException.java @@ -1,4 +1,4 @@ -package com.archivision.community.exception; +package com.archivision.bot.exception; public class UnableSendMessageException extends RuntimeException { public UnableSendMessageException(String message, Throwable cause) { diff --git a/src/main/java/com/archivision/community/handler/CallbackTelegramEventHandler.java b/com-bot/src/main/java/com/archivision/bot/handler/CallbackTelegramEventHandler.java similarity index 88% rename from src/main/java/com/archivision/community/handler/CallbackTelegramEventHandler.java rename to com-bot/src/main/java/com/archivision/bot/handler/CallbackTelegramEventHandler.java index 76ddead..8e2450f 100644 --- a/src/main/java/com/archivision/community/handler/CallbackTelegramEventHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/handler/CallbackTelegramEventHandler.java @@ -1,6 +1,6 @@ -package com.archivision.community.handler; +package com.archivision.bot.handler; -import com.archivision.community.messagesender.MessageSender; +import com.archivision.bot.sender.MessageSender; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/handler/MessageTelegramEventHandler.java b/com-bot/src/main/java/com/archivision/bot/handler/MessageTelegramEventHandler.java similarity index 89% rename from src/main/java/com/archivision/community/handler/MessageTelegramEventHandler.java rename to com-bot/src/main/java/com/archivision/bot/handler/MessageTelegramEventHandler.java index c3f5280..c756ccf 100644 --- a/src/main/java/com/archivision/community/handler/MessageTelegramEventHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/handler/MessageTelegramEventHandler.java @@ -1,6 +1,6 @@ -package com.archivision.community.handler; +package com.archivision.bot.handler; -import com.archivision.community.strategy.message.MessageStrategy; +import com.archivision.bot.strategy.message.MessageStrategy; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/handler/TelegramEventHandler.java b/com-bot/src/main/java/com/archivision/bot/handler/TelegramEventHandler.java similarity index 62% rename from src/main/java/com/archivision/community/handler/TelegramEventHandler.java rename to com-bot/src/main/java/com/archivision/bot/handler/TelegramEventHandler.java index 325e34e..4339caa 100644 --- a/src/main/java/com/archivision/community/handler/TelegramEventHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/handler/TelegramEventHandler.java @@ -1,4 +1,4 @@ -package com.archivision.community.handler; +package com.archivision.bot.handler; public interface TelegramEventHandler { void handle(T update); diff --git a/src/main/java/com/archivision/community/listener/LikesEventListener.java b/com-bot/src/main/java/com/archivision/bot/listener/LikesEventListener.java similarity index 74% rename from src/main/java/com/archivision/community/listener/LikesEventListener.java rename to com-bot/src/main/java/com/archivision/bot/listener/LikesEventListener.java index 9179302..e02ccf9 100644 --- a/src/main/java/com/archivision/community/listener/LikesEventListener.java +++ b/com-bot/src/main/java/com/archivision/bot/listener/LikesEventListener.java @@ -1,8 +1,8 @@ -package com.archivision.community.listener; +package com.archivision.bot.listener; -import com.archivision.community.event.LikeEvent; -import com.archivision.community.service.NotificationService; -import com.archivision.community.service.user.UserLikeService; +import com.archivision.bot.model.LikeEvent; +import com.archivision.bot.service.NotificationService; +import com.archivision.bot.service.user.UserLikeService; import lombok.RequiredArgsConstructor; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/listener/PaymentEventListener.java b/com-bot/src/main/java/com/archivision/bot/listener/PaymentEventListener.java similarity index 76% rename from src/main/java/com/archivision/community/listener/PaymentEventListener.java rename to com-bot/src/main/java/com/archivision/bot/listener/PaymentEventListener.java index a4f291c..8959bde 100644 --- a/src/main/java/com/archivision/community/listener/PaymentEventListener.java +++ b/com-bot/src/main/java/com/archivision/bot/listener/PaymentEventListener.java @@ -1,9 +1,9 @@ -package com.archivision.community.listener; +package com.archivision.bot.listener; -import com.archivision.community.entity.User; -import com.archivision.community.event.PaymentEvent; -import com.archivision.community.service.NotificationService; -import com.archivision.community.service.user.UserService; +import com.archivision.bot.service.NotificationService; +import com.archivision.bot.service.user.UserService; +import com.archivision.common.model.entity.User; +import com.archivision.payment.model.PaymentEvent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.annotation.RabbitListener; diff --git a/src/main/java/com/archivision/community/mapper/TopicMapper.java b/com-bot/src/main/java/com/archivision/bot/mapper/TopicMapper.java similarity index 79% rename from src/main/java/com/archivision/community/mapper/TopicMapper.java rename to com-bot/src/main/java/com/archivision/bot/mapper/TopicMapper.java index 3952e62..1cda321 100644 --- a/src/main/java/com/archivision/community/mapper/TopicMapper.java +++ b/com-bot/src/main/java/com/archivision/bot/mapper/TopicMapper.java @@ -1,8 +1,8 @@ -package com.archivision.community.mapper; +package com.archivision.bot.mapper; -import com.archivision.community.dto.TopicDto; -import com.archivision.community.entity.Topic; +import com.archivision.common.model.entity.Topic; import org.springframework.stereotype.Component; +import com.archivision.common.model.dto.TopicDto; @Component public class TopicMapper { diff --git a/src/main/java/com/archivision/community/mapper/UserMapper.java b/com-bot/src/main/java/com/archivision/bot/mapper/UserMapper.java similarity index 90% rename from src/main/java/com/archivision/community/mapper/UserMapper.java rename to com-bot/src/main/java/com/archivision/bot/mapper/UserMapper.java index 44bcc4a..ebe1507 100644 --- a/src/main/java/com/archivision/community/mapper/UserMapper.java +++ b/com-bot/src/main/java/com/archivision/bot/mapper/UserMapper.java @@ -1,9 +1,9 @@ -package com.archivision.community.mapper; +package com.archivision.bot.mapper; -import com.archivision.community.dto.UserDto; -import com.archivision.community.entity.Topic; -import com.archivision.community.entity.User; -import com.archivision.community.repo.TopicRepository; +import com.archivision.bot.repository.TopicRepository; +import com.archivision.common.model.dto.UserDto; +import com.archivision.common.model.entity.Topic; +import com.archivision.common.model.entity.User; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/model/FilterResult.java b/com-bot/src/main/java/com/archivision/bot/model/FilterResult.java similarity index 78% rename from src/main/java/com/archivision/community/model/FilterResult.java rename to com-bot/src/main/java/com/archivision/bot/model/FilterResult.java index c8ccb0d..3f27148 100644 --- a/src/main/java/com/archivision/community/model/FilterResult.java +++ b/com-bot/src/main/java/com/archivision/bot/model/FilterResult.java @@ -1,4 +1,4 @@ -package com.archivision.community.model; +package com.archivision.bot.model; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/com/archivision/community/event/LikeEvent.java b/com-bot/src/main/java/com/archivision/bot/model/LikeEvent.java similarity index 72% rename from src/main/java/com/archivision/community/event/LikeEvent.java rename to com-bot/src/main/java/com/archivision/bot/model/LikeEvent.java index 71ac4e6..d39387e 100644 --- a/src/main/java/com/archivision/community/event/LikeEvent.java +++ b/com-bot/src/main/java/com/archivision/bot/model/LikeEvent.java @@ -1,4 +1,4 @@ -package com.archivision.community.event; +package com.archivision.bot.model; import java.io.Serializable; diff --git a/src/main/java/com/archivision/community/model/Reply.java b/com-bot/src/main/java/com/archivision/bot/model/Reply.java similarity index 94% rename from src/main/java/com/archivision/community/model/Reply.java rename to com-bot/src/main/java/com/archivision/bot/model/Reply.java index 29e171e..c59c5d5 100644 --- a/src/main/java/com/archivision/community/model/Reply.java +++ b/com-bot/src/main/java/com/archivision/bot/model/Reply.java @@ -1,4 +1,4 @@ -package com.archivision.community.model; +package com.archivision.bot.model; public enum Reply { YES("Так"), diff --git a/src/main/java/com/archivision/community/model/Subscription.java b/com-bot/src/main/java/com/archivision/bot/model/Subscription.java similarity index 80% rename from src/main/java/com/archivision/community/model/Subscription.java rename to com-bot/src/main/java/com/archivision/bot/model/Subscription.java index b15a3fe..6a46c52 100644 --- a/src/main/java/com/archivision/community/model/Subscription.java +++ b/com-bot/src/main/java/com/archivision/bot/model/Subscription.java @@ -1,4 +1,4 @@ -package com.archivision.community.model; +package com.archivision.bot.model; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/com/archivision/community/processor/TelegramUpdateProcessor.java b/com-bot/src/main/java/com/archivision/bot/processor/TelegramUpdateProcessor.java similarity index 83% rename from src/main/java/com/archivision/community/processor/TelegramUpdateProcessor.java rename to com-bot/src/main/java/com/archivision/bot/processor/TelegramUpdateProcessor.java index 477bcf4..ce7f646 100644 --- a/src/main/java/com/archivision/community/processor/TelegramUpdateProcessor.java +++ b/com-bot/src/main/java/com/archivision/bot/processor/TelegramUpdateProcessor.java @@ -1,8 +1,8 @@ -package com.archivision.community.processor; +package com.archivision.bot.processor; -import com.archivision.community.handler.CallbackTelegramEventHandler; -import com.archivision.community.handler.MessageTelegramEventHandler; -import com.archivision.community.service.user.UserService; +import com.archivision.bot.handler.CallbackTelegramEventHandler; +import com.archivision.bot.handler.MessageTelegramEventHandler; +import com.archivision.bot.service.user.UserService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/processor/UpdateProcessor.java b/com-bot/src/main/java/com/archivision/bot/processor/UpdateProcessor.java similarity index 75% rename from src/main/java/com/archivision/community/processor/UpdateProcessor.java rename to com-bot/src/main/java/com/archivision/bot/processor/UpdateProcessor.java index 3c9763d..284cf89 100644 --- a/src/main/java/com/archivision/community/processor/UpdateProcessor.java +++ b/com-bot/src/main/java/com/archivision/bot/processor/UpdateProcessor.java @@ -1,4 +1,4 @@ -package com.archivision.community.processor; +package com.archivision.bot.processor; import org.telegram.telegrambots.meta.api.objects.Update; diff --git a/src/main/java/com/archivision/community/repo/TopicRepository.java b/com-bot/src/main/java/com/archivision/bot/repository/TopicRepository.java similarity index 70% rename from src/main/java/com/archivision/community/repo/TopicRepository.java rename to com-bot/src/main/java/com/archivision/bot/repository/TopicRepository.java index 6b76e34..47c6550 100644 --- a/src/main/java/com/archivision/community/repo/TopicRepository.java +++ b/com-bot/src/main/java/com/archivision/bot/repository/TopicRepository.java @@ -1,6 +1,7 @@ -package com.archivision.community.repo; +package com.archivision.bot.repository; -import com.archivision.community.entity.Topic; + +import com.archivision.common.model.entity.Topic; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/src/main/java/com/archivision/community/repo/UserLikeRepo.java b/com-bot/src/main/java/com/archivision/bot/repository/UserLikeRepo.java similarity index 83% rename from src/main/java/com/archivision/community/repo/UserLikeRepo.java rename to com-bot/src/main/java/com/archivision/bot/repository/UserLikeRepo.java index fd5b9fc..ad36936 100644 --- a/src/main/java/com/archivision/community/repo/UserLikeRepo.java +++ b/com-bot/src/main/java/com/archivision/bot/repository/UserLikeRepo.java @@ -1,6 +1,6 @@ -package com.archivision.community.repo; +package com.archivision.bot.repository; -import com.archivision.community.entity.UserLike; +import com.archivision.common.model.entity.UserLike; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/com/archivision/community/repo/UserRepository.java b/com-bot/src/main/java/com/archivision/bot/repository/UserRepository.java similarity index 86% rename from src/main/java/com/archivision/community/repo/UserRepository.java rename to com-bot/src/main/java/com/archivision/bot/repository/UserRepository.java index 54b68a0..ac1259c 100644 --- a/src/main/java/com/archivision/community/repo/UserRepository.java +++ b/com-bot/src/main/java/com/archivision/bot/repository/UserRepository.java @@ -1,6 +1,7 @@ -package com.archivision.community.repo; +package com.archivision.bot.repository; -import com.archivision.community.entity.User; + +import com.archivision.common.model.entity.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/src/main/java/com/archivision/community/messagesender/MessageSender.java b/com-bot/src/main/java/com/archivision/bot/sender/MessageSender.java similarity index 85% rename from src/main/java/com/archivision/community/messagesender/MessageSender.java rename to com-bot/src/main/java/com/archivision/bot/sender/MessageSender.java index a8b02f9..ae498be 100644 --- a/src/main/java/com/archivision/community/messagesender/MessageSender.java +++ b/com-bot/src/main/java/com/archivision/bot/sender/MessageSender.java @@ -1,6 +1,6 @@ -package com.archivision.community.messagesender; +package com.archivision.bot.sender; -import com.archivision.community.state.OptionalState; +import com.archivision.bot.state.OptionalState; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup; diff --git a/src/main/java/com/archivision/community/messagesender/TgMessageSender.java b/com-bot/src/main/java/com/archivision/bot/sender/TgMessageSender.java similarity index 91% rename from src/main/java/com/archivision/community/messagesender/TgMessageSender.java rename to com-bot/src/main/java/com/archivision/bot/sender/TgMessageSender.java index e35a258..04ff556 100644 --- a/src/main/java/com/archivision/community/messagesender/TgMessageSender.java +++ b/com-bot/src/main/java/com/archivision/bot/sender/TgMessageSender.java @@ -1,9 +1,9 @@ -package com.archivision.community.messagesender; +package com.archivision.bot.sender; -import com.archivision.community.bot.CommunityBot; -import com.archivision.community.exception.UnableSendMessageException; -import com.archivision.community.state.OptionalState; +import com.archivision.bot.exception.UnableSendMessageException; +import com.archivision.bot.service.CommunityBot; +import com.archivision.bot.state.OptionalState; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/bot/BotRegistrar.java b/com-bot/src/main/java/com/archivision/bot/service/BotRegistrar.java similarity index 96% rename from src/main/java/com/archivision/community/bot/BotRegistrar.java rename to com-bot/src/main/java/com/archivision/bot/service/BotRegistrar.java index ca0517a..05cca62 100644 --- a/src/main/java/com/archivision/community/bot/BotRegistrar.java +++ b/com-bot/src/main/java/com/archivision/bot/service/BotRegistrar.java @@ -1,4 +1,4 @@ -package com.archivision.community.bot; +package com.archivision.bot.service; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/bot/BotStarter.java b/com-bot/src/main/java/com/archivision/bot/service/BotStarter.java similarity index 86% rename from src/main/java/com/archivision/community/bot/BotStarter.java rename to com-bot/src/main/java/com/archivision/bot/service/BotStarter.java index 78153bb..9ffd5f3 100644 --- a/src/main/java/com/archivision/community/bot/BotStarter.java +++ b/com-bot/src/main/java/com/archivision/bot/service/BotStarter.java @@ -1,6 +1,6 @@ -package com.archivision.community.bot; +package com.archivision.bot.service; -import com.archivision.community.processor.UpdateProcessor; +import com.archivision.bot.processor.UpdateProcessor; import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Primary; diff --git a/src/main/java/com/archivision/community/bot/CommunityBot.java b/com-bot/src/main/java/com/archivision/bot/service/CommunityBot.java similarity index 90% rename from src/main/java/com/archivision/community/bot/CommunityBot.java rename to com-bot/src/main/java/com/archivision/bot/service/CommunityBot.java index 28868eb..2d278b4 100644 --- a/src/main/java/com/archivision/community/bot/CommunityBot.java +++ b/com-bot/src/main/java/com/archivision/bot/service/CommunityBot.java @@ -1,6 +1,6 @@ -package com.archivision.community.bot; +package com.archivision.bot.service; -import com.archivision.community.processor.UpdateProcessor; +import com.archivision.bot.processor.UpdateProcessor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/service/KeyboardBuilderService.java b/com-bot/src/main/java/com/archivision/bot/service/KeyboardBuilderService.java similarity index 87% rename from src/main/java/com/archivision/community/service/KeyboardBuilderService.java rename to com-bot/src/main/java/com/archivision/bot/service/KeyboardBuilderService.java index 325a013..c70b374 100644 --- a/src/main/java/com/archivision/community/service/KeyboardBuilderService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/KeyboardBuilderService.java @@ -1,6 +1,5 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.model.Subscription; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -8,18 +7,15 @@ import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton; import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardButton; import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow; +import com.archivision.bot.model.Subscription; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.archivision.community.model.Reply.CHANGE; -import static com.archivision.community.model.Reply.GIRL; -import static com.archivision.community.model.Reply.MAN; -import static com.archivision.community.model.Reply.OTHER; -import static com.archivision.community.model.Reply.SKIP; -import static com.archivision.community.model.Reply.YES; +import static com.archivision.bot.model.Reply.*; + @Component @RequiredArgsConstructor diff --git a/src/main/java/com/archivision/community/service/NotificationService.java b/com-bot/src/main/java/com/archivision/bot/service/NotificationService.java similarity index 85% rename from src/main/java/com/archivision/community/service/NotificationService.java rename to com-bot/src/main/java/com/archivision/bot/service/NotificationService.java index 448e443..038a79c 100644 --- a/src/main/java/com/archivision/community/service/NotificationService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/NotificationService.java @@ -1,7 +1,8 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.user.UserService; + +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.user.UserService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/archivision/community/service/ProfileSender.java b/com-bot/src/main/java/com/archivision/bot/service/ProfileSender.java similarity index 88% rename from src/main/java/com/archivision/community/service/ProfileSender.java rename to com-bot/src/main/java/com/archivision/bot/service/ProfileSender.java index 2db762d..f2fc3a5 100644 --- a/src/main/java/com/archivision/community/service/ProfileSender.java +++ b/com-bot/src/main/java/com/archivision/bot/service/ProfileSender.java @@ -1,10 +1,11 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.cache.ActiveViewingData; -import com.archivision.community.entity.Topic; -import com.archivision.community.entity.User; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.user.UserService; + +import com.archivision.bot.cache.ActiveViewingData; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.user.UserService; +import com.archivision.common.model.entity.Topic; +import com.archivision.common.model.entity.User; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/archivision/community/service/S3Service.java b/com-bot/src/main/java/com/archivision/bot/service/S3Service.java similarity index 97% rename from src/main/java/com/archivision/community/service/S3Service.java rename to com-bot/src/main/java/com/archivision/bot/service/S3Service.java index 867a75a..e22658a 100644 --- a/src/main/java/com/archivision/community/service/S3Service.java +++ b/com-bot/src/main/java/com/archivision/bot/service/S3Service.java @@ -1,4 +1,4 @@ -package com.archivision.community.service; +package com.archivision.bot.service; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/com/archivision/community/service/ServiceCommandChecker.java b/com-bot/src/main/java/com/archivision/bot/service/ServiceCommandChecker.java similarity index 86% rename from src/main/java/com/archivision/community/service/ServiceCommandChecker.java rename to com-bot/src/main/java/com/archivision/bot/service/ServiceCommandChecker.java index a0bf021..aafcf3e 100644 --- a/src/main/java/com/archivision/community/service/ServiceCommandChecker.java +++ b/com-bot/src/main/java/com/archivision/bot/service/ServiceCommandChecker.java @@ -1,8 +1,9 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.model.FilterResult; -import com.archivision.community.model.Subscription; + +import com.archivision.bot.model.FilterResult; +import com.archivision.bot.model.Subscription; +import com.archivision.bot.sender.MessageSender; import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/archivision/community/service/StateManagerService.java b/com-bot/src/main/java/com/archivision/bot/service/StateManagerService.java similarity index 80% rename from src/main/java/com/archivision/community/service/StateManagerService.java rename to com-bot/src/main/java/com/archivision/bot/service/StateManagerService.java index bf9eaf6..e02b7fc 100644 --- a/src/main/java/com/archivision/community/service/StateManagerService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/StateManagerService.java @@ -1,7 +1,8 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.state.StateHandler; + +import com.archivision.bot.state.StateHandler; +import com.archivision.common.model.bot.UserFlowState; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/service/SubscriptionService.java b/com-bot/src/main/java/com/archivision/bot/service/SubscriptionService.java similarity index 91% rename from src/main/java/com/archivision/community/service/SubscriptionService.java rename to com-bot/src/main/java/com/archivision/bot/service/SubscriptionService.java index e2159f2..9be5b14 100644 --- a/src/main/java/com/archivision/community/service/SubscriptionService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/SubscriptionService.java @@ -1,7 +1,9 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.dto.PaymentRequestDto; -import com.archivision.community.model.Subscription; + +import com.archivision.bot.model.Subscription; +import com.archivision.common.model.dto.PaymentRequestDto; +import com.archivision.payment.service.PayPalService; import com.paypal.api.payments.Links; import com.paypal.api.payments.Payment; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/com/archivision/community/service/TelegramImageS3Service.java b/com-bot/src/main/java/com/archivision/bot/service/TelegramImageS3Service.java similarity index 97% rename from src/main/java/com/archivision/community/service/TelegramImageS3Service.java rename to com-bot/src/main/java/com/archivision/bot/service/TelegramImageS3Service.java index 0dd5c20..a46a6cb 100644 --- a/src/main/java/com/archivision/community/service/TelegramImageS3Service.java +++ b/com-bot/src/main/java/com/archivision/bot/service/TelegramImageS3Service.java @@ -1,6 +1,5 @@ -package com.archivision.community.service; +package com.archivision.bot.service; -import com.archivision.community.bot.CommunityBot; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/service/user/UserInteractionService.java b/com-bot/src/main/java/com/archivision/bot/service/user/UserInteractionService.java similarity index 85% rename from src/main/java/com/archivision/community/service/user/UserInteractionService.java rename to com-bot/src/main/java/com/archivision/bot/service/user/UserInteractionService.java index 8e8ccc5..102375a 100644 --- a/src/main/java/com/archivision/community/service/user/UserInteractionService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/user/UserInteractionService.java @@ -1,8 +1,8 @@ -package com.archivision.community.service.user; +package com.archivision.bot.service.user; -import com.archivision.community.cache.ActiveViewingData; -import com.archivision.community.matcher.MatchedUsersListResolver; -import com.archivision.community.service.ProfileSender; +import com.archivision.bot.cache.ActiveViewingData; +import com.archivision.bot.service.ProfileSender; +import com.archivision.matcher.service.MatchedUsersListResolver; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/archivision/community/service/user/UserLikeService.java b/com-bot/src/main/java/com/archivision/bot/service/user/UserLikeService.java similarity index 72% rename from src/main/java/com/archivision/community/service/user/UserLikeService.java rename to com-bot/src/main/java/com/archivision/bot/service/user/UserLikeService.java index 37d335b..d3a5df3 100644 --- a/src/main/java/com/archivision/community/service/user/UserLikeService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/user/UserLikeService.java @@ -1,8 +1,9 @@ -package com.archivision.community.service.user; +package com.archivision.bot.service.user; -import com.archivision.community.entity.UserLike; -import com.archivision.community.event.LikeEvent; -import com.archivision.community.repo.UserLikeRepo; + +import com.archivision.bot.model.LikeEvent; +import com.archivision.bot.repository.UserLikeRepo; +import com.archivision.common.model.entity.UserLike; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -24,8 +25,7 @@ public void like(Long userId, Long userLikeId) { userLike.setUserId(userId); userLike.setLikedUserId(userLikeId); userLikeRepo.save(userLike); - LikeEvent likeEvent = new LikeEvent(userId, userLikeId); - rabbitTemplate.convertAndSend(likesEventQueue, likeEvent); + rabbitTemplate.convertAndSend(likesEventQueue, new LikeEvent(userId, userLikeId)); } public boolean isReverseLikeExists(Long likerId, Long likedId) { diff --git a/src/main/java/com/archivision/community/service/user/UserService.java b/com-bot/src/main/java/com/archivision/bot/service/user/UserService.java similarity index 88% rename from src/main/java/com/archivision/community/service/user/UserService.java rename to com-bot/src/main/java/com/archivision/bot/service/user/UserService.java index 47938ce..2346b98 100644 --- a/src/main/java/com/archivision/community/service/user/UserService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/user/UserService.java @@ -1,10 +1,11 @@ -package com.archivision.community.service.user; +package com.archivision.bot.service.user; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.dto.UserDto; -import com.archivision.community.entity.User; -import com.archivision.community.mapper.UserMapper; -import com.archivision.community.repo.UserRepository; + +import com.archivision.bot.mapper.UserMapper; +import com.archivision.bot.repository.UserRepository; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; +import com.archivision.common.model.entity.User; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/archivision/community/service/user/UserTopicService.java b/com-bot/src/main/java/com/archivision/bot/service/user/UserTopicService.java similarity index 88% rename from src/main/java/com/archivision/community/service/user/UserTopicService.java rename to com-bot/src/main/java/com/archivision/bot/service/user/UserTopicService.java index 35ef795..0dfcd78 100644 --- a/src/main/java/com/archivision/community/service/user/UserTopicService.java +++ b/com-bot/src/main/java/com/archivision/bot/service/user/UserTopicService.java @@ -1,9 +1,9 @@ -package com.archivision.community.service.user; +package com.archivision.bot.service.user; -import com.archivision.community.entity.Topic; -import com.archivision.community.entity.User; -import com.archivision.community.repo.TopicRepository; -import com.archivision.community.repo.UserRepository; +import com.archivision.bot.repository.TopicRepository; +import com.archivision.bot.repository.UserRepository; +import com.archivision.common.model.entity.Topic; +import com.archivision.common.model.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/archivision/community/state/AbstractStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/AbstractStateHandler.java similarity index 66% rename from src/main/java/com/archivision/community/state/AbstractStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/AbstractStateHandler.java index 70a43ae..d98d286 100644 --- a/src/main/java/com/archivision/community/state/AbstractStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/AbstractStateHandler.java @@ -1,10 +1,11 @@ -package com.archivision.community.state; +package com.archivision.bot.state; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.util.InputValidator; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.util.InputValidator; import lombok.RequiredArgsConstructor; import org.telegram.telegrambots.meta.api.objects.Message; @@ -17,11 +18,9 @@ public abstract class AbstractStateHandler implements StateHandler, Validatable protected final ActiveRegistrationProcessCache registrationProcessCache; public void handle(Message message) { - if (shouldValidateInput()) { - if (!isInputValid(message)) { + if (shouldValidateInput() && (!isInputValid(message))) { onValidationError(message); return; - } } doHandle(message); } diff --git a/src/main/java/com/archivision/community/state/OptionalState.java b/com-bot/src/main/java/com/archivision/bot/state/OptionalState.java similarity index 76% rename from src/main/java/com/archivision/community/state/OptionalState.java rename to com-bot/src/main/java/com/archivision/bot/state/OptionalState.java index f224fcf..09c109c 100644 --- a/src/main/java/com/archivision/community/state/OptionalState.java +++ b/com-bot/src/main/java/com/archivision/bot/state/OptionalState.java @@ -1,6 +1,6 @@ -package com.archivision.community.state; +package com.archivision.bot.state; -import com.archivision.community.bot.UserFlowState; +import com.archivision.common.model.bot.UserFlowState; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup; public interface OptionalState { diff --git a/src/main/java/com/archivision/community/state/StateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/StateHandler.java similarity index 63% rename from src/main/java/com/archivision/community/state/StateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/StateHandler.java index 1f84fad..00d6814 100644 --- a/src/main/java/com/archivision/community/state/StateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/StateHandler.java @@ -1,6 +1,6 @@ -package com.archivision.community.state; +package com.archivision.bot.state; -import com.archivision.community.bot.UserFlowState; +import com.archivision.common.model.bot.UserFlowState; import org.telegram.telegrambots.meta.api.objects.Message; public interface StateHandler { diff --git a/src/main/java/com/archivision/community/state/Validatable.java b/com-bot/src/main/java/com/archivision/bot/state/Validatable.java similarity index 62% rename from src/main/java/com/archivision/community/state/Validatable.java rename to com-bot/src/main/java/com/archivision/bot/state/Validatable.java index 0ae264c..54e3c15 100644 --- a/src/main/java/com/archivision/community/state/Validatable.java +++ b/com-bot/src/main/java/com/archivision/bot/state/Validatable.java @@ -1,4 +1,4 @@ -package com.archivision.community.state; +package com.archivision.bot.state; public interface Validatable { boolean shouldValidateInput(); diff --git a/src/main/java/com/archivision/community/state/WithReplyOptions.java b/com-bot/src/main/java/com/archivision/bot/state/WithReplyOptions.java similarity index 69% rename from src/main/java/com/archivision/community/state/WithReplyOptions.java rename to com-bot/src/main/java/com/archivision/bot/state/WithReplyOptions.java index e1787ef..84560f6 100644 --- a/src/main/java/com/archivision/community/state/WithReplyOptions.java +++ b/com-bot/src/main/java/com/archivision/bot/state/WithReplyOptions.java @@ -1,4 +1,4 @@ -package com.archivision.community.state; +package com.archivision.bot.state; import java.util.Set; diff --git a/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/MatchStateHandler.java similarity index 79% rename from src/main/java/com/archivision/community/state/impl/MatchStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/MatchStateHandler.java index 71a70d4..d06fbed 100644 --- a/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/MatchStateHandler.java @@ -1,15 +1,16 @@ -package com.archivision.community.state.impl; +package com.archivision.bot.state.impl; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.model.Reply; -import com.archivision.community.service.*; -import com.archivision.community.service.user.UserInteractionService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.state.WithReplyOptions; -import com.archivision.community.util.InputValidator; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.model.Reply; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserInteractionService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.state.WithReplyOptions; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; diff --git a/src/main/java/com/archivision/community/state/impl/SettingsStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/SettingsStateHandler.java similarity index 76% rename from src/main/java/com/archivision/community/state/impl/SettingsStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/SettingsStateHandler.java index 7465183..7cdbcb2 100644 --- a/src/main/java/com/archivision/community/state/impl/SettingsStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/SettingsStateHandler.java @@ -1,14 +1,15 @@ -package com.archivision.community.state.impl; +package com.archivision.bot.state.impl; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.SubscriptionService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.state.Validatable; -import com.archivision.community.util.InputValidator; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.SubscriptionService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.state.Validatable; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; diff --git a/src/main/java/com/archivision/community/state/impl/initial/AgeInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/AgeInputStateHandler.java similarity index 71% rename from src/main/java/com/archivision/community/state/impl/initial/AgeInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/AgeInputStateHandler.java index 0483aff..5d56ce1 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/AgeInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/AgeInputStateHandler.java @@ -1,19 +1,21 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; -import static com.archivision.community.bot.UserFlowState.GENDER; +import static com.archivision.common.model.bot.UserFlowState.GENDER; + @Component @Slf4j diff --git a/src/main/java/com/archivision/community/state/impl/initial/ApproveStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/ApproveStateHandler.java similarity index 77% rename from src/main/java/com/archivision/community/state/impl/initial/ApproveStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/ApproveStateHandler.java index 391adae..9a71a3f 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/ApproveStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/ApproveStateHandler.java @@ -1,17 +1,18 @@ -package com.archivision.community.state.impl.initial; +package com.archivision.bot.state.impl.initial; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.cache.ActiveViewingData; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.matcher.MatchedUsersListResolver; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.ProfileSender; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.cache.ActiveViewingData; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.ProfileSender; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; +import com.archivision.matcher.service.MatchedUsersListResolver; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/state/impl/initial/CityInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/CityInputStateHandler.java similarity index 72% rename from src/main/java/com/archivision/community/state/impl/initial/CityInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/CityInputStateHandler.java index ad56ecc..0c5194d 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/CityInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/CityInputStateHandler.java @@ -1,19 +1,19 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; -import static com.archivision.community.bot.UserFlowState.TOPIC; +import static com.archivision.common.model.bot.UserFlowState.TOPIC; @Component @Slf4j diff --git a/src/main/java/com/archivision/community/state/impl/initial/DescriptionStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/DescriptionStateHandler.java similarity index 79% rename from src/main/java/com/archivision/community/state/impl/initial/DescriptionStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/DescriptionStateHandler.java index d8bfdbe..30c2b68 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/DescriptionStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/DescriptionStateHandler.java @@ -1,19 +1,20 @@ -package com.archivision.community.state.impl.initial; +package com.archivision.bot.state.impl.initial; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.state.OptionalState; -import com.archivision.community.util.InputValidator; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.state.OptionalState; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; -import static com.archivision.community.bot.UserFlowState.PHOTO; +import static com.archivision.common.model.bot.UserFlowState.PHOTO; @Component @Slf4j diff --git a/src/main/java/com/archivision/community/state/impl/initial/GenderInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/GenderInputStateHandler.java similarity index 72% rename from src/main/java/com/archivision/community/state/impl/initial/GenderInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/GenderInputStateHandler.java index b17ad38..c2caf6a 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/GenderInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/GenderInputStateHandler.java @@ -1,15 +1,16 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.entity.Gender; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; +import com.archivision.common.model.entity.Gender; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; diff --git a/src/main/java/com/archivision/community/state/impl/initial/LookingForInoutStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/LookingForInoutStateHandler.java similarity index 71% rename from src/main/java/com/archivision/community/state/impl/initial/LookingForInoutStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/LookingForInoutStateHandler.java index 660d9f8..19b53fb 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/LookingForInoutStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/LookingForInoutStateHandler.java @@ -1,15 +1,15 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.entity.Gender; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; +import com.archivision.common.model.entity.Gender; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; diff --git a/src/main/java/com/archivision/community/state/impl/initial/NameInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/NameInputStateHandler.java similarity index 70% rename from src/main/java/com/archivision/community/state/impl/initial/NameInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/NameInputStateHandler.java index d644991..222f4dc 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/NameInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/NameInputStateHandler.java @@ -1,19 +1,19 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; -import static com.archivision.community.bot.UserFlowState.AGE; +import static com.archivision.common.model.bot.UserFlowState.AGE; @Component @Slf4j diff --git a/src/main/java/com/archivision/community/state/impl/initial/PhotoInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/PhotoInputStateHandler.java similarity index 79% rename from src/main/java/com/archivision/community/state/impl/initial/PhotoInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/PhotoInputStateHandler.java index 986ca7c..6b5629f 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/PhotoInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/PhotoInputStateHandler.java @@ -1,15 +1,16 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.UserDto; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.TelegramImageS3Service; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.TelegramImageS3Service; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; @@ -17,7 +18,8 @@ import java.util.List; -import static com.archivision.community.bot.UserFlowState.APPROVE; +import static com.archivision.common.model.bot.UserFlowState.APPROVE; + @Component @Slf4j diff --git a/src/main/java/com/archivision/community/state/impl/initial/TopicsInputStateHandler.java b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/TopicsInputStateHandler.java similarity index 78% rename from src/main/java/com/archivision/community/state/impl/initial/TopicsInputStateHandler.java rename to com-bot/src/main/java/com/archivision/bot/state/impl/initial/TopicsInputStateHandler.java index 8231d7f..fa12233 100644 --- a/src/main/java/com/archivision/community/state/impl/initial/TopicsInputStateHandler.java +++ b/com-bot/src/main/java/com/archivision/bot/state/impl/initial/TopicsInputStateHandler.java @@ -1,23 +1,25 @@ -package com.archivision.community.state.impl.initial; - -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.dto.TopicDto; -import com.archivision.community.dto.UserDto; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.service.KeyboardBuilderService; -import com.archivision.community.service.user.UserService; -import com.archivision.community.state.AbstractStateHandler; -import com.archivision.community.state.OptionalState; -import com.archivision.community.util.InputValidator; +package com.archivision.bot.state.impl.initial; + + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.KeyboardBuilderService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.state.AbstractStateHandler; +import com.archivision.bot.state.OptionalState; +import com.archivision.bot.util.InputValidator; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.TopicDto; +import com.archivision.common.model.dto.UserDto; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.objects.Message; import java.util.Set; -import static com.archivision.community.bot.UserFlowState.DESCRIPTION; +import static com.archivision.common.model.bot.UserFlowState.DESCRIPTION; + @Component @Slf4j diff --git a/src/main/java/com/archivision/community/strategy/message/MessageStrategy.java b/com-bot/src/main/java/com/archivision/bot/strategy/message/MessageStrategy.java similarity index 77% rename from src/main/java/com/archivision/community/strategy/message/MessageStrategy.java rename to com-bot/src/main/java/com/archivision/bot/strategy/message/MessageStrategy.java index 9f10450..1e1eb76 100644 --- a/src/main/java/com/archivision/community/strategy/message/MessageStrategy.java +++ b/com-bot/src/main/java/com/archivision/bot/strategy/message/MessageStrategy.java @@ -1,4 +1,4 @@ -package com.archivision.community.strategy.message; +package com.archivision.bot.strategy.message; import org.telegram.telegrambots.meta.api.objects.Message; diff --git a/src/main/java/com/archivision/community/strategy/message/impl/PhotoMessageStrategy.java b/com-bot/src/main/java/com/archivision/bot/strategy/message/impl/PhotoMessageStrategy.java similarity index 77% rename from src/main/java/com/archivision/community/strategy/message/impl/PhotoMessageStrategy.java rename to com-bot/src/main/java/com/archivision/bot/strategy/message/impl/PhotoMessageStrategy.java index ae1a3bf..950c59d 100644 --- a/src/main/java/com/archivision/community/strategy/message/impl/PhotoMessageStrategy.java +++ b/com-bot/src/main/java/com/archivision/bot/strategy/message/impl/PhotoMessageStrategy.java @@ -1,10 +1,10 @@ -package com.archivision.community.strategy.message.impl; +package com.archivision.bot.strategy.message.impl; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.dto.UserDto; -import com.archivision.community.service.StateManagerService; -import com.archivision.community.strategy.message.MessageStrategy; +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.service.StateManagerService; +import com.archivision.bot.strategy.message.MessageStrategy; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/strategy/message/impl/TextMessageStrategy.java b/com-bot/src/main/java/com/archivision/bot/strategy/message/impl/TextMessageStrategy.java similarity index 74% rename from src/main/java/com/archivision/community/strategy/message/impl/TextMessageStrategy.java rename to com-bot/src/main/java/com/archivision/bot/strategy/message/impl/TextMessageStrategy.java index f67ccd9..a8a3f3d 100644 --- a/src/main/java/com/archivision/community/strategy/message/impl/TextMessageStrategy.java +++ b/com-bot/src/main/java/com/archivision/bot/strategy/message/impl/TextMessageStrategy.java @@ -1,18 +1,18 @@ -package com.archivision.community.strategy.message.impl; +package com.archivision.bot.strategy.message.impl; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.cache.ActiveRegistrationProcessCache; -import com.archivision.community.command.ResponseTemplate; -import com.archivision.community.command.UserCommands; -import com.archivision.community.dto.UserDto; -import com.archivision.community.entity.User; -import com.archivision.community.mapper.UserMapper; -import com.archivision.community.messagesender.MessageSender; -import com.archivision.community.model.FilterResult; -import com.archivision.community.service.StateManagerService; -import com.archivision.community.service.ServiceCommandChecker; -import com.archivision.community.service.user.UserService; -import com.archivision.community.strategy.message.MessageStrategy; + +import com.archivision.bot.cache.ActiveRegistrationProcessCache; +import com.archivision.bot.command.ResponseTemplate; +import com.archivision.bot.command.UserCommands; +import com.archivision.bot.model.FilterResult; +import com.archivision.bot.sender.MessageSender; +import com.archivision.bot.service.ServiceCommandChecker; +import com.archivision.bot.service.StateManagerService; +import com.archivision.bot.service.user.UserService; +import com.archivision.bot.strategy.message.MessageStrategy; +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.dto.UserDto; +import com.archivision.common.model.entity.User; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/util/DataInitializer.java b/com-bot/src/main/java/com/archivision/bot/util/DataInitializer.java similarity index 89% rename from src/main/java/com/archivision/community/util/DataInitializer.java rename to com-bot/src/main/java/com/archivision/bot/util/DataInitializer.java index 192e5a8..714fec7 100644 --- a/src/main/java/com/archivision/community/util/DataInitializer.java +++ b/com-bot/src/main/java/com/archivision/bot/util/DataInitializer.java @@ -1,6 +1,6 @@ -package com.archivision.community.util; +package com.archivision.bot.util; -import com.archivision.community.service.user.UserService; +import com.archivision.bot.service.user.UserService; import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/archivision/community/util/HandlerRegister.java b/com-bot/src/main/java/com/archivision/bot/util/HandlerRegister.java similarity index 80% rename from src/main/java/com/archivision/community/util/HandlerRegister.java rename to com-bot/src/main/java/com/archivision/bot/util/HandlerRegister.java index 7619994..63c95b1 100644 --- a/src/main/java/com/archivision/community/util/HandlerRegister.java +++ b/com-bot/src/main/java/com/archivision/bot/util/HandlerRegister.java @@ -1,4 +1,4 @@ -package com.archivision.community.util; +package com.archivision.bot.util; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/util/InputValidator.java b/com-bot/src/main/java/com/archivision/bot/util/InputValidator.java similarity index 96% rename from src/main/java/com/archivision/community/util/InputValidator.java rename to com-bot/src/main/java/com/archivision/bot/util/InputValidator.java index f95a84f..55dfb60 100644 --- a/src/main/java/com/archivision/community/util/InputValidator.java +++ b/com-bot/src/main/java/com/archivision/bot/util/InputValidator.java @@ -1,4 +1,4 @@ -package com.archivision.community.util; +package com.archivision.bot.util; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/util/ResourceLoaderService.java b/com-bot/src/main/java/com/archivision/bot/util/ResourceLoaderService.java similarity index 94% rename from src/main/java/com/archivision/community/util/ResourceLoaderService.java rename to com-bot/src/main/java/com/archivision/bot/util/ResourceLoaderService.java index cf73630..ebfddc5 100644 --- a/src/main/java/com/archivision/community/util/ResourceLoaderService.java +++ b/com-bot/src/main/java/com/archivision/bot/util/ResourceLoaderService.java @@ -1,4 +1,4 @@ -package com.archivision.community.util; +package com.archivision.bot.util; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/resources/application.yml b/com-bot/src/main/resources/application.yml similarity index 100% rename from src/main/resources/application.yml rename to com-bot/src/main/resources/application.yml diff --git a/src/main/resources/no_image.jpg b/com-bot/src/main/resources/no_image.jpg similarity index 100% rename from src/main/resources/no_image.jpg rename to com-bot/src/main/resources/no_image.jpg diff --git a/com-common/pom.xml b/com-common/pom.xml new file mode 100644 index 0000000..d70c8ec --- /dev/null +++ b/com-common/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.archivision + community + 0.0.1-SNAPSHOT + + + com-common + + + 19 + 19 + UTF-8 + + + \ No newline at end of file diff --git a/src/main/java/com/archivision/community/bot/UserFlowState.java b/com-common/src/main/java/com/archivision/common/model/bot/UserFlowState.java similarity index 90% rename from src/main/java/com/archivision/community/bot/UserFlowState.java rename to com-common/src/main/java/com/archivision/common/model/bot/UserFlowState.java index 8246669..57dceef 100644 --- a/src/main/java/com/archivision/community/bot/UserFlowState.java +++ b/com-common/src/main/java/com/archivision/common/model/bot/UserFlowState.java @@ -1,4 +1,4 @@ -package com.archivision.community.bot; +package com.archivision.common.model.bot; import lombok.Getter; diff --git a/src/main/java/com/archivision/community/dto/PaymentRequestDto.java b/com-common/src/main/java/com/archivision/common/model/dto/PaymentRequestDto.java similarity index 78% rename from src/main/java/com/archivision/community/dto/PaymentRequestDto.java rename to com-common/src/main/java/com/archivision/common/model/dto/PaymentRequestDto.java index 23d5ed2..51a5705 100644 --- a/src/main/java/com/archivision/community/dto/PaymentRequestDto.java +++ b/com-common/src/main/java/com/archivision/common/model/dto/PaymentRequestDto.java @@ -1,4 +1,4 @@ -package com.archivision.community.dto; +package com.archivision.common.model.dto; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/com/archivision/community/dto/TopicDto.java b/com-common/src/main/java/com/archivision/common/model/dto/TopicDto.java similarity index 79% rename from src/main/java/com/archivision/community/dto/TopicDto.java rename to com-common/src/main/java/com/archivision/common/model/dto/TopicDto.java index 605eced..bad8d0f 100644 --- a/src/main/java/com/archivision/community/dto/TopicDto.java +++ b/com-common/src/main/java/com/archivision/common/model/dto/TopicDto.java @@ -1,4 +1,4 @@ -package com.archivision.community.dto; +package com.archivision.common.model.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/src/main/java/com/archivision/community/dto/UserDto.java b/com-common/src/main/java/com/archivision/common/model/dto/UserDto.java similarity index 76% rename from src/main/java/com/archivision/community/dto/UserDto.java rename to com-common/src/main/java/com/archivision/common/model/dto/UserDto.java index 40dfc9b..528a2bc 100644 --- a/src/main/java/com/archivision/community/dto/UserDto.java +++ b/com-common/src/main/java/com/archivision/common/model/dto/UserDto.java @@ -1,7 +1,8 @@ -package com.archivision.community.dto; +package com.archivision.common.model.dto; -import com.archivision.community.bot.UserFlowState; -import com.archivision.community.entity.Gender; + +import com.archivision.common.model.bot.UserFlowState; +import com.archivision.common.model.entity.Gender; import lombok.Data; import java.util.ArrayList; diff --git a/src/main/java/com/archivision/community/entity/Gender.java b/com-common/src/main/java/com/archivision/common/model/entity/Gender.java similarity index 95% rename from src/main/java/com/archivision/community/entity/Gender.java rename to com-common/src/main/java/com/archivision/common/model/entity/Gender.java index 3a37393..a49029e 100644 --- a/src/main/java/com/archivision/community/entity/Gender.java +++ b/com-common/src/main/java/com/archivision/common/model/entity/Gender.java @@ -1,4 +1,4 @@ -package com.archivision.community.entity; +package com.archivision.common.model.entity; public enum Gender { MAN("Хлопець", "Хлопців"), diff --git a/src/main/java/com/archivision/community/entity/Topic.java b/com-common/src/main/java/com/archivision/common/model/entity/Topic.java similarity index 92% rename from src/main/java/com/archivision/community/entity/Topic.java rename to com-common/src/main/java/com/archivision/common/model/entity/Topic.java index a2099ca..b5cf22e 100644 --- a/src/main/java/com/archivision/community/entity/Topic.java +++ b/com-common/src/main/java/com/archivision/common/model/entity/Topic.java @@ -1,4 +1,4 @@ -package com.archivision.community.entity; +package com.archivision.common.model.entity; import jakarta.persistence.*; import lombok.Data; diff --git a/src/main/java/com/archivision/community/entity/User.java b/com-common/src/main/java/com/archivision/common/model/entity/User.java similarity index 93% rename from src/main/java/com/archivision/community/entity/User.java rename to com-common/src/main/java/com/archivision/common/model/entity/User.java index dbe0ba5..78ee119 100644 --- a/src/main/java/com/archivision/community/entity/User.java +++ b/com-common/src/main/java/com/archivision/common/model/entity/User.java @@ -1,6 +1,6 @@ -package com.archivision.community.entity; +package com.archivision.common.model.entity; -import com.archivision.community.bot.UserFlowState; +import com.archivision.common.model.bot.UserFlowState; import jakarta.persistence.*; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/archivision/community/entity/UserLike.java b/com-common/src/main/java/com/archivision/common/model/entity/UserLike.java similarity index 88% rename from src/main/java/com/archivision/community/entity/UserLike.java rename to com-common/src/main/java/com/archivision/common/model/entity/UserLike.java index 3b5c480..3eac1f5 100644 --- a/src/main/java/com/archivision/community/entity/UserLike.java +++ b/com-common/src/main/java/com/archivision/common/model/entity/UserLike.java @@ -1,4 +1,4 @@ -package com.archivision.community.entity; +package com.archivision.common.model.entity; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; diff --git a/com-matcher/pom.xml b/com-matcher/pom.xml new file mode 100644 index 0000000..8210dde --- /dev/null +++ b/com-matcher/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + com.archivision + community + 0.0.1-SNAPSHOT + + + com-matcher + + + 17 + 17 + UTF-8 + + + + com.archivision + com-common + 0.0.1-SNAPSHOT + compile + + + com.archivision + com-common + 0.0.1-SNAPSHOT + compile + + + + \ No newline at end of file diff --git a/com-matcher/src/main/java/com/archivision/matcher/CommunityMatcherApplication.java b/com-matcher/src/main/java/com/archivision/matcher/CommunityMatcherApplication.java new file mode 100644 index 0000000..36b1286 --- /dev/null +++ b/com-matcher/src/main/java/com/archivision/matcher/CommunityMatcherApplication.java @@ -0,0 +1,13 @@ +package com.archivision.matcher; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +public class CommunityMatcherApplication { + public static void main(String[] args) { + SpringApplication.run(CommunityMatcherApplication.class, args); + } +} diff --git a/src/main/java/com/archivision/community/matcher/bias/MatchingBias.java b/com-matcher/src/main/java/com/archivision/matcher/bias/MatchingBias.java similarity index 83% rename from src/main/java/com/archivision/community/matcher/bias/MatchingBias.java rename to com-matcher/src/main/java/com/archivision/matcher/bias/MatchingBias.java index b5c6382..bc086d0 100644 --- a/src/main/java/com/archivision/community/matcher/bias/MatchingBias.java +++ b/com-matcher/src/main/java/com/archivision/matcher/bias/MatchingBias.java @@ -1,4 +1,4 @@ -package com.archivision.community.matcher.bias; +package com.archivision.matcher.bias; public enum MatchingBias { AGE_BIAS(1F), diff --git a/src/main/java/com/archivision/community/matcher/MatchResult.java b/com-matcher/src/main/java/com/archivision/matcher/model/MatchResult.java similarity index 95% rename from src/main/java/com/archivision/community/matcher/MatchResult.java rename to com-matcher/src/main/java/com/archivision/matcher/model/MatchResult.java index 937f369..9bec688 100644 --- a/src/main/java/com/archivision/community/matcher/MatchResult.java +++ b/com-matcher/src/main/java/com/archivision/matcher/model/MatchResult.java @@ -1,4 +1,4 @@ -package com.archivision.community.matcher; +package com.archivision.matcher.model; public final class MatchResult { private final Double matchingProbability; diff --git a/src/main/java/com/archivision/community/matcher/MatchStatus.java b/com-matcher/src/main/java/com/archivision/matcher/model/MatchStatus.java similarity index 68% rename from src/main/java/com/archivision/community/matcher/MatchStatus.java rename to com-matcher/src/main/java/com/archivision/matcher/model/MatchStatus.java index ab2826c..9e77567 100644 --- a/src/main/java/com/archivision/community/matcher/MatchStatus.java +++ b/com-matcher/src/main/java/com/archivision/matcher/model/MatchStatus.java @@ -1,4 +1,4 @@ -package com.archivision.community.matcher; +package com.archivision.matcher.model; public enum MatchStatus { MATCHED, diff --git a/com-matcher/src/main/java/com/archivision/matcher/model/UserWithMatchedProbability.java b/com-matcher/src/main/java/com/archivision/matcher/model/UserWithMatchedProbability.java new file mode 100644 index 0000000..7385da1 --- /dev/null +++ b/com-matcher/src/main/java/com/archivision/matcher/model/UserWithMatchedProbability.java @@ -0,0 +1,6 @@ +package com.archivision.matcher.model; + + +import com.archivision.common.model.entity.User; + +public record UserWithMatchedProbability(User user, Double probability) {} diff --git a/src/main/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithm.java b/com-matcher/src/main/java/com/archivision/matcher/nlp/LevenshteinAlgorithm.java similarity index 95% rename from src/main/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithm.java rename to com-matcher/src/main/java/com/archivision/matcher/nlp/LevenshteinAlgorithm.java index 50368f2..d99ebde 100644 --- a/src/main/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithm.java +++ b/com-matcher/src/main/java/com/archivision/matcher/nlp/LevenshteinAlgorithm.java @@ -1,4 +1,4 @@ -package com.archivision.community.matcher.nlp; +package com.archivision.matcher.nlp; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/matcher/nlp/TopicComparator.java b/com-matcher/src/main/java/com/archivision/matcher/nlp/TopicComparator.java similarity index 64% rename from src/main/java/com/archivision/community/matcher/nlp/TopicComparator.java rename to com-matcher/src/main/java/com/archivision/matcher/nlp/TopicComparator.java index 71a23d0..05b9e36 100644 --- a/src/main/java/com/archivision/community/matcher/nlp/TopicComparator.java +++ b/com-matcher/src/main/java/com/archivision/matcher/nlp/TopicComparator.java @@ -1,4 +1,4 @@ -package com.archivision.community.matcher.nlp; +package com.archivision.matcher.nlp; public interface TopicComparator { double compare(String word1, String word2); diff --git a/src/main/java/com/archivision/community/matcher/MatchedUsersListResolver.java b/com-matcher/src/main/java/com/archivision/matcher/service/MatchedUsersListResolver.java similarity index 83% rename from src/main/java/com/archivision/community/matcher/MatchedUsersListResolver.java rename to com-matcher/src/main/java/com/archivision/matcher/service/MatchedUsersListResolver.java index 7051186..59f3616 100644 --- a/src/main/java/com/archivision/community/matcher/MatchedUsersListResolver.java +++ b/com-matcher/src/main/java/com/archivision/matcher/service/MatchedUsersListResolver.java @@ -1,7 +1,8 @@ -package com.archivision.community.matcher; +package com.archivision.matcher.service; -import com.archivision.community.entity.User; -import com.archivision.community.matcher.model.UserWithMatchedProbability; +import com.archivision.common.model.entity.User; +import com.archivision.matcher.model.MatchResult; +import com.archivision.matcher.model.UserWithMatchedProbability; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/matcher/UserComparator.java b/com-matcher/src/main/java/com/archivision/matcher/service/UserComparator.java similarity index 86% rename from src/main/java/com/archivision/community/matcher/UserComparator.java rename to com-matcher/src/main/java/com/archivision/matcher/service/UserComparator.java index 7c6544c..d12dac3 100644 --- a/src/main/java/com/archivision/community/matcher/UserComparator.java +++ b/com-matcher/src/main/java/com/archivision/matcher/service/UserComparator.java @@ -1,6 +1,6 @@ -package com.archivision.community.matcher; +package com.archivision.matcher.service; -import com.archivision.community.matcher.model.UserWithMatchedProbability; +import com.archivision.matcher.model.UserWithMatchedProbability; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/archivision/community/matcher/UserMatcher.java b/com-matcher/src/main/java/com/archivision/matcher/service/UserMatcher.java similarity index 89% rename from src/main/java/com/archivision/community/matcher/UserMatcher.java rename to com-matcher/src/main/java/com/archivision/matcher/service/UserMatcher.java index 1417870..7b82cf3 100644 --- a/src/main/java/com/archivision/community/matcher/UserMatcher.java +++ b/com-matcher/src/main/java/com/archivision/matcher/service/UserMatcher.java @@ -1,15 +1,17 @@ -package com.archivision.community.matcher; +package com.archivision.matcher.service; -import com.archivision.community.entity.Topic; -import com.archivision.community.entity.User; -import com.archivision.community.matcher.nlp.TopicComparator; +import com.archivision.common.model.entity.Topic; +import com.archivision.common.model.entity.User; +import com.archivision.matcher.model.MatchResult; +import com.archivision.matcher.model.MatchStatus; +import com.archivision.matcher.nlp.TopicComparator; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.Set; -import static com.archivision.community.matcher.bias.MatchingBias.*; +import static com.archivision.matcher.bias.MatchingBias.*; import static java.lang.Math.abs; import static java.lang.Math.exp; diff --git a/com-payment/pom.xml b/com-payment/pom.xml new file mode 100644 index 0000000..05a011c --- /dev/null +++ b/com-payment/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + com.archivision + community + 0.0.1-SNAPSHOT + + + com-payment + + + 19 + 19 + UTF-8 + + + + com.archivision + com-common + 0.0.1-SNAPSHOT + compile + + + + \ No newline at end of file diff --git a/com-payment/src/main/java/com/archivision/payment/CommunityPaymentApplication.java b/com-payment/src/main/java/com/archivision/payment/CommunityPaymentApplication.java new file mode 100644 index 0000000..ad38d62 --- /dev/null +++ b/com-payment/src/main/java/com/archivision/payment/CommunityPaymentApplication.java @@ -0,0 +1,13 @@ +package com.archivision.payment; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +public class CommunityPaymentApplication { + public static void main(String[] args) { + SpringApplication.run(CommunityPaymentApplication.class, args); + } +} diff --git a/src/main/java/com/archivision/community/config/PayPalConfig.java b/com-payment/src/main/java/com/archivision/payment/config/PayPalConfig.java similarity index 93% rename from src/main/java/com/archivision/community/config/PayPalConfig.java rename to com-payment/src/main/java/com/archivision/payment/config/PayPalConfig.java index ee6c1b9..90dca3d 100644 --- a/src/main/java/com/archivision/community/config/PayPalConfig.java +++ b/com-payment/src/main/java/com/archivision/payment/config/PayPalConfig.java @@ -1,4 +1,4 @@ -package com.archivision.community.config; +package com.archivision.payment.config; import com.paypal.base.rest.APIContext; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/com/archivision/community/controller/PayPalController.java b/com-payment/src/main/java/com/archivision/payment/controller/PayPalController.java similarity index 92% rename from src/main/java/com/archivision/community/controller/PayPalController.java rename to com-payment/src/main/java/com/archivision/payment/controller/PayPalController.java index d15cdcd..4d93f55 100644 --- a/src/main/java/com/archivision/community/controller/PayPalController.java +++ b/com-payment/src/main/java/com/archivision/payment/controller/PayPalController.java @@ -1,8 +1,8 @@ -package com.archivision.community.controller; +package com.archivision.payment.controller; -import com.archivision.community.dto.PaymentRequestDto; -import com.archivision.community.event.PaymentEvent; -import com.archivision.community.service.PayPalService; +import com.archivision.common.model.dto.PaymentRequestDto; +import com.archivision.payment.model.PaymentEvent; +import com.archivision.payment.service.PayPalService; import com.paypal.api.payments.Links; import com.paypal.api.payments.Payment; import com.paypal.base.rest.PayPalRESTException; diff --git a/src/main/java/com/archivision/community/event/PaymentEvent.java b/com-payment/src/main/java/com/archivision/payment/model/PaymentEvent.java similarity index 76% rename from src/main/java/com/archivision/community/event/PaymentEvent.java rename to com-payment/src/main/java/com/archivision/payment/model/PaymentEvent.java index 14727fd..e6a823c 100644 --- a/src/main/java/com/archivision/community/event/PaymentEvent.java +++ b/com-payment/src/main/java/com/archivision/payment/model/PaymentEvent.java @@ -1,4 +1,4 @@ -package com.archivision.community.event; +package com.archivision.payment.model; import java.io.Serializable; diff --git a/src/main/java/com/archivision/community/service/PayPalService.java b/com-payment/src/main/java/com/archivision/payment/service/PayPalService.java similarity index 95% rename from src/main/java/com/archivision/community/service/PayPalService.java rename to com-payment/src/main/java/com/archivision/payment/service/PayPalService.java index 2ed7aec..80cb700 100644 --- a/src/main/java/com/archivision/community/service/PayPalService.java +++ b/com-payment/src/main/java/com/archivision/payment/service/PayPalService.java @@ -1,6 +1,6 @@ -package com.archivision.community.service; +package com.archivision.payment.service; -import com.archivision.community.dto.PaymentRequestDto; +import com.archivision.common.model.dto.PaymentRequestDto; import com.paypal.api.payments.*; import com.paypal.base.rest.APIContext; import com.paypal.base.rest.PayPalRESTException; diff --git a/pom.xml b/pom.xml index a97537c..988a2e0 100644 --- a/pom.xml +++ b/pom.xml @@ -11,9 +11,16 @@ com.archivision community 0.0.1-SNAPSHOT - Community + pom + Community Community - + + com-bot + com-payment + com-common + com-matcher + + 17 diff --git a/src/main/java/com/archivision/community/matcher/model/UserWithMatchedProbability.java b/src/main/java/com/archivision/community/matcher/model/UserWithMatchedProbability.java deleted file mode 100644 index 3dc4db0..0000000 --- a/src/main/java/com/archivision/community/matcher/model/UserWithMatchedProbability.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.archivision.community.matcher.model; - - -import com.archivision.community.entity.User; - -public record UserWithMatchedProbability(User user, Double probability) {} diff --git a/src/test/java/com/archivision/community/CommunityApplicationTests.java b/src/test/java/com/archivision/community/CommunityApplicationTests.java deleted file mode 100644 index f4f2755..0000000 --- a/src/test/java/com/archivision/community/CommunityApplicationTests.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.archivision.community; - -import org.junit.jupiter.api.Test; - - -class CommunityApplicationTests { - @Test - void dummy() { - //dummy for maven - } -} diff --git a/src/test/java/com/archivision/community/matcher/UserMatcherTest.java b/src/test/java/com/archivision/community/matcher/UserMatcherTest.java deleted file mode 100644 index 349813d..0000000 --- a/src/test/java/com/archivision/community/matcher/UserMatcherTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.archivision.community.matcher; - -import com.archivision.community.entity.User; -import com.archivision.community.matcher.nlp.LevenshteinAlgorithm; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -/** - * Tests for verifying probabilities for matching algorithm - * Percentage values are theoretical and should be asserted empirical - * **/ -class UserMatcherTest { - private final double DELTA = 0.001; - private final UserMatcher userMatcher = new UserMatcher(new LevenshteinAlgorithm()); - - @Test - public void testIdealMatch() { - // Ideal match - when match is 1.0 - User userA = new User(); - userA.setAge(18L); - userA.setCity("Lviv"); - - User userB = new User(); - userB.setAge(18L); - userB.setCity("Lviv"); - - userMatcher.match(userA, userB); - - assertEquals(1.0, userMatcher.match(userA, userB).getMatchingProbability(), DELTA); - } - - @Test - public void testPartialMissMatchForCity() { - // Mismatch = when match is less then 50% - // Partial mistmatch = when at least one parameter have match < 50 (But not all) - - User userA = new User(); - userA.setAge(18L); - userA.setCity("Lviv"); - - User userB = new User(); - userB.setAge(18L); - userB.setCity("Kyiv"); - - userMatcher.match(userA, userB); - - assertEquals(0.5, userMatcher.match(userA, userB).getMatchingProbability(), DELTA); - } - - @Test - public void testPartialMissMatchForAge() { - // Slight age difference - User userA = new User(); - userA.setAge(17L); - userA.setCity("Lviv"); - - User userB = new User(); - userB.setAge(18L); - userB.setCity("Lviv"); - - userMatcher.match(userA, userB); - - assertEquals(0.683, userMatcher.match(userA, userB).getMatchingProbability(), DELTA); - - // Big age difference - User userC = new User(); - userC.setAge(16L); - userC.setCity("Lviv"); - - User userD = new User(); - userD.setAge(18L); - userD.setCity("Lviv"); - - userMatcher.match(userC, userD); - - assertEquals(0.567, userMatcher.match(userC, userD).getMatchingProbability(), DELTA); - } - - @Test - public void testAgeDatingCondition() { - User userA = new User(); - userA.setAge(10L); - userA.setCity("Lviv"); - - User userB = new User(); - userB.setAge(18L); - userB.setCity("Lviv"); - - userMatcher.match(userA, userB); - - - MatchResult match = userMatcher.match(userA, userB); - assertNull(match.getMatchingProbability()); - assertEquals(MatchStatus.UNACCEPTABLE_AGE_DIFFERENCE,match.getMatchStatus()); - } -} \ No newline at end of file diff --git a/src/test/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithmTest.java b/src/test/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithmTest.java deleted file mode 100644 index 9c85805..0000000 --- a/src/test/java/com/archivision/community/matcher/nlp/LevenshteinAlgorithmTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.archivision.community.matcher.nlp; - -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class LevenshteinAlgorithmTest { - @Test - public void testIdenticalWords() { - final LevenshteinAlgorithm wordsComparator = new LevenshteinAlgorithm(); - assertEquals(wordsComparator.compare("Oleh", "Oleh"), 1.0); - } - - @Test - public void testAverageComparisonTime() { - final List executionTimeList = new ArrayList<>(); - LevenshteinAlgorithm wordsComparator = new LevenshteinAlgorithm(); - - for (int i = 0; i < 1000; i++) { - long start = System.currentTimeMillis(); - wordsComparator.compare("Oleh", "Oleh"); - executionTimeList.add(System.currentTimeMillis() - start); - } - - assertTrue(executionTimeList.stream() - .mapToLong(Long::longValue) - .average().orElseThrow() < 5, "Two word comparison is slower then 5 millis"); - } - - @Test - public void testCaseDifferentWords() { - final LevenshteinAlgorithm wordsComparator = new LevenshteinAlgorithm(); - assertEquals(0.25, wordsComparator.compare("OLEH", "Oleh")); - } - - @Test - public void testSynonymWords() { - final LevenshteinAlgorithm wordsComparator = new LevenshteinAlgorithm(); - assertEquals(0.08333333333333337, wordsComparator.compare("conversation", "talk")); - } - - @Test - public void testShortWordsDifference() { - final LevenshteinAlgorithm wordsComparator = new LevenshteinAlgorithm(); - assertEquals(0.5, wordsComparator.compare("good", "qsod")); - assertEquals(0.25, wordsComparator.compare("good", "bad")); - assertEquals(0.0, wordsComparator.compare("good", "nice")); - } - -} \ No newline at end of file