From 8372a6f50b4f2d3121591e256eaa983ba670d0d2 Mon Sep 17 00:00:00 2001 From: wlsh44 Date: Sun, 2 Mar 2025 16:35:21 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EA=B3=B5=EB=B0=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/swyp8team2/common/dev/DataInitializer.java | 2 +- .../swyp8team2/post/application/PostImageNameGenerator.java | 2 +- src/main/java/com/swyp8team2/post/domain/Post.java | 2 +- .../post/application/PostImageNameGeneratorTest.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/swyp8team2/common/dev/DataInitializer.java b/src/main/java/com/swyp8team2/common/dev/DataInitializer.java index a99ff0f1..2328c4ef 100644 --- a/src/main/java/com/swyp8team2/common/dev/DataInitializer.java +++ b/src/main/java/com/swyp8team2/common/dev/DataInitializer.java @@ -83,7 +83,7 @@ public void init() { 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"))); ImageFile imageFile2 = 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"))); - Post post = postRepository.save(Post.create(user.getId(), "description" + j, List.of(PostImage.create("뽀또 A", imageFile1.getId()), PostImage.create("뽀또 B", imageFile2.getId())))); + Post post = postRepository.save(Post.create(user.getId(), "description" + j, List.of(PostImage.create("뽀또A", imageFile1.getId()), PostImage.create("뽀또B", imageFile2.getId())))); post.setShareUrl(shaereUrlCryptoService.encrypt(String.valueOf(post.getId()))); posts.add(post); } diff --git a/src/main/java/com/swyp8team2/post/application/PostImageNameGenerator.java b/src/main/java/com/swyp8team2/post/application/PostImageNameGenerator.java index b764e035..ab1edd99 100644 --- a/src/main/java/com/swyp8team2/post/application/PostImageNameGenerator.java +++ b/src/main/java/com/swyp8team2/post/application/PostImageNameGenerator.java @@ -16,6 +16,6 @@ public String generate() { if (index >= alphabets.length) { throw new InternalServerException(ErrorCode.POST_IMAGE_NAME_GENERATOR_INDEX_OUT_OF_BOUND); } - return "뽀또 " + alphabets[index++]; + return "뽀또" + alphabets[index++]; } } diff --git a/src/main/java/com/swyp8team2/post/domain/Post.java b/src/main/java/com/swyp8team2/post/domain/Post.java index 6105b2b9..6d6597e9 100644 --- a/src/main/java/com/swyp8team2/post/domain/Post.java +++ b/src/main/java/com/swyp8team2/post/domain/Post.java @@ -57,7 +57,7 @@ public Post(Long id, Long userId, String description, Status status, List images) { - if (images.size() < 2) { + if (images.size() < 2 && images.size() > 9) { throw new BadRequestException(ErrorCode.INVALID_POST_IMAGE_COUNT); } } diff --git a/src/test/java/com/swyp8team2/post/application/PostImageNameGeneratorTest.java b/src/test/java/com/swyp8team2/post/application/PostImageNameGeneratorTest.java index 8f763b94..626bb21f 100644 --- a/src/test/java/com/swyp8team2/post/application/PostImageNameGeneratorTest.java +++ b/src/test/java/com/swyp8team2/post/application/PostImageNameGeneratorTest.java @@ -26,7 +26,7 @@ void generate() throws Exception { String generate2 = postImageNameGenerator.generate(); //then - assertThat(generate1).isEqualTo("뽀또 A"); - assertThat(generate2).isEqualTo("뽀또 B"); + assertThat(generate1).isEqualTo("뽀또A"); + assertThat(generate2).isEqualTo("뽀또B"); } } From 5a9569f843145413395c48674685456172ce994c Mon Sep 17 00:00:00 2001 From: wlsh44 Date: Sun, 2 Mar 2025 16:40:17 +0900 Subject: [PATCH 2/3] =?UTF-8?q?docs:=20api=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/docs/asciidoc/posts.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/docs/asciidoc/posts.adoc b/src/docs/asciidoc/posts.adoc index 54301e7e..7087793d 100644 --- a/src/docs/asciidoc/posts.adoc +++ b/src/docs/asciidoc/posts.adoc @@ -24,13 +24,13 @@ operation::post-controller-test/find-post_share-url[snippets='http-request,curl- operation::post-controller-test/find-vote-status[snippets='http-request,curl-request,request-headers,path-parameters,http-response,response-fields'] -[[내가-작성한-게시글-조회]] -=== `GET` 내가 작성한 게시글 조회 +[[유저가-작성한-게시글-조회]] +=== `GET` 유저가 작성한 게시글 조회 operation::post-controller-test/find-my-post[snippets='http-request,curl-request,query-parameters,request-headers,http-response,response-fields'] -[[내가-참여한-게시글-조회]] -=== `GET` 내가 참여한 게시글 조회 +[[유저가-참여한-게시글-조회]] +=== `GET` 유저가 참여한 게시글 조회 operation::post-controller-test/find-voted-post[snippets='http-request,curl-request,query-parameters,request-headers,http-response,response-fields'] From 3e7b8298830e2515cf99a7a433ee47e70832d19f Mon Sep 17 00:00:00 2001 From: wlsh44 Date: Sun, 2 Mar 2025 16:42:32 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=BA=A0=EC=A7=80=EB=8A=94=20=EB=B6=80=EB=B6=84=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/post/domain/Post.java | 2 +- .../java/com/swyp8team2/post/application/PostServiceTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/swyp8team2/post/domain/Post.java b/src/main/java/com/swyp8team2/post/domain/Post.java index 6d6597e9..79ff5700 100644 --- a/src/main/java/com/swyp8team2/post/domain/Post.java +++ b/src/main/java/com/swyp8team2/post/domain/Post.java @@ -57,7 +57,7 @@ public Post(Long id, Long userId, String description, Status status, List images) { - if (images.size() < 2 && images.size() > 9) { + if (images.size() < 2 || images.size() > 9) { throw new BadRequestException(ErrorCode.INVALID_POST_IMAGE_COUNT); } } diff --git a/src/test/java/com/swyp8team2/post/application/PostServiceTest.java b/src/test/java/com/swyp8team2/post/application/PostServiceTest.java index af97d0a1..b85b73ee 100644 --- a/src/test/java/com/swyp8team2/post/application/PostServiceTest.java +++ b/src/test/java/com/swyp8team2/post/application/PostServiceTest.java @@ -87,10 +87,10 @@ void create() throws Exception { () -> assertThat(post.getShareUrl()).isEqualTo(shareUrl), () -> assertThat(images).hasSize(2), () -> assertThat(images.get(0).getImageFileId()).isEqualTo(1L), - () -> assertThat(images.get(0).getName()).isEqualTo("뽀또 A"), + () -> assertThat(images.get(0).getName()).isEqualTo("뽀또A"), () -> assertThat(images.get(0).getVoteCount()).isEqualTo(0), () -> assertThat(images.get(1).getImageFileId()).isEqualTo(2L), - () -> assertThat(images.get(1).getName()).isEqualTo("뽀또 B"), + () -> assertThat(images.get(1).getName()).isEqualTo("뽀또B"), () -> assertThat(images.get(1).getVoteCount()).isEqualTo(0) ); }