@@ -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