mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-27 16:40:50 +08:00
feat: add user leveling and experience system
This commit is contained in:
@@ -19,4 +19,8 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
|
||||
|
||||
@org.springframework.data.jpa.repository.Query("SELECT MAX(c.createdAt) FROM Comment c WHERE c.post = :post")
|
||||
java.time.LocalDateTime findLastCommentTime(@org.springframework.data.repository.query.Param("post") Post post);
|
||||
|
||||
@org.springframework.data.jpa.repository.Query("SELECT COUNT(c) FROM Comment c WHERE c.author.username = :username AND c.createdAt >= :start")
|
||||
long countByAuthorAfter(@org.springframework.data.repository.query.Param("username") String username,
|
||||
@org.springframework.data.repository.query.Param("start") java.time.LocalDateTime start);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||
@Query("SELECT SUM(p.views) FROM Post p WHERE p.author.username = :username AND p.status = com.openisle.model.PostStatus.PUBLISHED")
|
||||
Long sumViews(@Param("username") String username);
|
||||
|
||||
@Query("SELECT COUNT(p) FROM Post p WHERE p.author.username = :username AND p.createdAt >= :start")
|
||||
long countByAuthorAfter(@Param("username") String username, @Param("start") java.time.LocalDateTime start);
|
||||
|
||||
long countByCategory_Id(Long categoryId);
|
||||
|
||||
long countDistinctByTags_Id(Long tagId);
|
||||
|
||||
@@ -27,6 +27,9 @@ public interface ReactionRepository extends JpaRepository<Reaction, Long> {
|
||||
@Query("SELECT COUNT(r) FROM Reaction r WHERE r.user.username = :username AND r.type = com.openisle.model.ReactionType.LIKE")
|
||||
long countLikesSent(@Param("username") String username);
|
||||
|
||||
@Query("SELECT COUNT(r) FROM Reaction r WHERE r.user.username = :username AND r.createdAt >= :start")
|
||||
long countByUserAfter(@Param("username") String username, @Param("start") java.time.LocalDateTime start);
|
||||
|
||||
@Query("SELECT COUNT(r) FROM Reaction r WHERE r.type = com.openisle.model.ReactionType.LIKE AND ((r.post IS NOT NULL AND r.post.author.username = :username) OR (r.comment IS NOT NULL AND r.comment.author.username = :username))")
|
||||
long countLikesReceived(@Param("username") String username);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user