Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 회원 브랜드 조회 API #23

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,22 @@ public BaseResponse<GetMemberResponse> show(Principal principal) {
}

@PreAuthorize("hasRole('MEMBER') or hasRole('ADMIN')")
@GetMapping("/{member-id}/brands")
@GetMapping("/brands")
@Operation(summary = "정렬 조건에 따른 브랜드 조회", description =
"""
path variable 으로 member-id 를 보내면 해당 회원이 가지고 있는 쿠폰 브랜드 리스트를 반환합니다.
해당 회원이 가지고 있는 쿠폰 브랜드 리스트를 반환합니다.
정렬 조건은 query string 으로 sort 값을 보내주세요. {1, 2, 3} 에 따라 달라집니다.
- [ROLE_MEMBER OR ROLE_ADMIN]
- Access token 을 반드시 포함해서 보내주세요!
- 1(default)번 옵션은 쿠폰 많은 순, 생성 시간이 이른 순
- 2번 옵션은 생성 시간이 이른 순, 쿠폰 많은 순
- 3번 옵션은 브랜드 이름 순으로 정렬하여 데이터를 반환합니다.
""",
security = @SecurityRequirement(name = "bearerAuth"))
public BaseResponse<GetMemberCouponBrandsResponse> getBrands(
@PathVariable("member-id") Long memberId,
Principal principal,
@RequestParam(required = false, defaultValue = "1", value = "sort") String sort) {
Long memberId = memberService.findMemberIdByPrincipal(principal);
return new BaseResponse<>(memberService.getBrands(memberId, Integer.parseInt(sort)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

@ActiveProfiles("dev")
@RunWith(SpringRunner.class)
//@SpringBootTest
@SpringBootTest
@Transactional
public class MemberServiceTest {
@Autowired
Expand Down