-
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.
[force-merge] Merge pull request #21 from LikelionUniv/feature/community
Feature/community -> main (for mypage FE work)
- Loading branch information
Showing
121 changed files
with
1,979 additions
and
1,172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,6 @@ out/ | |
### env file ### | ||
.env.dev | ||
.env.* | ||
|
||
### .DS_Store ignore ### | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ spring: | |
spring: | ||
config: | ||
activate: | ||
on-profile: prod | ||
on-profile: prod |
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
74 changes: 0 additions & 74 deletions
74
likelion-client/src/main/java/likelion/univ/comment/controller/CommentApiController.java
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
likelion-client/src/main/java/likelion/univ/comment/controller/CommentController.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,71 @@ | ||
package likelion.univ.comment.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import likelion.univ.comment.dto.CommentCreateChildRequestDto; | ||
import likelion.univ.comment.dto.CommentCreateParentRequestDto; | ||
import likelion.univ.comment.dto.CommentUpdateRequestDto; | ||
import likelion.univ.comment.repository.CommentReadRepository; | ||
import likelion.univ.comment.usecase.*; | ||
import likelion.univ.domain.comment.dto.CommentDetailResponseDto; | ||
import likelion.univ.response.SuccessResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/v1/community/comments") | ||
@Tag(name = "댓글", description = "댓글 API") | ||
public class CommentController { | ||
private final CreateParentCommentUseCase createParentCommentUseCase; | ||
private final CreateChildCommentUseCase createChildCommentUseCase; | ||
private final UpdateCommentUseCase updateCommentUseCase; | ||
private final SoftDeleteCommentUseCase softDeleteCommentUseCase; | ||
private final HardDeleteCommentUseCase hardDeleteCommentUseCase; | ||
private final CommentReadRepository commentReadRepository; | ||
|
||
/* read */ | ||
@Operation(summary = "댓글 조회", description = "게시글에 대한 댓글을 최신순으로 조회합니다.") | ||
@GetMapping("/of/{postId}") | ||
public SuccessResponse<?> getComments(@PathVariable Long postId) { | ||
List<CommentDetailResponseDto> response = commentReadRepository.findAll(postId); | ||
return SuccessResponse.of(response); | ||
} | ||
|
||
|
||
/* command */ | ||
@Operation(summary = "댓글 작성", description = "부모 댓글을 생성합니다.") | ||
@PostMapping("/parent") | ||
public SuccessResponse<?> createParentComment(@RequestBody CommentCreateParentRequestDto request) { | ||
return createParentCommentUseCase.execute(request); | ||
} | ||
|
||
@Operation(summary = "대댓글 작성", description = "자식 댓글을 생성합니다.") | ||
@PostMapping("/child") | ||
public SuccessResponse<?> createChildComment(@RequestBody CommentCreateChildRequestDto request) { | ||
return createChildCommentUseCase.execute(request); | ||
} | ||
|
||
@Operation(summary = "댓글 내용 수정", description = "댓글의 내용(body only)을 수정합니다.") | ||
@PatchMapping("/{commentId}") | ||
public SuccessResponse<?> updateComment(@PathVariable Long commentId, @RequestBody CommentUpdateRequestDto request) { | ||
return updateCommentUseCase.execute(commentId, request); | ||
} | ||
|
||
@Operation(summary = "댓글 삭제", description = "댓글을 soft delete 합니다.") | ||
@PatchMapping("/disable/{commentId}") | ||
public SuccessResponse<?> deleteCommentSoft(@PathVariable Long commentId) { | ||
return softDeleteCommentUseCase.execute(commentId);// soft delete | ||
} | ||
|
||
@Operation(summary = "댓글 완전 삭제", description = "댓글을 hard delete 합니다.") | ||
@DeleteMapping("/{commentId}") | ||
public SuccessResponse<?> deleteCommentHard(@PathVariable Long commentId) { | ||
return hardDeleteCommentUseCase.execute(commentId); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
likelion-client/src/main/java/likelion/univ/comment/dto/CommentCreateChildRequestDto.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,24 @@ | ||
package likelion.univ.comment.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
public class CommentCreateChildRequestDto { | ||
@NotNull | ||
@Schema(description = "게시글 id") | ||
private Long postId; | ||
@NotNull | ||
@Schema(description = "대댓글을 다는 댓글 id") | ||
private Long parentCommentId; | ||
@NotBlank | ||
@Schema(description = "대댓글 내용", example = "대댓글 내용입니다.") | ||
private String body; | ||
} |
21 changes: 21 additions & 0 deletions
21
likelion-client/src/main/java/likelion/univ/comment/dto/CommentCreateParentRequestDto.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,21 @@ | ||
package likelion.univ.comment.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
public class CommentCreateParentRequestDto { | ||
@NotNull | ||
@Schema(description = "댓글을 다는 게시글 id") | ||
private Long postId; | ||
@NotBlank | ||
@Schema(description = "댓글 내용", example = "댓글 내용입니다.") | ||
private String body; | ||
} |
Oops, something went wrong.