Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIC] Microservices : separated to modules #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions com-bot/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.archivision</groupId>
<artifactId>community</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>com-bot</artifactId>

<properties>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.archivision</groupId>
<artifactId>com-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.archivision</groupId>
<artifactId>com-payment</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.archivision</groupId>
<artifactId>com-matcher</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.archivision</groupId>
<artifactId>com-matcher</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.archivision.community;
package com.archivision.bot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@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);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.cache;
package com.archivision.bot.cache;

import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.cache;
package com.archivision.bot.cache;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.cache;
package com.archivision.bot.cache;

import java.util.Map;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.cache;
package com.archivision.bot.cache;

import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.command;
package com.archivision.bot.command;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.command;
package com.archivision.bot.command;

public interface ResponseTemplate {
String START = """
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.command;
package com.archivision.bot.command;

public enum UserCommands {
START("/start");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.exception;
package com.archivision.bot.exception;

public class MissingTelegramIdException extends RuntimeException {
public MissingTelegramIdException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.handler;
package com.archivision.bot.handler;

public interface TelegramEventHandler<T> {
void handle(T update);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.model;
package com.archivision.bot.model;

import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.event;
package com.archivision.bot.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.model;
package com.archivision.bot.model;

public enum Reply {
YES("Так"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.model;
package com.archivision.bot.model;

import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.processor;
package com.archivision.bot.processor;

import org.telegram.telegrambots.meta.api.objects.Update;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.archivision.community.bot;
package com.archivision.bot.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
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;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup;
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
Expand Down
Loading
Loading