-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27 feat: Comment 삭제 API 구현, status를 INACTIVE로 수정
- Loading branch information
Showing
9 changed files
with
137 additions
and
1 deletion.
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
15 changes: 15 additions & 0 deletions
15
server/src/main/java/com/yogit/server/board/dto/request/comment/DeleteCommentReq.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,15 @@ | ||
package com.yogit.server.board.dto.request.comment; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import io.swagger.annotations.ApiParam; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class DeleteCommentReq { | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "유저 ID", required = true) | ||
private Long userId; | ||
} |
50 changes: 50 additions & 0 deletions
50
server/src/main/java/com/yogit/server/board/dto/response/comment/DeleteCommentRes.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,50 @@ | ||
package com.yogit.server.board.dto.response.comment; | ||
|
||
import com.yogit.server.board.entity.Comment; | ||
import com.yogit.server.config.domain.BaseStatus; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import io.swagger.annotations.ApiParam; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class DeleteCommentRes { | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "코멘트 ID") | ||
private Long commentId; | ||
|
||
@ApiModelProperty(example = "ACTIVE") | ||
@ApiParam(value = "객체 상태") | ||
private BaseStatus status; | ||
|
||
@ApiModelProperty(example = "2022-07-13 16:29:30") | ||
@ApiParam(value = "생성 시각") | ||
private String createdAt; | ||
|
||
@ApiModelProperty(example = "2022-07-13 16:29:30") | ||
@ApiParam(value = "마지막 업데이트 시각") | ||
private String updatedAt; | ||
|
||
/* | ||
연관관계 편의 메서드 | ||
*/ | ||
public static DeleteCommentRes toDto(Comment comment){ | ||
return DeleteCommentRes.builder() | ||
.commentId(comment.getId()) | ||
.status(comment.getStatus()) | ||
.createdAt(comment.getCreatedAt()) | ||
.updatedAt(comment.getUpdatedAt()) | ||
.build(); | ||
} | ||
|
||
@Builder | ||
public DeleteCommentRes(Long commentId, BaseStatus status, String createdAt, String updatedAt) { | ||
this.commentId = commentId; | ||
this.status = status; | ||
this.createdAt = createdAt; | ||
this.updatedAt = updatedAt; | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
server/src/main/java/com/yogit/server/board/exception/comment/NotHostOfCommentException.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,9 @@ | ||
package com.yogit.server.board.exception.comment; | ||
|
||
|
||
public class NotHostOfCommentException extends CommentException{ | ||
public NotHostOfCommentException(){ | ||
super(CommentExceptionList.NOT_FOUND_COMMENT.getCODE(), CommentExceptionList.NOT_FOUND_COMMENT.getHTTPSTATUS(), CommentExceptionList.NOT_FOUND_COMMENT.getMESSAGE()); | ||
} | ||
|
||
} |
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