refactor: Remove unused method and streamline service dependencies

This commit is contained in:
2025-02-08 15:56:01 +03:00
committed by Sanders
parent dae8563bf3
commit 16c90a17c6
2 changed files with 9 additions and 13 deletions
@@ -1,6 +1,7 @@
package ru.cathub.telegabot.service.impl;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import ru.cathub.telegabot.model.BotUser;
import ru.cathub.telegabot.service.BookCacheService;
@@ -86,7 +87,4 @@ public class BookListingServiceImpl implements BookListingService {
return sb.toString();
}
public void showPaginatedBookList(BotUser botUser, int page, Integer messageId, Boolean forEdit) {
// Logic for showing paginated book list
}
}
@@ -10,11 +10,7 @@ import ru.cathub.telegabot.bot.KeyboardHelper;
import ru.cathub.telegabot.model.*;
import ru.cathub.telegabot.repository.BookRepository;
import ru.cathub.telegabot.repository.UserRepository;
import ru.cathub.telegabot.service.BookCacheService;
import ru.cathub.telegabot.service.BookManageService;
import ru.cathub.telegabot.service.BookCreationService;
import ru.cathub.telegabot.service.BookEditingService;
import ru.cathub.telegabot.service.BookListingService;
import ru.cathub.telegabot.service.*;
import java.util.Optional;
@@ -35,6 +31,8 @@ public class BookManageServiceImpl implements BookManageService {
private final UserRepository userRepository;
private final BookCacheService bookCacheService;
private final BookRepository bookRepository;
private final TelegramClientService telegramClientService;
public static String formatRating(int rating) {
// Ограничиваем рейтинг в диапазоне 0-10
@@ -103,13 +101,13 @@ public class BookManageServiceImpl implements BookManageService {
//handleExistingAddCache(user, text);
break;
case EDITING_TITLE:
updateBookTitle(user, text);
bookEditingService.updateBookTitle(user, text);
break;
case EDITING_AUTHOR:
updateBookAuthor(user, text);
bookEditingService.updateBookAuthor(user, text);
break;
case EDITING_RATING:
updateBookRating(user, text);
bookEditingService.updateBookRating(user, text);
break;
}
}
@@ -138,10 +136,10 @@ public class BookManageServiceImpl implements BookManageService {
bookCacheService.updateBookListState(user.getId(), bookListCache);
}
var bookEditCache = bookCacheService.getBookEditCache(user.getId());
showPaginatedBookList(user, page, bookListCache.getListMessageId(),bookEditCache != null);
bookListingService.showPaginatedBookList(user, page, bookListCache.getListMessageId(),bookEditCache != null);
} else if (text.startsWith("BOOK_EDIT_ID_")) {
Long bookId = Long.parseLong(text.split("_")[3]);
processBookSelection(user, bookId);
bookEditingService.processBookSelection(user, bookId);
} else {
switch (text) {
case "BOOK_EDIT_TITLE":