Skip to content

Commit

Permalink
refactor: delete admin marker for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
BulatRuslanovich committed Oct 19, 2024
1 parent f770ffa commit 5a5afc3
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
import com.bipbup.annotation.MessageQualifier;
import com.bipbup.entity.AppUser;
import com.bipbup.enums.AppUserState;
import static com.bipbup.enums.AppUserState.BASIC_STATE;
import static com.bipbup.enums.AppUserState.QUERY_LIST_STATE;
import static com.bipbup.enums.AppUserState.WAIT_BROADCAST_MESSAGE;
import static com.bipbup.enums.AppUserState.WAIT_CONFIG_NAME_STATE;
import com.bipbup.enums.Role;
import com.bipbup.handlers.StateHandler;
import com.bipbup.service.db.ConfigService;
import com.bipbup.service.bot.NotifierService;
import com.bipbup.service.cache.UserStateCacheService;
import com.bipbup.service.db.ConfigService;
import com.bipbup.utils.CommandMessageConstants.MessageTemplate;
import java.util.function.Supplier;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


import static com.bipbup.enums.AppUserState.BASIC_STATE;
import static com.bipbup.enums.AppUserState.QUERY_LIST_STATE;
import static com.bipbup.enums.AppUserState.WAIT_BROADCAST_MESSAGE;
import static com.bipbup.enums.AppUserState.WAIT_CONFIG_NAME_STATE;
import static com.bipbup.utils.CommandMessageConstants.AdminCommand.BROADCAST;
import static com.bipbup.utils.CommandMessageConstants.AdminCommand.SEARCH;
import static com.bipbup.utils.CommandMessageConstants.AdminMessageTemplate.ENTER_MESSAGE;
Expand All @@ -23,27 +31,17 @@
import static com.bipbup.utils.CommandMessageConstants.BotCommand.MYQUERIES;
import static com.bipbup.utils.CommandMessageConstants.BotCommand.NEWQUERY;
import static com.bipbup.utils.CommandMessageConstants.BotCommand.START;
import com.bipbup.utils.CommandMessageConstants.MessageTemplate;
import static com.bipbup.utils.CommandMessageConstants.MessageTemplate.NO_SAVED_QUERIES;
import static com.bipbup.utils.CommandMessageConstants.MessageTemplate.QUERY_PROMPT;
import static com.bipbup.utils.CommandMessageConstants.MessageTemplate.USER_QUERIES;
import static com.bipbup.utils.CommandMessageConstants.MessageTemplate.WELCOME;
import java.util.function.Supplier;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@MessageQualifier
@RequiredArgsConstructor
public class BasicStateHandler implements StateHandler {

public static final Marker ADMIN_LOG = MarkerFactory.getMarker("ADMIN");

private final UserStateCacheService userStateCacheService;

private final ConfigService configService;
Expand Down Expand Up @@ -136,7 +134,7 @@ private String processBroadcastCommand(AppUser user, String input) {

private String processSearchCommand(AppUser user, String input) {
return processAdminCommand(user, input, SEARCH.toString(), () -> {
log.info(ADMIN_LOG, "{} launched vacancies searching", user.getFirstName());
log.info("Admin: {} launched vacancies searching", user.getFirstName());
notifierService.searchNewVacancies();
return SEARCHING_COMPLETED.toString();
});
Expand Down

0 comments on commit 5a5afc3

Please sign in to comment.