dev add additional info user
Test Workflow / test (push) Waiting to run

This commit is contained in:
vladp
2026-03-25 11:52:01 +07:00
parent 12e001211b
commit e68ad3d3d3
5 changed files with 2 additions and 28 deletions
@@ -21,9 +21,6 @@ public class ComplaintRequest {
@JsonProperty("email") @JsonProperty("email")
private String email; private String email;
@JsonProperty("links")
private List<String> links;
@JsonProperty("status") @JsonProperty("status")
private String status; private String status;
@@ -28,9 +28,6 @@ public class ComplaintResponse {
@JsonProperty("email") @JsonProperty("email")
private String email; private String email;
@JsonProperty("links")
private List<String> links;
@JsonProperty("created_at") @JsonProperty("created_at")
private String createdAt; private String createdAt;
@@ -33,9 +33,6 @@ public class ComplaintEntity {
@Column(name = "email") @Column(name = "email")
private String email; private String email;
@Column(name = "links", columnDefinition = "TEXT")
private String links;
@OneToOne(cascade = CascadeType.ALL) @OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "violation_id") @JoinColumn(name = "violation_id")
@ToString.Exclude @ToString.Exclude
@@ -1,5 +1,6 @@
package ru.soune.nocopy.entity.complaint; package ru.soune.nocopy.entity.complaint;
public enum ComplaintStatus { public enum ComplaintStatus {
CREATED, IN_WORK, COMPLETED, CANCELLED //NEW , SHOWED, LEGAL_IN_WORK, ЖАЛОБА, 3 + 4 , САНКЦАНИРОВАННОЕ ИСПОЛЬЗОВАНИЕ
CREATED, SHOWED, IN_WORK, COMPLETED, CANCELLED
} }
@@ -57,7 +57,6 @@ public class ComplaintEntityService {
.status(ComplaintStatus.CREATED) .status(ComplaintStatus.CREATED)
.complaintText(request.getComplaintText()) .complaintText(request.getComplaintText())
.email(request.getEmail()) .email(request.getEmail())
.links(linksJson)
.violation(violation) .violation(violation)
.build(); .build();
@@ -105,13 +104,6 @@ public class ComplaintEntityService {
} }
if (request.getComplaintText() != null) complaint.setComplaintText(request.getComplaintText()); if (request.getComplaintText() != null) complaint.setComplaintText(request.getComplaintText());
if (request.getEmail() != null) complaint.setEmail(request.getEmail()); if (request.getEmail() != null) complaint.setEmail(request.getEmail());
if (request.getLinks() != null) {
try {
complaint.setLinks(objectMapper.writeValueAsString(request.getLinks()));
} catch (JsonProcessingException e) {
complaint.setLinks(request.getLinks().toString());
}
}
return mapToResponse(complaintRepository.save(complaint)); return mapToResponse(complaintRepository.save(complaint));
} }
@@ -124,22 +116,12 @@ public class ComplaintEntityService {
} }
private ComplaintResponse mapToResponse(ComplaintEntity entity) { private ComplaintResponse mapToResponse(ComplaintEntity entity) {
List<String> linksList = null;
if (entity.getLinks() != null) {
try {
linksList = objectMapper.readValue(entity.getLinks(),
objectMapper.getTypeFactory().constructCollectionType(List.class, String.class));
} catch (JsonProcessingException e) {
log.warn("Failed to parse links JSON: {}", entity.getLinks());
}
}
return ComplaintResponse.builder() return ComplaintResponse.builder()
.id(entity.getId()) .id(entity.getId())
.status(entity.getStatus() != null ? entity.getStatus().name() : null) .status(entity.getStatus() != null ? entity.getStatus().name() : null)
.complaintText(entity.getComplaintText()) .complaintText(entity.getComplaintText())
.email(entity.getEmail()) .email(entity.getEmail())
.links(linksList)
.violationId(entity.getViolation() != null ? entity.getViolation().getId() : null) .violationId(entity.getViolation() != null ? entity.getViolation().getId() : null)
.createdAt(entity.getCreatedAt() != null ? entity.getCreatedAt().format(DATE_FORMATTER) : null) .createdAt(entity.getCreatedAt() != null ? entity.getCreatedAt().format(DATE_FORMATTER) : null)
.updatedAt(entity.getUpdatedAt() != null ? entity.getUpdatedAt().format(DATE_FORMATTER) : null) .updatedAt(entity.getUpdatedAt() != null ? entity.getUpdatedAt().format(DATE_FORMATTER) : null)