mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-20 11:36:07 +00:00
feat: relocate remaining dtos
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.MilkTeaInfoDto;
|
||||||
|
import com.openisle.dto.MilkTeaRedeemRequest;
|
||||||
import com.openisle.model.Activity;
|
import com.openisle.model.Activity;
|
||||||
import com.openisle.model.ActivityType;
|
import com.openisle.model.ActivityType;
|
||||||
import com.openisle.model.User;
|
import com.openisle.model.User;
|
||||||
import com.openisle.service.ActivityService;
|
import com.openisle.service.ActivityService;
|
||||||
import com.openisle.service.UserService;
|
import com.openisle.service.UserService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -25,20 +26,20 @@ public class ActivityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/milk-tea")
|
@GetMapping("/milk-tea")
|
||||||
public MilkTeaInfo milkTea() {
|
public MilkTeaInfoDto milkTea() {
|
||||||
Activity a = activityService.getByType(ActivityType.MILK_TEA);
|
Activity a = activityService.getByType(ActivityType.MILK_TEA);
|
||||||
long count = activityService.countParticipants(a);
|
long count = activityService.countParticipants(a);
|
||||||
if (!a.isEnded() && count >= 50) {
|
if (!a.isEnded() && count >= 50) {
|
||||||
activityService.end(a);
|
activityService.end(a);
|
||||||
}
|
}
|
||||||
MilkTeaInfo info = new MilkTeaInfo();
|
MilkTeaInfoDto info = new MilkTeaInfoDto();
|
||||||
info.setRedeemCount(count);
|
info.setRedeemCount(count);
|
||||||
info.setEnded(a.isEnded());
|
info.setEnded(a.isEnded());
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/milk-tea/redeem")
|
@PostMapping("/milk-tea/redeem")
|
||||||
public java.util.Map<String, String> redeemMilkTea(@RequestBody RedeemRequest req, Authentication auth) {
|
public java.util.Map<String, String> redeemMilkTea(@RequestBody MilkTeaRedeemRequest req, Authentication auth) {
|
||||||
User user = userService.findByIdentifier(auth.getName()).orElseThrow();
|
User user = userService.findByIdentifier(auth.getName()).orElseThrow();
|
||||||
Activity a = activityService.getByType(ActivityType.MILK_TEA);
|
Activity a = activityService.getByType(ActivityType.MILK_TEA);
|
||||||
boolean first = activityService.redeem(a, user, req.getContact());
|
boolean first = activityService.redeem(a, user, req.getContact());
|
||||||
@@ -47,15 +48,4 @@ public class ActivityController {
|
|||||||
}
|
}
|
||||||
return java.util.Map.of("message", "updated");
|
return java.util.Map.of("message", "updated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class MilkTeaInfo {
|
|
||||||
private long redeemCount;
|
|
||||||
private boolean ended;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class RedeemRequest {
|
|
||||||
private String contact;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import com.openisle.model.PasswordStrength;
|
import com.openisle.dto.ConfigDto;
|
||||||
import com.openisle.model.PublishMode;
|
import com.openisle.service.AiUsageService;
|
||||||
import com.openisle.service.PasswordValidator;
|
import com.openisle.service.PasswordValidator;
|
||||||
import com.openisle.service.PostService;
|
import com.openisle.service.PostService;
|
||||||
import com.openisle.service.AiUsageService;
|
|
||||||
import com.openisle.service.RegisterModeService;
|
import com.openisle.service.RegisterModeService;
|
||||||
import com.openisle.model.RegisterMode;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -47,11 +44,4 @@ public class AdminConfigController {
|
|||||||
return getConfig();
|
return getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class ConfigDto {
|
|
||||||
private PublishMode publishMode;
|
|
||||||
private PasswordStrength passwordStrength;
|
|
||||||
private Integer aiFormatLimit;
|
|
||||||
private RegisterMode registerMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import com.openisle.model.Post;
|
import com.openisle.dto.PostSummaryDto;
|
||||||
|
import com.openisle.mapper.PostMapper;
|
||||||
import com.openisle.service.PostService;
|
import com.openisle.service.PostService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -18,77 +17,32 @@ import java.util.stream.Collectors;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AdminPostController {
|
public class AdminPostController {
|
||||||
private final PostService postService;
|
private final PostService postService;
|
||||||
|
private final PostMapper postMapper;
|
||||||
|
|
||||||
@GetMapping("/pending")
|
@GetMapping("/pending")
|
||||||
public List<PostDto> pendingPosts() {
|
public List<PostSummaryDto> pendingPosts() {
|
||||||
return postService.listPendingPosts().stream()
|
return postService.listPendingPosts().stream()
|
||||||
.map(this::toDto)
|
.map(postMapper::toSummaryDto)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/{id}/approve")
|
@PostMapping("/{id}/approve")
|
||||||
public PostDto approve(@PathVariable Long id) {
|
public PostSummaryDto approve(@PathVariable Long id) {
|
||||||
return toDto(postService.approvePost(id));
|
return postMapper.toSummaryDto(postService.approvePost(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/{id}/reject")
|
@PostMapping("/{id}/reject")
|
||||||
public PostDto reject(@PathVariable Long id) {
|
public PostSummaryDto reject(@PathVariable Long id) {
|
||||||
return toDto(postService.rejectPost(id));
|
return postMapper.toSummaryDto(postService.rejectPost(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/{id}/pin")
|
@PostMapping("/{id}/pin")
|
||||||
public PostDto pin(@PathVariable Long id) {
|
public PostSummaryDto pin(@PathVariable Long id) {
|
||||||
return toDto(postService.pinPost(id));
|
return postMapper.toSummaryDto(postService.pinPost(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/{id}/unpin")
|
@PostMapping("/{id}/unpin")
|
||||||
public PostDto unpin(@PathVariable Long id) {
|
public PostSummaryDto unpin(@PathVariable Long id) {
|
||||||
return toDto(postService.unpinPost(id));
|
return postMapper.toSummaryDto(postService.unpinPost(id));
|
||||||
}
|
|
||||||
|
|
||||||
private PostDto toDto(Post post) {
|
|
||||||
PostDto dto = new PostDto();
|
|
||||||
dto.setId(post.getId());
|
|
||||||
dto.setTitle(post.getTitle());
|
|
||||||
dto.setContent(post.getContent());
|
|
||||||
dto.setCreatedAt(post.getCreatedAt());
|
|
||||||
dto.setAuthor(post.getAuthor().getUsername());
|
|
||||||
dto.setCategory(toCategoryDto(post.getCategory()));
|
|
||||||
dto.setViews(post.getViews());
|
|
||||||
dto.setStatus(post.getStatus());
|
|
||||||
dto.setPinnedAt(post.getPinnedAt());
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CategoryDto toCategoryDto(com.openisle.model.Category c) {
|
|
||||||
CategoryDto dto = new CategoryDto();
|
|
||||||
dto.setId(c.getId());
|
|
||||||
dto.setName(c.getName());
|
|
||||||
dto.setDescription(c.getDescription());
|
|
||||||
dto.setIcon(c.getIcon());
|
|
||||||
dto.setSmallIcon(c.getSmallIcon());
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
private String content;
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private String author;
|
|
||||||
private CategoryDto category;
|
|
||||||
private long views;
|
|
||||||
private com.openisle.model.PostStatus status;
|
|
||||||
private LocalDateTime pinnedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CategoryDto {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.TagDto;
|
||||||
import com.openisle.model.Tag;
|
import com.openisle.model.Tag;
|
||||||
import com.openisle.service.TagService;
|
|
||||||
import com.openisle.service.PostService;
|
import com.openisle.service.PostService;
|
||||||
import lombok.Data;
|
import com.openisle.service.TagService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -38,17 +38,8 @@ public class AdminTagController {
|
|||||||
dto.setDescription(tag.getDescription());
|
dto.setDescription(tag.getDescription());
|
||||||
dto.setIcon(tag.getIcon());
|
dto.setIcon(tag.getIcon());
|
||||||
dto.setSmallIcon(tag.getSmallIcon());
|
dto.setSmallIcon(tag.getSmallIcon());
|
||||||
|
dto.setCreatedAt(tag.getCreatedAt());
|
||||||
dto.setCount(count);
|
dto.setCount(count);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class TagDto {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
private Long count;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,17 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import com.openisle.model.User;
|
import com.openisle.dto.*;
|
||||||
import com.openisle.service.EmailSender;
|
|
||||||
import com.openisle.service.JwtService;
|
|
||||||
import com.openisle.service.UserService;
|
|
||||||
import com.openisle.service.CaptchaService;
|
|
||||||
import com.openisle.service.GoogleAuthService;
|
|
||||||
import com.openisle.service.GithubAuthService;
|
|
||||||
import com.openisle.service.DiscordAuthService;
|
|
||||||
import com.openisle.service.TwitterAuthService;
|
|
||||||
import com.openisle.service.RegisterModeService;
|
|
||||||
import com.openisle.service.NotificationService;
|
|
||||||
import com.openisle.model.RegisterMode;
|
|
||||||
import com.openisle.repository.UserRepository;
|
|
||||||
import com.openisle.exception.FieldException;
|
import com.openisle.exception.FieldException;
|
||||||
import lombok.Data;
|
import com.openisle.model.RegisterMode;
|
||||||
|
import com.openisle.model.User;
|
||||||
|
import com.openisle.repository.UserRepository;
|
||||||
|
import com.openisle.service.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -307,71 +299,5 @@ public class AuthController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
// DTO classes moved to com.openisle.dto package
|
||||||
private static class RegisterRequest {
|
|
||||||
private String username;
|
|
||||||
private String email;
|
|
||||||
private String password;
|
|
||||||
private String captcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class LoginRequest {
|
|
||||||
private String username;
|
|
||||||
private String password;
|
|
||||||
private String captcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class GoogleLoginRequest {
|
|
||||||
private String idToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class GithubLoginRequest {
|
|
||||||
private String code;
|
|
||||||
private String redirectUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class DiscordLoginRequest {
|
|
||||||
private String code;
|
|
||||||
private String redirectUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class TwitterLoginRequest {
|
|
||||||
private String code;
|
|
||||||
private String redirectUri;
|
|
||||||
private String codeVerifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class VerifyRequest {
|
|
||||||
private String username;
|
|
||||||
private String code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class MakeReasonRequest {
|
|
||||||
private String token;
|
|
||||||
private String reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ForgotPasswordRequest {
|
|
||||||
private String email;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class VerifyForgotRequest {
|
|
||||||
private String email;
|
|
||||||
private String code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ResetPasswordRequest {
|
|
||||||
private String token;
|
|
||||||
private String password;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.CategoryDto;
|
||||||
|
import com.openisle.dto.CategoryRequest;
|
||||||
|
import com.openisle.dto.PostSummaryDto;
|
||||||
|
import com.openisle.mapper.PostMapper;
|
||||||
import com.openisle.model.Category;
|
import com.openisle.model.Category;
|
||||||
import com.openisle.service.CategoryService;
|
import com.openisle.service.CategoryService;
|
||||||
import com.openisle.service.PostService;
|
import com.openisle.service.PostService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -16,6 +19,7 @@ import java.util.stream.Collectors;
|
|||||||
public class CategoryController {
|
public class CategoryController {
|
||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
private final PostService postService;
|
private final PostService postService;
|
||||||
|
private final PostMapper postMapper;
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CategoryDto create(@RequestBody CategoryRequest req) {
|
public CategoryDto create(@RequestBody CategoryRequest req) {
|
||||||
@@ -57,12 +61,7 @@ public class CategoryController {
|
|||||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||||
return postService.listPostsByCategories(java.util.List.of(id), page, pageSize)
|
return postService.listPostsByCategories(java.util.List.of(id), page, pageSize)
|
||||||
.stream()
|
.stream()
|
||||||
.map(p -> {
|
.map(postMapper::toSummaryDto)
|
||||||
PostSummaryDto dto = new PostSummaryDto();
|
|
||||||
dto.setId(p.getId());
|
|
||||||
dto.setTitle(p.getTitle());
|
|
||||||
return dto;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,28 +75,4 @@ public class CategoryController {
|
|||||||
dto.setCount(count);
|
dto.setCount(count);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CategoryRequest {
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CategoryDto {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
private Long count;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostSummaryDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.AuthorDto;
|
||||||
|
import com.openisle.dto.CommentDto;
|
||||||
|
import com.openisle.dto.CommentRequest;
|
||||||
|
import com.openisle.dto.ReactionDto;
|
||||||
import com.openisle.model.Comment;
|
import com.openisle.model.Comment;
|
||||||
import com.openisle.service.CommentService;
|
import com.openisle.model.CommentSort;
|
||||||
import com.openisle.service.CaptchaService;
|
import com.openisle.service.CaptchaService;
|
||||||
|
import com.openisle.service.CommentService;
|
||||||
import com.openisle.service.LevelService;
|
import com.openisle.service.LevelService;
|
||||||
import com.openisle.service.ReactionService;
|
import com.openisle.service.ReactionService;
|
||||||
import com.openisle.model.CommentSort;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -102,43 +105,15 @@ public class CommentController {
|
|||||||
dto.setId(comment.getId());
|
dto.setId(comment.getId());
|
||||||
dto.setContent(comment.getContent());
|
dto.setContent(comment.getContent());
|
||||||
dto.setCreatedAt(comment.getCreatedAt());
|
dto.setCreatedAt(comment.getCreatedAt());
|
||||||
dto.setAuthor(toAuthorDto(comment.getAuthor()));
|
AuthorDto author = new AuthorDto();
|
||||||
|
author.setId(comment.getAuthor().getId());
|
||||||
|
author.setUsername(comment.getAuthor().getUsername());
|
||||||
|
author.setAvatar(comment.getAuthor().getAvatar());
|
||||||
|
dto.setAuthor(author);
|
||||||
dto.setReward(0);
|
dto.setReward(0);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AuthorDto toAuthorDto(com.openisle.model.User user) {
|
|
||||||
AuthorDto dto = new AuthorDto();
|
|
||||||
dto.setId(user.getId());
|
|
||||||
dto.setUsername(user.getUsername());
|
|
||||||
dto.setAvatar(user.getAvatar());
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CommentRequest {
|
|
||||||
private String content;
|
|
||||||
private String captcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CommentDto {
|
|
||||||
private Long id;
|
|
||||||
private String content;
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private AuthorDto author;
|
|
||||||
private List<CommentDto> replies;
|
|
||||||
private List<ReactionDto> reactions;
|
|
||||||
private int reward;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class AuthorDto {
|
|
||||||
private Long id;
|
|
||||||
private String username;
|
|
||||||
private String avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ReactionDto toReactionDto(com.openisle.model.Reaction reaction) {
|
private ReactionDto toReactionDto(com.openisle.model.Reaction reaction) {
|
||||||
ReactionDto dto = new ReactionDto();
|
ReactionDto dto = new ReactionDto();
|
||||||
dto.setId(reaction.getId());
|
dto.setId(reaction.getId());
|
||||||
@@ -153,14 +128,4 @@ public class CommentController {
|
|||||||
dto.setReward(0);
|
dto.setReward(0);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ReactionDto {
|
|
||||||
private Long id;
|
|
||||||
private com.openisle.model.ReactionType type;
|
|
||||||
private String user;
|
|
||||||
private Long postId;
|
|
||||||
private Long commentId;
|
|
||||||
private int reward;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import lombok.Data;
|
import com.openisle.dto.SiteConfigDto;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import com.openisle.service.RegisterModeService;
|
import com.openisle.service.RegisterModeService;
|
||||||
import com.openisle.model.RegisterMode;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -34,8 +33,8 @@ public class ConfigController {
|
|||||||
private final RegisterModeService registerModeService;
|
private final RegisterModeService registerModeService;
|
||||||
|
|
||||||
@GetMapping("/config")
|
@GetMapping("/config")
|
||||||
public ConfigResponse getConfig() {
|
public SiteConfigDto getConfig() {
|
||||||
ConfigResponse resp = new ConfigResponse();
|
SiteConfigDto resp = new SiteConfigDto();
|
||||||
resp.setCaptchaEnabled(captchaEnabled);
|
resp.setCaptchaEnabled(captchaEnabled);
|
||||||
resp.setRegisterCaptchaEnabled(registerCaptchaEnabled);
|
resp.setRegisterCaptchaEnabled(registerCaptchaEnabled);
|
||||||
resp.setLoginCaptchaEnabled(loginCaptchaEnabled);
|
resp.setLoginCaptchaEnabled(loginCaptchaEnabled);
|
||||||
@@ -45,15 +44,4 @@ public class ConfigController {
|
|||||||
resp.setRegisterMode(registerModeService.getRegisterMode());
|
resp.setRegisterMode(registerModeService.getRegisterMode());
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ConfigResponse {
|
|
||||||
private boolean captchaEnabled;
|
|
||||||
private boolean registerCaptchaEnabled;
|
|
||||||
private boolean loginCaptchaEnabled;
|
|
||||||
private boolean postCaptchaEnabled;
|
|
||||||
private boolean commentCaptchaEnabled;
|
|
||||||
private int aiFormatLimit;
|
|
||||||
private RegisterMode registerMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.DraftDto;
|
||||||
|
import com.openisle.dto.DraftRequest;
|
||||||
import com.openisle.model.Draft;
|
import com.openisle.model.Draft;
|
||||||
import com.openisle.service.DraftService;
|
import com.openisle.service.DraftService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -48,20 +48,4 @@ public class DraftController {
|
|||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class DraftRequest {
|
|
||||||
private String title;
|
|
||||||
private String content;
|
|
||||||
private Long categoryId;
|
|
||||||
private List<Long> tagIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class DraftDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
private String content;
|
|
||||||
private Long categoryId;
|
|
||||||
private List<Long> tagIds;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import com.openisle.model.Notification;
|
import com.openisle.dto.AuthorDto;
|
||||||
import com.openisle.model.NotificationType;
|
import com.openisle.dto.CommentDto;
|
||||||
import com.openisle.model.ReactionType;
|
import com.openisle.dto.NotificationDto;
|
||||||
|
import com.openisle.dto.NotificationMarkReadRequest;
|
||||||
|
import com.openisle.dto.NotificationUnreadCountDto;
|
||||||
|
import com.openisle.dto.PostSummaryDto;
|
||||||
import com.openisle.model.Comment;
|
import com.openisle.model.Comment;
|
||||||
import com.openisle.model.Post;
|
import com.openisle.model.Notification;
|
||||||
import com.openisle.service.NotificationService;
|
import com.openisle.service.NotificationService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -31,15 +33,15 @@ public class NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unread-count")
|
@GetMapping("/unread-count")
|
||||||
public UnreadCount unreadCount(Authentication auth) {
|
public NotificationUnreadCountDto unreadCount(Authentication auth) {
|
||||||
long count = notificationService.countUnread(auth.getName());
|
long count = notificationService.countUnread(auth.getName());
|
||||||
UnreadCount uc = new UnreadCount();
|
NotificationUnreadCountDto uc = new NotificationUnreadCountDto();
|
||||||
uc.setCount(count);
|
uc.setCount(count);
|
||||||
return uc;
|
return uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/read")
|
@PostMapping("/read")
|
||||||
public void markRead(@RequestBody MarkReadRequest req, Authentication auth) {
|
public void markRead(@RequestBody NotificationMarkReadRequest req, Authentication auth) {
|
||||||
notificationService.markRead(auth.getName(), req.getIds());
|
notificationService.markRead(auth.getName(), req.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +50,10 @@ public class NotificationController {
|
|||||||
dto.setId(n.getId());
|
dto.setId(n.getId());
|
||||||
dto.setType(n.getType());
|
dto.setType(n.getType());
|
||||||
if (n.getPost() != null) {
|
if (n.getPost() != null) {
|
||||||
dto.setPost(toPostDto(n.getPost()));
|
PostSummaryDto postDto = new PostSummaryDto();
|
||||||
|
postDto.setId(n.getPost().getId());
|
||||||
|
postDto.setTitle(n.getPost().getTitle());
|
||||||
|
dto.setPost(postDto);
|
||||||
}
|
}
|
||||||
if (n.getComment() != null) {
|
if (n.getComment() != null) {
|
||||||
dto.setComment(toCommentDto(n.getComment()));
|
dto.setComment(toCommentDto(n.getComment()));
|
||||||
@@ -58,7 +63,11 @@ public class NotificationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n.getFromUser() != null) {
|
if (n.getFromUser() != null) {
|
||||||
dto.setFromUser(toAuthorDto(n.getFromUser()));
|
AuthorDto author = new AuthorDto();
|
||||||
|
author.setId(n.getFromUser().getId());
|
||||||
|
author.setUsername(n.getFromUser().getUsername());
|
||||||
|
author.setAvatar(n.getFromUser().getAvatar());
|
||||||
|
dto.setFromUser(author);
|
||||||
}
|
}
|
||||||
if (n.getReactionType() != null) {
|
if (n.getReactionType() != null) {
|
||||||
dto.setReactionType(n.getReactionType());
|
dto.setReactionType(n.getReactionType());
|
||||||
@@ -70,73 +79,16 @@ public class NotificationController {
|
|||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PostDto toPostDto(Post post) {
|
|
||||||
PostDto dto = new PostDto();
|
|
||||||
dto.setId(post.getId());
|
|
||||||
dto.setTitle(post.getTitle());
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CommentDto toCommentDto(Comment comment) {
|
private CommentDto toCommentDto(Comment comment) {
|
||||||
CommentDto dto = new CommentDto();
|
CommentDto dto = new CommentDto();
|
||||||
dto.setId(comment.getId());
|
dto.setId(comment.getId());
|
||||||
dto.setContent(comment.getContent());
|
dto.setContent(comment.getContent());
|
||||||
dto.setCreatedAt(comment.getCreatedAt());
|
dto.setCreatedAt(comment.getCreatedAt());
|
||||||
dto.setAuthor(toAuthorDto(comment.getAuthor()));
|
AuthorDto author = new AuthorDto();
|
||||||
|
author.setId(comment.getAuthor().getId());
|
||||||
|
author.setUsername(comment.getAuthor().getUsername());
|
||||||
|
author.setAvatar(comment.getAuthor().getAvatar());
|
||||||
|
dto.setAuthor(author);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AuthorDto toAuthorDto(com.openisle.model.User user) {
|
|
||||||
AuthorDto dto = new AuthorDto();
|
|
||||||
dto.setId(user.getId());
|
|
||||||
dto.setUsername(user.getUsername());
|
|
||||||
dto.setAvatar(user.getAvatar());
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class MarkReadRequest {
|
|
||||||
private List<Long> ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class NotificationDto {
|
|
||||||
private Long id;
|
|
||||||
private NotificationType type;
|
|
||||||
private PostDto post;
|
|
||||||
private CommentDto comment;
|
|
||||||
private CommentDto parentComment;
|
|
||||||
private AuthorDto fromUser;
|
|
||||||
private ReactionType reactionType;
|
|
||||||
private String content;
|
|
||||||
private Boolean approved;
|
|
||||||
private boolean read;
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CommentDto {
|
|
||||||
private Long id;
|
|
||||||
private String content;
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private AuthorDto author;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class AuthorDto {
|
|
||||||
private Long id;
|
|
||||||
private String username;
|
|
||||||
private String avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class UnreadCount {
|
|
||||||
private long count;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.PushPublicKeyDto;
|
||||||
|
import com.openisle.dto.PushSubscriptionRequest;
|
||||||
import com.openisle.service.PushSubscriptionService;
|
import com.openisle.service.PushSubscriptionService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@@ -16,26 +17,14 @@ public class PushSubscriptionController {
|
|||||||
private String publicKey;
|
private String publicKey;
|
||||||
|
|
||||||
@GetMapping("/public-key")
|
@GetMapping("/public-key")
|
||||||
public PublicKeyResponse getPublicKey() {
|
public PushPublicKeyDto getPublicKey() {
|
||||||
PublicKeyResponse r = new PublicKeyResponse();
|
PushPublicKeyDto r = new PushPublicKeyDto();
|
||||||
r.setKey(publicKey);
|
r.setKey(publicKey);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/subscribe")
|
@PostMapping("/subscribe")
|
||||||
public void subscribe(@RequestBody SubscriptionRequest req, Authentication auth) {
|
public void subscribe(@RequestBody PushSubscriptionRequest req, Authentication auth) {
|
||||||
pushSubscriptionService.saveSubscription(auth.getName(), req.getEndpoint(), req.getP256dh(), req.getAuth());
|
pushSubscriptionService.saveSubscription(auth.getName(), req.getEndpoint(), req.getP256dh(), req.getAuth());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PublicKeyResponse {
|
|
||||||
private String key;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class SubscriptionRequest {
|
|
||||||
private String endpoint;
|
|
||||||
private String p256dh;
|
|
||||||
private String auth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.ReactionDto;
|
||||||
|
import com.openisle.dto.ReactionRequest;
|
||||||
import com.openisle.model.Reaction;
|
import com.openisle.model.Reaction;
|
||||||
import com.openisle.model.ReactionType;
|
import com.openisle.model.ReactionType;
|
||||||
import com.openisle.service.ReactionService;
|
|
||||||
import com.openisle.service.LevelService;
|
import com.openisle.service.LevelService;
|
||||||
|
import com.openisle.service.ReactionService;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@@ -66,19 +67,4 @@ public class ReactionController {
|
|||||||
dto.setReward(0);
|
dto.setReward(0);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ReactionRequest {
|
|
||||||
private ReactionType type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ReactionDto {
|
|
||||||
private Long id;
|
|
||||||
private ReactionType type;
|
|
||||||
private String user;
|
|
||||||
private Long postId;
|
|
||||||
private Long commentId;
|
|
||||||
private int reward;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.PostSummaryDto;
|
||||||
|
import com.openisle.dto.SearchResultDto;
|
||||||
|
import com.openisle.dto.UserDto;
|
||||||
import com.openisle.model.Post;
|
import com.openisle.model.Post;
|
||||||
import com.openisle.model.Comment;
|
|
||||||
import com.openisle.model.User;
|
import com.openisle.model.User;
|
||||||
import com.openisle.service.SearchService;
|
import com.openisle.service.SearchService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -28,21 +29,21 @@ public class SearchController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/posts")
|
@GetMapping("/posts")
|
||||||
public List<PostDto> searchPosts(@RequestParam String keyword) {
|
public List<PostSummaryDto> searchPosts(@RequestParam String keyword) {
|
||||||
return searchService.searchPosts(keyword).stream()
|
return searchService.searchPosts(keyword).stream()
|
||||||
.map(this::toPostDto)
|
.map(this::toPostDto)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/posts/content")
|
@GetMapping("/posts/content")
|
||||||
public List<PostDto> searchPostsByContent(@RequestParam String keyword) {
|
public List<PostSummaryDto> searchPostsByContent(@RequestParam String keyword) {
|
||||||
return searchService.searchPostsByContent(keyword).stream()
|
return searchService.searchPostsByContent(keyword).stream()
|
||||||
.map(this::toPostDto)
|
.map(this::toPostDto)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/posts/title")
|
@GetMapping("/posts/title")
|
||||||
public List<PostDto> searchPostsByTitle(@RequestParam String keyword) {
|
public List<PostSummaryDto> searchPostsByTitle(@RequestParam String keyword) {
|
||||||
return searchService.searchPostsByTitle(keyword).stream()
|
return searchService.searchPostsByTitle(keyword).stream()
|
||||||
.map(this::toPostDto)
|
.map(this::toPostDto)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -72,33 +73,10 @@ public class SearchController {
|
|||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PostDto toPostDto(Post post) {
|
private PostSummaryDto toPostDto(Post post) {
|
||||||
PostDto dto = new PostDto();
|
PostSummaryDto dto = new PostSummaryDto();
|
||||||
dto.setId(post.getId());
|
dto.setId(post.getId());
|
||||||
dto.setTitle(post.getTitle());
|
dto.setTitle(post.getTitle());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class UserDto {
|
|
||||||
private Long id;
|
|
||||||
private String username;
|
|
||||||
private String avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class SearchResultDto {
|
|
||||||
private String type;
|
|
||||||
private Long id;
|
|
||||||
private String text;
|
|
||||||
private String subText;
|
|
||||||
private String extra;
|
|
||||||
private Long postId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
import com.openisle.model.Tag;
|
import com.openisle.dto.PostSummaryDto;
|
||||||
import com.openisle.service.TagService;
|
import com.openisle.dto.TagDto;
|
||||||
import com.openisle.service.PostService;
|
import com.openisle.dto.TagRequest;
|
||||||
import com.openisle.repository.UserRepository;
|
import com.openisle.mapper.PostMapper;
|
||||||
import com.openisle.model.PublishMode;
|
import com.openisle.model.PublishMode;
|
||||||
import com.openisle.model.Role;
|
import com.openisle.model.Role;
|
||||||
import lombok.Data;
|
import com.openisle.model.Tag;
|
||||||
|
import com.openisle.repository.UserRepository;
|
||||||
|
import com.openisle.service.PostService;
|
||||||
|
import com.openisle.service.TagService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -20,6 +23,7 @@ public class TagController {
|
|||||||
private final TagService tagService;
|
private final TagService tagService;
|
||||||
private final PostService postService;
|
private final PostService postService;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
private final PostMapper postMapper;
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public TagDto create(@RequestBody TagRequest req, org.springframework.security.core.Authentication auth) {
|
public TagDto create(@RequestBody TagRequest req, org.springframework.security.core.Authentication auth) {
|
||||||
@@ -79,12 +83,7 @@ public class TagController {
|
|||||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||||
return postService.listPostsByTags(java.util.List.of(id), page, pageSize)
|
return postService.listPostsByTags(java.util.List.of(id), page, pageSize)
|
||||||
.stream()
|
.stream()
|
||||||
.map(p -> {
|
.map(postMapper::toSummaryDto)
|
||||||
PostSummaryDto dto = new PostSummaryDto();
|
|
||||||
dto.setId(p.getId());
|
|
||||||
dto.setTitle(p.getTitle());
|
|
||||||
return dto;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,31 +94,8 @@ public class TagController {
|
|||||||
dto.setIcon(tag.getIcon());
|
dto.setIcon(tag.getIcon());
|
||||||
dto.setSmallIcon(tag.getSmallIcon());
|
dto.setSmallIcon(tag.getSmallIcon());
|
||||||
dto.setDescription(tag.getDescription());
|
dto.setDescription(tag.getDescription());
|
||||||
|
dto.setCreatedAt(tag.getCreatedAt());
|
||||||
dto.setCount(count);
|
dto.setCount(count);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class TagRequest {
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class TagDto {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
private Long count;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostSummaryDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package com.openisle.controller;
|
package com.openisle.controller;
|
||||||
|
|
||||||
|
import com.openisle.dto.CommentInfoDto;
|
||||||
|
import com.openisle.dto.ParentCommentDto;
|
||||||
|
import com.openisle.dto.PostMetaDto;
|
||||||
|
import com.openisle.dto.TagDto;
|
||||||
|
import com.openisle.dto.UpdateProfileDto;
|
||||||
|
import com.openisle.dto.UserAggregateDto;
|
||||||
|
import com.openisle.dto.UserDto;
|
||||||
import com.openisle.exception.NotFoundException;
|
import com.openisle.exception.NotFoundException;
|
||||||
import com.openisle.model.User;
|
import com.openisle.model.User;
|
||||||
import com.openisle.service.*;
|
import com.openisle.service.*;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@@ -139,13 +145,13 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{identifier}/hot-tags")
|
@GetMapping("/{identifier}/hot-tags")
|
||||||
public java.util.List<TagInfoDto> hotTags(@PathVariable("identifier") String identifier,
|
public java.util.List<TagDto> hotTags(@PathVariable("identifier") String identifier,
|
||||||
@RequestParam(value = "limit", required = false) Integer limit) {
|
@RequestParam(value = "limit", required = false) Integer limit) {
|
||||||
int l = limit != null ? limit : 10;
|
int l = limit != null ? limit : 10;
|
||||||
User user = userService.findByIdentifier(identifier).orElseThrow();
|
User user = userService.findByIdentifier(identifier).orElseThrow();
|
||||||
return tagService.getTagsByUser(user.getUsername()).stream()
|
return tagService.getTagsByUser(user.getUsername()).stream()
|
||||||
.map(t -> {
|
.map(t -> {
|
||||||
TagInfoDto dto = new TagInfoDto();
|
TagDto dto = new TagDto();
|
||||||
dto.setId(t.getId());
|
dto.setId(t.getId());
|
||||||
dto.setName(t.getName());
|
dto.setName(t.getName());
|
||||||
dto.setDescription(t.getDescription());
|
dto.setDescription(t.getDescription());
|
||||||
@@ -161,13 +167,13 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{identifier}/tags")
|
@GetMapping("/{identifier}/tags")
|
||||||
public java.util.List<TagInfoDto> userTags(@PathVariable("identifier") String identifier,
|
public java.util.List<TagDto> userTags(@PathVariable("identifier") String identifier,
|
||||||
@RequestParam(value = "limit", required = false) Integer limit) {
|
@RequestParam(value = "limit", required = false) Integer limit) {
|
||||||
int l = limit != null ? limit : defaultTagsLimit;
|
int l = limit != null ? limit : defaultTagsLimit;
|
||||||
User user = userService.findByIdentifier(identifier).orElseThrow();
|
User user = userService.findByIdentifier(identifier).orElseThrow();
|
||||||
return tagService.getRecentTagsByUser(user.getUsername(), l).stream()
|
return tagService.getRecentTagsByUser(user.getUsername(), l).stream()
|
||||||
.map(t -> {
|
.map(t -> {
|
||||||
TagInfoDto dto = new TagInfoDto();
|
TagDto dto = new TagDto();
|
||||||
dto.setId(t.getId());
|
dto.setId(t.getId());
|
||||||
dto.setName(t.getName());
|
dto.setName(t.getName());
|
||||||
dto.setDescription(t.getDescription());
|
dto.setDescription(t.getDescription());
|
||||||
@@ -294,78 +300,4 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class UserDto {
|
|
||||||
private Long id;
|
|
||||||
private String username;
|
|
||||||
private String email;
|
|
||||||
private String avatar;
|
|
||||||
private String role;
|
|
||||||
private String introduction;
|
|
||||||
private long followers;
|
|
||||||
private long following;
|
|
||||||
private java.time.LocalDateTime createdAt;
|
|
||||||
private java.time.LocalDateTime lastPostTime;
|
|
||||||
private java.time.LocalDateTime lastCommentTime;
|
|
||||||
private long totalViews;
|
|
||||||
private long visitedDays;
|
|
||||||
private long readPosts;
|
|
||||||
private long likesSent;
|
|
||||||
private long likesReceived;
|
|
||||||
private boolean subscribed;
|
|
||||||
private int experience;
|
|
||||||
private int currentLevel;
|
|
||||||
private int nextLevelExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class PostMetaDto {
|
|
||||||
private Long id;
|
|
||||||
private String title;
|
|
||||||
private String snippet;
|
|
||||||
private java.time.LocalDateTime createdAt;
|
|
||||||
private String category;
|
|
||||||
private long views;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class CommentInfoDto {
|
|
||||||
private Long id;
|
|
||||||
private String content;
|
|
||||||
private java.time.LocalDateTime createdAt;
|
|
||||||
private PostMetaDto post;
|
|
||||||
private ParentCommentDto parentComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class TagInfoDto {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String icon;
|
|
||||||
private String smallIcon;
|
|
||||||
private java.time.LocalDateTime createdAt;
|
|
||||||
private Long count;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class ParentCommentDto {
|
|
||||||
private Long id;
|
|
||||||
private String author;
|
|
||||||
private String content;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class UpdateProfileDto {
|
|
||||||
private String username;
|
|
||||||
private String introduction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
private static class UserAggregateDto {
|
|
||||||
private UserDto user;
|
|
||||||
private java.util.List<PostMetaDto> posts;
|
|
||||||
private java.util.List<CommentInfoDto> replies;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ public class CategoryDto {
|
|||||||
private String description;
|
private String description;
|
||||||
private String icon;
|
private String icon;
|
||||||
private String smallIcon;
|
private String smallIcon;
|
||||||
|
private Long count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request body for creating or updating a category. */
|
||||||
|
@Data
|
||||||
|
public class CategoryRequest {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String icon;
|
||||||
|
private String smallIcon;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/** DTO for comment information in user profiles. */
|
||||||
|
@Data
|
||||||
|
public class CommentInfoDto {
|
||||||
|
private Long id;
|
||||||
|
private String content;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private PostMetaDto post;
|
||||||
|
private ParentCommentDto parentComment;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request body for creating or replying to a comment. */
|
||||||
|
@Data
|
||||||
|
public class CommentRequest {
|
||||||
|
private String content;
|
||||||
|
private String captcha;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import com.openisle.model.PasswordStrength;
|
||||||
|
import com.openisle.model.PublishMode;
|
||||||
|
import com.openisle.model.RegisterMode;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** DTO for site configuration. */
|
||||||
|
@Data
|
||||||
|
public class ConfigDto {
|
||||||
|
private PublishMode publishMode;
|
||||||
|
private PasswordStrength passwordStrength;
|
||||||
|
private Integer aiFormatLimit;
|
||||||
|
private RegisterMode registerMode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request for Discord OAuth login. */
|
||||||
|
@Data
|
||||||
|
public class DiscordLoginRequest {
|
||||||
|
private String code;
|
||||||
|
private String redirectUri;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** DTO representing a saved draft. */
|
||||||
|
@Data
|
||||||
|
public class DraftDto {
|
||||||
|
private Long id;
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
private Long categoryId;
|
||||||
|
private List<Long> tagIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Request body for saving a draft. */
|
||||||
|
@Data
|
||||||
|
public class DraftRequest {
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
private Long categoryId;
|
||||||
|
private List<Long> tagIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to trigger a forgot password email. */
|
||||||
|
@Data
|
||||||
|
public class ForgotPasswordRequest {
|
||||||
|
private String email;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request for GitHub OAuth login. */
|
||||||
|
@Data
|
||||||
|
public class GithubLoginRequest {
|
||||||
|
private String code;
|
||||||
|
private String redirectUri;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request for Google OAuth login. */
|
||||||
|
@Data
|
||||||
|
public class GoogleLoginRequest {
|
||||||
|
private String idToken;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to login. */
|
||||||
|
@Data
|
||||||
|
public class LoginRequest {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String captcha;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to submit a reason (e.g., for moderation). */
|
||||||
|
@Data
|
||||||
|
public class MakeReasonRequest {
|
||||||
|
private String token;
|
||||||
|
private String reason;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Info about the milk tea activity. */
|
||||||
|
@Data
|
||||||
|
public class MilkTeaInfoDto {
|
||||||
|
private long redeemCount;
|
||||||
|
private boolean ended;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to redeem the milk tea activity. */
|
||||||
|
@Data
|
||||||
|
public class MilkTeaRedeemRequest {
|
||||||
|
private String contact;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import com.openisle.model.NotificationType;
|
||||||
|
import com.openisle.model.ReactionType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/** DTO representing a user notification. */
|
||||||
|
@Data
|
||||||
|
public class NotificationDto {
|
||||||
|
private Long id;
|
||||||
|
private NotificationType type;
|
||||||
|
private PostSummaryDto post;
|
||||||
|
private CommentDto comment;
|
||||||
|
private CommentDto parentComment;
|
||||||
|
private AuthorDto fromUser;
|
||||||
|
private ReactionType reactionType;
|
||||||
|
private String content;
|
||||||
|
private Boolean approved;
|
||||||
|
private boolean read;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Request to mark notifications as read. */
|
||||||
|
@Data
|
||||||
|
public class NotificationMarkReadRequest {
|
||||||
|
private List<Long> ids;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** DTO representing unread notification count. */
|
||||||
|
@Data
|
||||||
|
public class NotificationUnreadCountDto {
|
||||||
|
private long count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** DTO representing a parent comment. */
|
||||||
|
@Data
|
||||||
|
public class ParentCommentDto {
|
||||||
|
private Long id;
|
||||||
|
private String author;
|
||||||
|
private String content;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/** Lightweight post metadata used in user profile lists. */
|
||||||
|
@Data
|
||||||
|
public class PostMetaDto {
|
||||||
|
private Long id;
|
||||||
|
private String title;
|
||||||
|
private String snippet;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private String category;
|
||||||
|
private long views;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Public key response for web push. */
|
||||||
|
@Data
|
||||||
|
public class PushPublicKeyDto {
|
||||||
|
private String key;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request body for saving a push subscription. */
|
||||||
|
@Data
|
||||||
|
public class PushSubscriptionRequest {
|
||||||
|
private String endpoint;
|
||||||
|
private String p256dh;
|
||||||
|
private String auth;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import com.openisle.model.ReactionType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request for reacting to a post or comment. */
|
||||||
|
@Data
|
||||||
|
public class ReactionRequest {
|
||||||
|
private ReactionType type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to register a new user. */
|
||||||
|
@Data
|
||||||
|
public class RegisterRequest {
|
||||||
|
private String username;
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
private String captcha;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to reset password. */
|
||||||
|
@Data
|
||||||
|
public class ResetPasswordRequest {
|
||||||
|
private String token;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** DTO representing a search result entry. */
|
||||||
|
@Data
|
||||||
|
public class SearchResultDto {
|
||||||
|
private String type;
|
||||||
|
private Long id;
|
||||||
|
private String text;
|
||||||
|
private String subText;
|
||||||
|
private String extra;
|
||||||
|
private Long postId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import com.openisle.model.RegisterMode;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Public site configuration values. */
|
||||||
|
@Data
|
||||||
|
public class SiteConfigDto {
|
||||||
|
private boolean captchaEnabled;
|
||||||
|
private boolean registerCaptchaEnabled;
|
||||||
|
private boolean loginCaptchaEnabled;
|
||||||
|
private boolean postCaptchaEnabled;
|
||||||
|
private boolean commentCaptchaEnabled;
|
||||||
|
private int aiFormatLimit;
|
||||||
|
private RegisterMode registerMode;
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.openisle.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTO representing a tag.
|
* DTO representing a tag.
|
||||||
*/
|
*/
|
||||||
@@ -12,5 +14,7 @@ public class TagDto {
|
|||||||
private String description;
|
private String description;
|
||||||
private String icon;
|
private String icon;
|
||||||
private String smallIcon;
|
private String smallIcon;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private Long count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request body for creating or updating a tag. */
|
||||||
|
@Data
|
||||||
|
public class TagRequest {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String icon;
|
||||||
|
private String smallIcon;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request for Twitter OAuth login. */
|
||||||
|
@Data
|
||||||
|
public class TwitterLoginRequest {
|
||||||
|
private String code;
|
||||||
|
private String redirectUri;
|
||||||
|
private String codeVerifier;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request body for updating user profile. */
|
||||||
|
@Data
|
||||||
|
public class UpdateProfileDto {
|
||||||
|
private String username;
|
||||||
|
private String introduction;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Aggregated user data including posts and replies. */
|
||||||
|
@Data
|
||||||
|
public class UserAggregateDto {
|
||||||
|
private UserDto user;
|
||||||
|
private List<PostMetaDto> posts;
|
||||||
|
private List<CommentInfoDto> replies;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/** Detailed user information. */
|
||||||
|
@Data
|
||||||
|
public class UserDto {
|
||||||
|
private Long id;
|
||||||
|
private String username;
|
||||||
|
private String email;
|
||||||
|
private String avatar;
|
||||||
|
private String role;
|
||||||
|
private String introduction;
|
||||||
|
private long followers;
|
||||||
|
private long following;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private LocalDateTime lastPostTime;
|
||||||
|
private LocalDateTime lastCommentTime;
|
||||||
|
private long totalViews;
|
||||||
|
private long visitedDays;
|
||||||
|
private long readPosts;
|
||||||
|
private long likesSent;
|
||||||
|
private long likesReceived;
|
||||||
|
private boolean subscribed;
|
||||||
|
private int experience;
|
||||||
|
private int currentLevel;
|
||||||
|
private int nextLevelExp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to verify a forgot password code. */
|
||||||
|
@Data
|
||||||
|
public class VerifyForgotRequest {
|
||||||
|
private String email;
|
||||||
|
private String code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.openisle.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** Request to verify a user registration. */
|
||||||
|
@Data
|
||||||
|
public class VerifyRequest {
|
||||||
|
private String username;
|
||||||
|
private String code;
|
||||||
|
}
|
||||||
@@ -126,6 +126,7 @@ public class PostMapper {
|
|||||||
dto.setDescription(tag.getDescription());
|
dto.setDescription(tag.getDescription());
|
||||||
dto.setIcon(tag.getIcon());
|
dto.setIcon(tag.getIcon());
|
||||||
dto.setSmallIcon(tag.getSmallIcon());
|
dto.setSmallIcon(tag.getSmallIcon());
|
||||||
|
dto.setCreatedAt(tag.getCreatedAt());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user