Skip to content

Commit

Permalink
v1.0.3 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook02 authored Feb 26, 2024
2 parents 54f17b9 + f804c5f commit c49a5e4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ public ResponseEntity<MemberGrantResponse> grantMember(@Valid @RequestBody Membe

@Operation(summary = "승인 가능 회원 전체 조회", description = "승인 가능한 회원 전체를 조회합니다.")
@GetMapping("/grantable")
public ResponseEntity<Page<MemberFindAllResponse>> getGrantableMembers(Pageable pageable) {
Page<MemberFindAllResponse> response = adminMemberService.getGrantableMembers(pageable);
public ResponseEntity<Page<MemberFindAllResponse>> getGrantableMembers(
MemberQueryRequest queryRequest, Pageable pageable) {
Page<MemberFindAllResponse> response = adminMemberService.getGrantableMembers(queryRequest, pageable);
return ResponseEntity.ok().body(response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public MemberGrantResponse grantMember(MemberGrantRequest request) {
return MemberGrantResponse.from(classifiedMember);
}

public Page<MemberFindAllResponse> getGrantableMembers(Pageable pageable) {
Page<Member> members = memberRepository.findAllGrantable(pageable);
public Page<MemberFindAllResponse> getGrantableMembers(MemberQueryRequest queryRequest, Pageable pageable) {
Page<Member> members = memberRepository.findAllGrantable(queryRequest, pageable);
return members.map(MemberFindAllResponse::of);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface MemberCustomRepository {

Optional<Member> findNormalByOauthId(String oauthId);

Page<Member> findAllGrantable(Pageable pageable);
Page<Member> findAllGrantable(MemberQueryRequest queryRequest, Pageable pageable);

Page<Member> findAllByRole(MemberQueryRequest queryRequest, MemberRole role, Pageable pageable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ public Optional<Member> findNormalByOauthId(String oauthId) {
}

@Override
public Page<Member> findAllGrantable(Pageable pageable) {
public Page<Member> findAllGrantable(MemberQueryRequest queryRequest, Pageable pageable) {
List<Member> fetch = queryFactory
.selectFrom(member)
.where(eqStatus(MemberStatus.NORMAL), eqRole(MemberRole.GUEST), requirementVerified())
.where(
queryOption(queryRequest),
eqStatus(MemberStatus.NORMAL),
eqRole(MemberRole.GUEST),
requirementVerified())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(member.createdAt.desc())
Expand All @@ -67,7 +71,11 @@ public Page<Member> findAllGrantable(Pageable pageable) {
JPAQuery<Long> countQuery = queryFactory
.select(member.count())
.from(member)
.where(eqStatus(MemberStatus.NORMAL), eqRole(MemberRole.GUEST), requirementVerified());
.where(
queryOption(queryRequest),
eqStatus(MemberStatus.NORMAL),
eqRole(MemberRole.GUEST),
requirementVerified());

return PageableExecutionUtils.getPage(fetch, pageable, countQuery::fetchOne);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spring:
on-profile: "prod"
jpa:
hibernate:
ddl-auto: update
ddl-auto: none

logging:
level:
Expand Down

0 comments on commit c49a5e4

Please sign in to comment.