mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-24 21:46:09 +00:00
Revert "Return structured category and tag data in change logs"
This reverts commit fe167aa0b9.
This commit is contained in:
@@ -5,7 +5,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -19,10 +18,10 @@ public class PostChangeLogDto {
|
|||||||
private String newTitle;
|
private String newTitle;
|
||||||
private String oldContent;
|
private String oldContent;
|
||||||
private String newContent;
|
private String newContent;
|
||||||
private CategoryDto oldCategory;
|
private String oldCategory;
|
||||||
private CategoryDto newCategory;
|
private String newCategory;
|
||||||
private List<TagDto> oldTags;
|
private String oldTags;
|
||||||
private List<TagDto> newTags;
|
private String newTags;
|
||||||
private Boolean oldClosed;
|
private Boolean oldClosed;
|
||||||
private Boolean newClosed;
|
private Boolean newClosed;
|
||||||
private LocalDateTime oldPinnedAt;
|
private LocalDateTime oldPinnedAt;
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
package com.openisle.mapper;
|
package com.openisle.mapper;
|
||||||
|
|
||||||
import com.openisle.dto.CategoryDto;
|
|
||||||
import com.openisle.dto.PostChangeLogDto;
|
import com.openisle.dto.PostChangeLogDto;
|
||||||
import com.openisle.dto.TagDto;
|
|
||||||
import com.openisle.model.*;
|
import com.openisle.model.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class PostChangeLogMapper {
|
public class PostChangeLogMapper {
|
||||||
public PostChangeLogDto toDto(PostChangeLog log) {
|
public PostChangeLogDto toDto(PostChangeLog log) {
|
||||||
@@ -28,41 +22,11 @@ public class PostChangeLogMapper {
|
|||||||
dto.setOldContent(c.getOldContent());
|
dto.setOldContent(c.getOldContent());
|
||||||
dto.setNewContent(c.getNewContent());
|
dto.setNewContent(c.getNewContent());
|
||||||
} else if (log instanceof PostCategoryChangeLog cat) {
|
} else if (log instanceof PostCategoryChangeLog cat) {
|
||||||
if (cat.getOldCategory() != null) {
|
dto.setOldCategory(cat.getOldCategory());
|
||||||
CategoryDto oldCat = new CategoryDto();
|
dto.setNewCategory(cat.getNewCategory());
|
||||||
oldCat.setName(cat.getOldCategory());
|
|
||||||
dto.setOldCategory(oldCat);
|
|
||||||
}
|
|
||||||
if (cat.getNewCategory() != null) {
|
|
||||||
CategoryDto newCat = new CategoryDto();
|
|
||||||
newCat.setName(cat.getNewCategory());
|
|
||||||
dto.setNewCategory(newCat);
|
|
||||||
}
|
|
||||||
} else if (log instanceof PostTagChangeLog tag) {
|
} else if (log instanceof PostTagChangeLog tag) {
|
||||||
if (tag.getOldTags() != null && !tag.getOldTags().isBlank()) {
|
dto.setOldTags(tag.getOldTags());
|
||||||
List<TagDto> oldTags = Arrays.stream(tag.getOldTags().split(","))
|
dto.setNewTags(tag.getNewTags());
|
||||||
.map(String::trim)
|
|
||||||
.filter(s -> !s.isEmpty())
|
|
||||||
.map(name -> {
|
|
||||||
TagDto t = new TagDto();
|
|
||||||
t.setName(name);
|
|
||||||
return t;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
dto.setOldTags(oldTags);
|
|
||||||
}
|
|
||||||
if (tag.getNewTags() != null && !tag.getNewTags().isBlank()) {
|
|
||||||
List<TagDto> newTags = Arrays.stream(tag.getNewTags().split(","))
|
|
||||||
.map(String::trim)
|
|
||||||
.filter(s -> !s.isEmpty())
|
|
||||||
.map(name -> {
|
|
||||||
TagDto t = new TagDto();
|
|
||||||
t.setName(name);
|
|
||||||
return t;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
dto.setNewTags(newTags);
|
|
||||||
}
|
|
||||||
} else if (log instanceof PostClosedChangeLog cl) {
|
} else if (log instanceof PostClosedChangeLog cl) {
|
||||||
dto.setOldClosed(cl.isOldClosed());
|
dto.setOldClosed(cl.isOldClosed());
|
||||||
dto.setNewClosed(cl.isNewClosed());
|
dto.setNewClosed(cl.isNewClosed());
|
||||||
|
|||||||
Reference in New Issue
Block a user