-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from DEPthes/develop
V.2.0.0 Deploy
- Loading branch information
Showing
44 changed files
with
985 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/mvp/deplog/domain/auth/dto/JoinReq.java → ...plog/domain/auth/dto/request/JoinReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../mvp/deplog/domain/auth/dto/LoginReq.java → ...log/domain/auth/dto/request/LoginReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/mvp/deplog/domain/auth/dto/response/EmailDuplicateCheckRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package mvp.deplog.domain.auth.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class EmailDuplicateCheckRes { | ||
|
||
@Schema(type = "boolean", example = "true", description= "닉네임 **사용 가능 여부**입니다. 값이 true면 중복 x, 사용 가능합니다.") | ||
private boolean availability; | ||
} |
2 changes: 1 addition & 1 deletion
2
.../mvp/deplog/domain/auth/dto/LoginRes.java → ...og/domain/auth/dto/response/LoginRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
src/main/java/mvp/deplog/domain/comment/application/CommentService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package mvp.deplog.domain.comment.application; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import mvp.deplog.domain.comment.domain.Comment; | ||
import mvp.deplog.domain.comment.domain.repository.CommentRepository; | ||
import mvp.deplog.domain.comment.dto.request.CommentReq; | ||
import mvp.deplog.domain.comment.dto.response.CommentRes; | ||
import mvp.deplog.domain.post.domain.Post; | ||
import mvp.deplog.domain.post.domain.repository.PostRepository; | ||
import mvp.deplog.global.common.Message; | ||
import mvp.deplog.global.common.SuccessResponse; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
@Service | ||
public class CommentService { | ||
|
||
private final CommentRepository commentRepository; | ||
private final PostRepository postRepository; | ||
|
||
@Transactional | ||
public SuccessResponse<Message> createComment(CommentReq commentReq) { | ||
Long postId = commentReq.getPostId(); | ||
Post post = postRepository.findById(postId) | ||
.orElseThrow(() -> new IllegalArgumentException("해당 아이디의 게시글을 찾을 수 없습니다: " + postId)); | ||
|
||
Comment comment; | ||
if(commentReq.getParentCommentId() == null){ | ||
comment = Comment.commentBuilder() | ||
.post(post) | ||
.content(commentReq.getContent()) | ||
.nickname(commentReq.getNickname()) | ||
.build(); | ||
} | ||
else{ | ||
Long parentCommentId = commentReq.getParentCommentId(); | ||
Comment parentComment = commentRepository.findById(parentCommentId) | ||
.orElseThrow(() -> new IllegalArgumentException("해당 아이디의 부모 댓글을 찾을 수 없습니다: " + parentCommentId)); | ||
comment = Comment.replyBuilder() | ||
.post(post) | ||
.parentComment(parentComment) | ||
.content(commentReq.getContent()) | ||
.nickname(commentReq.getNickname()) | ||
.build(); | ||
} | ||
|
||
// 댓글 저장 | ||
Comment saveComment = commentRepository.save(comment); | ||
|
||
Message message = Message.builder() | ||
.message("댓글 작성이 완료되었습니다.") | ||
.build(); | ||
|
||
return SuccessResponse.of(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/mvp/deplog/domain/comment/domain/repository/CommentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package mvp.deplog.domain.comment.domain.repository; | ||
|
||
import mvp.deplog.domain.comment.domain.Comment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface CommentRepository extends JpaRepository<Comment, Long> { | ||
} |
Oops, something went wrong.