From 68006f0ddc174e9955358671ef0f0fb2bdc581ec Mon Sep 17 00:00:00 2001 From: acceptor-gyu Date: Wed, 14 Jun 2023 11:57:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B1=83=EC=A7=80=20=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?(#72)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/secondhand/post/PostController.java | 11 +++++++++++ .../main/java/com/secondhand/post/PostService.java | 5 +++++ .../java/com/secondhand/post/dto/BadgesDto.java | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 be/src/main/java/com/secondhand/post/dto/BadgesDto.java diff --git a/be/src/main/java/com/secondhand/post/PostController.java b/be/src/main/java/com/secondhand/post/PostController.java index 8a0ad7d6f..a6e88e2f9 100644 --- a/be/src/main/java/com/secondhand/post/PostController.java +++ b/be/src/main/java/com/secondhand/post/PostController.java @@ -130,4 +130,15 @@ public ResponseEntity changePostStatus(@PathVariable Long postId "판매 상품 상태 변경 성공")); } + @GetMapping("/badges") + public ResponseEntity> findBadges() { + + return ResponseEntity + .ok() + .body(new CustomResponse( + "success", + 200, + "판매 상품 상태 변경 성공", + postService.findBadges())); + } } diff --git a/be/src/main/java/com/secondhand/post/PostService.java b/be/src/main/java/com/secondhand/post/PostService.java index d7ff20ca6..0ab5e4b90 100644 --- a/be/src/main/java/com/secondhand/post/PostService.java +++ b/be/src/main/java/com/secondhand/post/PostService.java @@ -108,6 +108,11 @@ public void updateBadge(long postId, UpdatePostStateDto postStateDto, LoggedInUs postMeta.updateBadge(badge); } + public BadgesDto findBadges() { + + return new BadgesDto(badgeRepository.findAll()); + } + private void savePostDetail(PostSaveDto postSaveDto, long createdPostId) { PostDetail postDetail = new PostDetail(createdPostId, postSaveDto.getContent()); diff --git a/be/src/main/java/com/secondhand/post/dto/BadgesDto.java b/be/src/main/java/com/secondhand/post/dto/BadgesDto.java new file mode 100644 index 000000000..0453aa6e8 --- /dev/null +++ b/be/src/main/java/com/secondhand/post/dto/BadgesDto.java @@ -0,0 +1,14 @@ +package com.secondhand.post.dto; + +import com.secondhand.post.entity.Badge; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.List; + +@Getter +@AllArgsConstructor +public class BadgesDto { + + private List badges; +}