Skip to content

Commit c19dccd

Browse files
committed
refactor: 게시글 조회 시 title 반환되도록 수정
1 parent 9b15ef4 commit c19dccd

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/main/java/kdt/web_ide/post/controller/PostController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ResponseEntity<PostResponseDto> createPost(
4141
return ResponseEntity.status(HttpStatus.CREATED).body(response);
4242
}
4343

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

130-
@GetMapping("/{boardId}")
130+
@GetMapping("/board/{boardId}")
131131
@Operation(summary = "특정 게시판의 게시글 조회", description = "특정 게시판에 속한 모든 게시글을 조회합니다.")
132132
public ResponseEntity<List<PostResponseDto>> getPostsByBoardId(
133133
@PathVariable Long boardId, @AuthenticationPrincipal CustomUserDetails userDetails) {

src/main/java/kdt/web_ide/post/dto/PostResponseDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
public class PostResponseDto {
1212
private Integer id;
1313
private Integer boardId;
14+
private String boardTitle;
1415
private String name;
1516
private Language language;
1617
private String filePath;

src/main/java/kdt/web_ide/post/service/PostService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ private String getFileExtension(String language) {
150150
private PostResponseDto mapToResponseDto(Post post, Integer roomId) {
151151
return PostResponseDto.builder()
152152
.id(post.getId())
153+
.boardTitle(post.getBoard().getTitle())
153154
.boardId(post.getBoard().getId().intValue())
154155
.name(post.getName())
155156
.language(post.getLanguage())

src/main/resources/application.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ oauth:
2828
url:
2929
auth: https://kauth.kakao.com
3030
api: https://kapi.kakao.com
31-
32-

0 commit comments

Comments
 (0)