mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-02 16:07:34 +08:00
Implement profile page and related backend APIs
This commit is contained in:
@@ -101,4 +101,8 @@ public class CommentService {
|
||||
Pageable pageable = PageRequest.of(0, limit);
|
||||
return commentRepository.findByAuthorOrderByCreatedAtDesc(user, pageable);
|
||||
}
|
||||
|
||||
public java.util.List<Comment> getCommentsByIds(java.util.List<Long> ids) {
|
||||
return commentRepository.findAllById(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,15 @@ public class PostService {
|
||||
return postRepository.findByAuthorAndStatusOrderByCreatedAtDesc(user, PostStatus.PUBLISHED, pageable);
|
||||
}
|
||||
|
||||
public java.time.LocalDateTime getLastPostTime(String username) {
|
||||
return postRepository.findLastPostTime(username);
|
||||
}
|
||||
|
||||
public long getTotalViews(String username) {
|
||||
Long v = postRepository.sumViews(username);
|
||||
return v != null ? v : 0;
|
||||
}
|
||||
|
||||
public List<Post> listPostsByTags(java.util.List<Long> tagIds,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
@@ -180,4 +189,8 @@ public class PostService {
|
||||
notificationService.createNotification(post.getAuthor(), NotificationType.POST_REVIEWED, post, null, false);
|
||||
return post;
|
||||
}
|
||||
|
||||
public java.util.List<Post> getPostsByIds(java.util.List<Long> ids) {
|
||||
return postRepository.findAllById(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,4 +69,12 @@ public class ReactionService {
|
||||
.orElseThrow(() -> new IllegalArgumentException("Comment not found"));
|
||||
return reactionRepository.findByComment(comment);
|
||||
}
|
||||
|
||||
public java.util.List<Long> topPostIds(String username, int limit) {
|
||||
return reactionRepository.findTopPostIds(username, org.springframework.data.domain.PageRequest.of(0, limit));
|
||||
}
|
||||
|
||||
public java.util.List<Long> topCommentIds(String username, int limit) {
|
||||
return reactionRepository.findTopCommentIds(username, org.springframework.data.domain.PageRequest.of(0, limit));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user