Revert "Enhance user timeline grouping and post metadata"

This reverts commit b6c2471bc3.
This commit is contained in:
tim
2025-09-19 00:31:24 +08:00
parent 1c1915285d
commit bc767a6ac9
5 changed files with 104 additions and 307 deletions

View File

@@ -1,7 +1,6 @@
package com.openisle.dto;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
/** Lightweight post metadata used in user profile lists. */
@@ -12,8 +11,6 @@ public class PostMetaDto {
private String title;
private String snippet;
private LocalDateTime createdAt;
private CategoryDto category;
private List<TagDto> tags;
private String category;
private long views;
private long commentCount;
}

View File

@@ -5,7 +5,6 @@ import com.openisle.model.Comment;
import com.openisle.model.Post;
import com.openisle.model.User;
import com.openisle.service.*;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
@@ -24,8 +23,6 @@ public class UserMapper {
private final PostReadService postReadService;
private final LevelService levelService;
private final MedalService medalService;
private final TagMapper tagMapper;
private final CategoryMapper categoryMapper;
@Value("${app.snippet-length}")
private int snippetLength;
@@ -91,12 +88,7 @@ public class UserMapper {
dto.setSnippet(content);
}
dto.setCreatedAt(post.getCreatedAt());
dto.setCategory(categoryMapper.toDto(post.getCategory()));
dto.setTags(post.getTags().stream().map(tagMapper::toDto).collect(Collectors.toList()));
if (post.getLastReplyAt() == null) {
commentService.updatePostCommentStats(post);
}
dto.setCommentCount(post.getCommentCount());
dto.setCategory(post.getCategory().getName());
dto.setViews(post.getViews());
return dto;
}