dev add statistic files protected
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-04-15 18:28:42 +07:00
parent 2d80b40b27
commit be62dd458a
8 changed files with 137 additions and 1 deletions
@@ -0,0 +1,34 @@
package ru.soune.nocopy.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import ru.soune.nocopy.dto.BaseRequest;
import ru.soune.nocopy.dto.BaseResponse;
import ru.soune.nocopy.dto.MessageCode;
import ru.soune.nocopy.dto.statistic.ViolationStatisticResponse;
import ru.soune.nocopy.service.statistic.ViolationStatisticService;
@Component
@RequiredArgsConstructor
@Slf4j
public class StatisticViolationHandler implements RequestHandler {
private final ObjectMapper objectMapper;
private final ViolationStatisticService statisticService;
@Override
public BaseResponse handle(BaseRequest request) throws Exception {
log.debug("Handling violation statistic request, msgId: {}", request.getMsgId());
ViolationStatisticResponse statistics = statisticService.getViolationStatistics();
return new BaseResponse(
request.getMsgId(),
MessageCode.SUCCESS.getCode(),
MessageCode.SUCCESS.getDescription(),
statistics
);
}
}