Skip to content

Commit

Permalink
Merge pull request #65 from F3B4-KDT-Project/refactor#64-refactoring-…
Browse files Browse the repository at this point in the history
…read-post

refactor: 게시글 조회 시 title 반환되도록 수정
  • Loading branch information
Kyuwon-Choi authored Feb 19, 2025
2 parents 9b15ef4 + c19dccd commit c208e91
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/kdt/web_ide/post/controller/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ResponseEntity<PostResponseDto> createPost(
return ResponseEntity.status(HttpStatus.CREATED).body(response);
}

@GetMapping("/{id}")
@GetMapping("/post/{id}")
@Operation(summary = "게시글 조회", description = "특정 ID의 게시글을 조회합니다.")
public ResponseEntity<PostResponseDto> getPost(
@PathVariable Long id, @AuthenticationPrincipal CustomUserDetails userDetails) {
Expand Down Expand Up @@ -127,7 +127,7 @@ public String runPostContent(@PathVariable Long id, String input)
return postService.executeFile(id, input);
}

@GetMapping("/{boardId}")
@GetMapping("/board/{boardId}")
@Operation(summary = "특정 게시판의 게시글 조회", description = "특정 게시판에 속한 모든 게시글을 조회합니다.")
public ResponseEntity<List<PostResponseDto>> getPostsByBoardId(
@PathVariable Long boardId, @AuthenticationPrincipal CustomUserDetails userDetails) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/kdt/web_ide/post/dto/PostResponseDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class PostResponseDto {
private Integer id;
private Integer boardId;
private String boardTitle;
private String name;
private Language language;
private String filePath;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/kdt/web_ide/post/service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private String getFileExtension(String language) {
private PostResponseDto mapToResponseDto(Post post, Integer roomId) {
return PostResponseDto.builder()
.id(post.getId())
.boardTitle(post.getBoard().getTitle())
.boardId(post.getBoard().getId().intValue())
.name(post.getName())
.language(post.getLanguage())
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ oauth:
url:
auth: https://kauth.kakao.com
api: https://kapi.kakao.com


0 comments on commit c208e91

Please sign in to comment.