From 773b8bcae9d2ebe3aaeff84583c93ac008482362 Mon Sep 17 00:00:00 2001 From: wlsh44 Date: Thu, 27 Feb 2025 17:14:34 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=82=B4=EA=B0=80=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1/=ED=88=AC=ED=91=9C=ED=95=9C=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=20=EC=A1=B0=ED=9A=8C=20uri=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../post/presentation/PostController.java | 28 ++----------------- .../post/presentation/PostControllerTest.java | 4 +-- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/swyp8team2/post/presentation/PostController.java b/src/main/java/com/swyp8team2/post/presentation/PostController.java index ac5e33d9..8ed8b674 100644 --- a/src/main/java/com/swyp8team2/post/presentation/PostController.java +++ b/src/main/java/com/swyp8team2/post/presentation/PostController.java @@ -3,12 +3,10 @@ import com.swyp8team2.auth.domain.UserInfo; import com.swyp8team2.common.dto.CursorBasePaginatedResponse; import com.swyp8team2.post.application.PostService; -import com.swyp8team2.post.presentation.dto.AuthorDto; import com.swyp8team2.post.presentation.dto.CreatePostRequest; import com.swyp8team2.post.presentation.dto.PostImageVoteStatusResponse; import com.swyp8team2.post.presentation.dto.PostResponse; import com.swyp8team2.post.presentation.dto.SimplePostResponse; -import com.swyp8team2.post.presentation.dto.PostImageResponse; import jakarta.validation.Valid; import jakarta.validation.constraints.Min; import lombok.RequiredArgsConstructor; @@ -16,7 +14,6 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -24,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -62,26 +58,6 @@ public ResponseEntity> findVoteStatus( return ResponseEntity.ok(postService.findPostStatus(postId)); } -// @GetMapping("/{shareUrl}") - public ResponseEntity findPost(@PathVariable("shareUrl") String shareUrl) { - return ResponseEntity.ok(new PostResponse( - 1L, - new AuthorDto( - 1L, - "author", - "https://image.photopic.site/profile-image" - ), - "description", - List.of( - new PostImageResponse(1L, "뽀또A", "https://image.photopic.site/image/1", "https://image.photopic.site/image/resize/1", true), - new PostImageResponse(2L, "뽀또B", "https://image.photopic.site/image/2", "https://image.photopic.site/image/resize/1", false) - ), - "https://photopic.site/shareurl", - true, - LocalDateTime.of(2025, 2, 13, 12, 0) - )); - } - @PostMapping("/{postId}/close") public ResponseEntity closePost( @PathVariable("postId") Long postId, @@ -100,7 +76,7 @@ public ResponseEntity deletePost( return ResponseEntity.ok().build(); } - @GetMapping("/me") + @GetMapping("/user") public ResponseEntity> findMyPosts( @RequestParam(name = "cursor", required = false) @Min(0) Long cursor, @RequestParam(name = "size", required = false, defaultValue = "10") @Min(1) int size, @@ -109,7 +85,7 @@ public ResponseEntity> findMyPos return ResponseEntity.ok(postService.findMyPosts(userInfo.userId(), cursor, size)); } - @GetMapping("/voted") + @GetMapping("/user/voted") public ResponseEntity> findVotedPosts( @RequestParam(name = "cursor", required = false) @Min(0) Long cursor, @RequestParam(name = "size", required = false, defaultValue = "10") @Min(1) int size, diff --git a/src/test/java/com/swyp8team2/post/presentation/PostControllerTest.java b/src/test/java/com/swyp8team2/post/presentation/PostControllerTest.java index 1ca9d1cc..6823b72a 100644 --- a/src/test/java/com/swyp8team2/post/presentation/PostControllerTest.java +++ b/src/test/java/com/swyp8team2/post/presentation/PostControllerTest.java @@ -196,7 +196,7 @@ void findMyPost() throws Exception { .willReturn(response); //when then - mockMvc.perform(get("/posts/me") + mockMvc.perform(get("/posts/user") .header(HttpHeaders.AUTHORIZATION, "Bearer token")) .andExpect(status().isOk()) .andExpect(content().json(objectMapper.writeValueAsString(response))) @@ -251,7 +251,7 @@ void findVotedPost() throws Exception { .willReturn(response); //when then - mockMvc.perform(get("/posts/voted") + mockMvc.perform(get("/posts/user/voted") .header(HttpHeaders.AUTHORIZATION, "Bearer token")) .andExpect(status().isOk()) .andExpect(content().json(objectMapper.writeValueAsString(response))) From d5f8c3dfeb76e160c999b64d9e82c609caa008af Mon Sep 17 00:00:00 2001 From: wlsh44 Date: Thu, 27 Feb 2025 17:15:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=A1=9C=EC=BB=AC=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/swyp8team2/common/dev/DataInitializer.java | 3 ++- src/main/resources/application.yml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/swyp8team2/common/dev/DataInitializer.java b/src/main/java/com/swyp8team2/common/dev/DataInitializer.java index 5b5cff33..c490ac30 100644 --- a/src/main/java/com/swyp8team2/common/dev/DataInitializer.java +++ b/src/main/java/com/swyp8team2/common/dev/DataInitializer.java @@ -44,7 +44,8 @@ public void init() { List users = new ArrayList<>(); List posts = new ArrayList<>(); for (int i = 0; i < 10; i++) { - User user = userRepository.save(User.create(adjectives.get(i).getAdjective(), "https://t1.kakaocdn.net/account_images/default_profile.jpeg")); + String userName = adjectives.size() < 10 ? "user" + i : adjectives.get(i).getAdjective(); + User user = userRepository.save(User.create(userName, "https://t1.kakaocdn.net/account_images/default_profile.jpeg")); users.add(user); for (int j = 0; j < 30; j += 2) { ImageFile imageFile1 = imageFileRepository.save(ImageFile.create(new ImageFileDto("202502240006030.png", "https://image.photopic.site/images-dev/202502240006030.png", "https://image.photopic.site/images-dev/resized_202502240006030.png"))); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 916e6a83..d75d118c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,8 @@ server: port: 8080 +spring: + profiles: + active: local ---