Skip to content

Commit

Permalink
feat: 뱃지 목록 조회 기능 구현(#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
acceptor-gyu committed Jun 14, 2023
1 parent 4cc0836 commit 68006f0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions be/src/main/java/com/secondhand/post/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,15 @@ public ResponseEntity<CustomResponse> changePostStatus(@PathVariable Long postId
"판매 상품 상태 변경 성공"));
}

@GetMapping("/badges")
public ResponseEntity<CustomResponse<BadgesDto>> findBadges() {

return ResponseEntity
.ok()
.body(new CustomResponse(
"success",
200,
"판매 상품 상태 변경 성공",
postService.findBadges()));
}
}
5 changes: 5 additions & 0 deletions be/src/main/java/com/secondhand/post/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
14 changes: 14 additions & 0 deletions be/src/main/java/com/secondhand/post/dto/BadgesDto.java
Original file line number Diff line number Diff line change
@@ -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<Badge> badges;
}

0 comments on commit 68006f0

Please sign in to comment.