NCBACK-162
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-29 18:17:04 +07:00
parent bc26b39d86
commit 5e494ffc4b
60 changed files with 670 additions and 837 deletions
@@ -1,6 +1,7 @@
package ru.soune.nocopy.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -23,7 +24,7 @@ public class ViolationNotionHandler implements RequestHandler {
private final ViolationNotionService notionService;
private final AuthTokenRepository authTokenRepository;
private final HttpServletRequest httpServletRequest;
@Override
public BaseResponse handle(BaseRequest request) {
@@ -31,24 +32,7 @@ public class ViolationNotionHandler implements RequestHandler {
ViolationNotionRequest notionRequest = objectMapper.convertValue(
request.getMessageBody(), ViolationNotionRequest.class);
if (notionRequest.getToken() == null) {
return new BaseResponse(
request.getMsgId(),
MessageCode.INVALID_TOKEN.getCode(),
"Token is required",
"field: token");
}
Optional<AuthToken> tokenOptional = authTokenRepository.findByToken(notionRequest.getToken());
if (tokenOptional.isEmpty()) {
return new BaseResponse(
request.getMsgId(),
MessageCode.INVALID_TOKEN.getCode(),
"Invalid token",
notionRequest.getToken());
}
Long userId = tokenOptional.get().getUser().getId();
Long userId = (Long) httpServletRequest.getAttribute("userId");
String action = notionRequest.getAction();
if (action == null || action.trim().isEmpty()) {