Skip to content

Conversation

@Sihun23
Copy link
Collaborator

@Sihun23 Sihun23 commented Feb 2, 2025

📄 요약(Summary)

감사로깅 API에 정렬 옵션(sortBy/sortDirection) 추가

✍🏼 상세(More)

PR Desciption

변경 사항 설명

  • 프론트의 요청에 따라 LogController에 시간 기준의 정렬 옵션을 추가했습니다.
  • 동적 sorting 추가하였습니다.

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

PR Log

PR 작업하면서 고민했던 내용, 해결한 내용, 고민 중인 내용 등

새롭게 배운 것

고민 중인 사항

첨부 자료

Requirements for Reviewer

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

✅ 체크리스트(Checklist)

  • PR 양식에 맞게 작성했습니다
  • 모든 테스트가 통과했습니다
  • 프로그램이 정상적으로 작동합니다
  • 적절한 PR 라벨을 설정했습니다
  • 불필요한 코드를 제거했습니다

🚪 이슈 번호(Issue numbers)

Closes #218

@Sihun23 Sihun23 requested a review from parkjaehak February 2, 2025 07:35
@Sihun23 Sihun23 self-assigned this Feb 2, 2025
@Sihun23 Sihun23 changed the title CLAP-215 fix:시간 정렬 파라미터 추가 CLAP-215 fix: 감사로깅 API 시간 정렬 파라미터 추가 Feb 2, 2025
Comment on lines 33 to 41
public ResponseEntity<PageResponse<AnonymousLogResponse>> getLoginAttempts(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "20") int pageSize,
@RequestParam(defaultValue = "timestamp") String sortBy,
@RequestParam(defaultValue = "desc") String sortDirection,
@ModelAttribute FilterLogRequest anonymousLogRequest,
@AuthenticationPrincipal SecurityUserDetails userInfo) {
Pageable pageable = PageRequest.of(page, pageSize);
Pageable pageable = PageRequest.of(
page,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timestamp가 어디 정의되어있나요?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value의 경우 requestAt으로 해야할 것 같습니다.
추가로 .orderBy(memberLogEntity.createdAt.desc()) 속성이 이미 설정되어있는데 pagable로 설정했을때 pagable이 적용되는지 확인해주시고 안되시면 pagable 대신 orderBy를 동적으로 적용하는 방식으로 진행하면 될 것 같습니다.

    List<MemberLogEntity> result = queryFactory
                .selectFrom(memberLogEntity)
                .where(builder)
                .leftJoin(memberLogEntity.member, memberEntity)
                .orderBy(memberLogEntity.createdAt.desc())
                .offset(pageable.getOffset())
                .limit(pageable.getPageSize())
                .fetch();
        long total = queryFactory
                .selectFrom(memberLogEntity)
                .where(builder)
                .fetch().size();
        return new PageImpl<>(result, pageable, total);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정하였습니다. 확인부탁드립니다!
@parkjaehak

@Sihun23 Sihun23 requested a review from joowojr February 3, 2025 02:43
Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@Sihun23 Sihun23 merged commit 5babe14 into develop Feb 3, 2025
1 check passed
@Sihun23 Sihun23 deleted the CLAP-215 branch February 3, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLAP-215 감사로깅 API 시간 정렬 파라미터 추가

4 participants