Small fixes
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="TelegaBotApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<envs>
|
||||
<env name="BOT_NAME" value="TelegaBot" />
|
||||
<env name="BOT_TOKEN" value="6327661839:AAEb3TpttDK2ladUKD_FlhX9VAgVpGPdPE0" />
|
||||
<env name="DB_PASSWORD" value="Vftrixpo05" />
|
||||
<env name="DB_URL" value="jdbc:postgresql://192.168.0.10:5432/telegabot" />
|
||||
<env name="DB_USER" value="postgres" />
|
||||
<env name="OPENROUTER_API_KEY" value="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" />
|
||||
</envs>
|
||||
<module name="TelegaBot.main" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="ru.cathub.telegabot.TelegaBotApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -19,6 +19,7 @@ ENV SPRING_DATASOURCE_USERNAME=${DB_USER}
|
||||
ENV SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD}
|
||||
ENV BOT_TOKEN=${BOT_TOKEN}
|
||||
ENV BOT_NAME=${BOT_NAME}
|
||||
ENV OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-Dspring.config.location=classpath:/,file:./","-jar","app.jar"]
|
||||
|
||||
@@ -8,6 +8,10 @@ import ru.cathub.telegabot.model.Book;
|
||||
import ru.cathub.telegabot.model.BookEditStateCache;
|
||||
import ru.cathub.telegabot.model.BotUser;
|
||||
import ru.cathub.telegabot.repository.BookRepository;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Optional;
|
||||
|
||||
import ru.cathub.telegabot.repository.UserRepository;
|
||||
|
||||
@@ -74,6 +74,8 @@ public class BookManageServiceImpl implements BookManageService {
|
||||
bookEditingService.updateBookAuthor(user, text);
|
||||
case EDITING_RATING ->
|
||||
bookEditingService.updateBookRating(user, text);
|
||||
case EDITING_DATE ->
|
||||
bookEditingService.updateBookDate(user, text);
|
||||
case CHOOSING_FIELD -> {} // No action needed
|
||||
}
|
||||
}
|
||||
@@ -114,6 +116,9 @@ public class BookManageServiceImpl implements BookManageService {
|
||||
case "BOOK_EDIT_RATING":
|
||||
bookEditingService.handleEditRating(user);
|
||||
break;
|
||||
case "BOOK_EDIT_DATE":
|
||||
bookEditingService.handleEditDate(user);
|
||||
break;
|
||||
case "BOOK_EDIT_CANCEL":
|
||||
// cancelEditing(user);
|
||||
break;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class BookFormatUtils {
|
||||
getBookIcon(index),
|
||||
escapeMarkdown(book.getTitle()),
|
||||
escapeMarkdown(book.getAuthor()),
|
||||
formatDate(book.getReadDate()),
|
||||
escapeMarkdown(formatDate(book.getReadDate())),
|
||||
escapeMarkdown(formatRating(book.getRating())));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
# Telegram configuration
|
||||
bot.token=${BOT_TOKEN}
|
||||
bot.name=${BOT_NAME}
|
||||
|
||||
# Database configuration
|
||||
spring.datasource.url=${DB_URL}
|
||||
spring.datasource.username=${DB_USER}
|
||||
spring.datasource.password=${DB_PASSWORD}
|
||||
|
||||
# OpenRouter AI
|
||||
openrouter.api.key=${OPENROUTER_API_KEY}
|
||||
@@ -35,3 +35,16 @@ logging.level.org.springframework.cache=INFO
|
||||
openrouter.api.url=https://openrouter.ai/api/v1
|
||||
openrouter.api.model=deepseek/deepseek-r1-distill-qwen-32b
|
||||
# Для безопасности лучше установить через переменную окружения:
|
||||
|
||||
|
||||
# Telegram configuration
|
||||
bot.token=${BOT_TOKEN}
|
||||
bot.name=${BOT_NAME}
|
||||
|
||||
# Database configuration
|
||||
spring.datasource.url=${DB_URL}
|
||||
spring.datasource.username=${DB_USER}
|
||||
spring.datasource.password=${DB_PASSWORD}
|
||||
|
||||
# OpenRouter AI
|
||||
openrouter.api.key=${OPENROUTER_API_KEY}
|
||||
Reference in New Issue
Block a user