@@ -3,10 +3,12 @@ package ru.soune.nocopy.dto;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
|
||||
public class BaseResponse {
|
||||
@JsonProperty("msg_id")
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package ru.soune.nocopy.dto.monitoring;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import ru.soune.nocopy.entity.monitoring.SearchEngine;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ViolationResponse {
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty("file_id")
|
||||
private String fileId;
|
||||
|
||||
@JsonProperty("file_name")
|
||||
private String fileName;
|
||||
|
||||
@JsonProperty("found_url")
|
||||
private String foundUrl;
|
||||
|
||||
@JsonProperty("page_url")
|
||||
private String pageUrl;
|
||||
|
||||
@JsonProperty("page_title")
|
||||
private String pageTitle;
|
||||
|
||||
@JsonProperty("host")
|
||||
private String host;
|
||||
|
||||
@JsonProperty("search_engine")
|
||||
private SearchEngine searchEngine;
|
||||
|
||||
@JsonProperty("found_at")
|
||||
private LocalDateTime foundAt;
|
||||
|
||||
@JsonProperty("is_new")
|
||||
private boolean isNew;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package ru.soune.nocopy.dto.violation;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ViolationRequest {
|
||||
|
||||
@JsonProperty("file_id")
|
||||
private String fileId;
|
||||
|
||||
@JsonProperty("page")
|
||||
private Integer page = 0;
|
||||
|
||||
@JsonProperty("size")
|
||||
private Integer size = 10;
|
||||
|
||||
@JsonProperty("sort_direction")
|
||||
private String sortDirection = "desc";
|
||||
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
@JsonProperty("start_date")
|
||||
private String startDate;
|
||||
|
||||
@JsonProperty("end_date")
|
||||
private String endDate;
|
||||
|
||||
@JsonProperty("group_by")
|
||||
private String groupBy;
|
||||
|
||||
@JsonProperty("action")
|
||||
private String action;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package ru.soune.nocopy.dto.violation;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import ru.soune.nocopy.entity.violation.Violation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ViolationResponse {
|
||||
|
||||
@JsonProperty("violations")
|
||||
private List<ViolationDto> violations;
|
||||
|
||||
@JsonProperty("total_elements")
|
||||
private long totalElements;
|
||||
|
||||
@JsonProperty("total_pages")
|
||||
private int totalPages;
|
||||
|
||||
@JsonProperty("current_page")
|
||||
private int currentPage;
|
||||
|
||||
@JsonProperty("page_size")
|
||||
private int pageSize;
|
||||
|
||||
@JsonProperty("has_next")
|
||||
private boolean hasNext;
|
||||
|
||||
@JsonProperty("has_previous")
|
||||
private boolean hasPrevious;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static class ViolationDto {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
|
||||
@JsonProperty("page_url")
|
||||
private String pageUrl;
|
||||
|
||||
@JsonProperty("page_title")
|
||||
private String pageTitle;
|
||||
|
||||
@JsonProperty("host")
|
||||
private String host;
|
||||
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
@JsonProperty("created_date")
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
@JsonProperty("file_id")
|
||||
private String fileId;
|
||||
|
||||
public static ViolationDto fromEntity(Violation violation) {
|
||||
return ViolationDto.builder()
|
||||
.id(violation.getId())
|
||||
.url(violation.getUrl())
|
||||
.pageUrl(violation.getPageUrl())
|
||||
.pageTitle(violation.getPageTitle())
|
||||
.host(violation.getHost())
|
||||
.status(violation.getStatus())
|
||||
.createdDate(violation.getCreatedDate())
|
||||
.fileId(violation.getFileEntity() != null ? violation.getFileEntity().getId() : null)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user