-
Couldn't load subscription status.
- Fork 5
feature :: 게시판 첨부파일 기능 추가 #318
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| BBSDto result = BBSDto.from(entity, fileRepository.findByReferenceTypeAndReferenceNo(REFERENCE_TYPE, entity.getBbsNo())); | ||
|
|
||
| return BBSDto.from(bbsRepository.findOneByBbsNo(bbsNo)); | ||
| return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
바로 리턴 하셔도 괜찮을거 같습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 LGTM
| Page<BBSListDto> getBBSWithConditionByPage(String type, String keyword, Pageable pageable); | ||
| Slice<BBSListDto> getBBSWithConditionBySlice(String type, String keyword, Pageable pageable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
페이지를 반환하는 메서드와 슬라이스를 반환하는 메서드를 둘 다 만들어 두는 점 좋은 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다
LGTM!
| @Override | ||
| public Slice<BBSListDto> getBBSWithConditionBySlice(String type, String keyword, Pageable pageable) { | ||
|
|
||
| Predicate finalPredicate = bBS.isVisible.eq(true) | ||
| .and(bBS.type.eq(BBSType.valueOf(type).name())); | ||
|
|
||
| List<BBSListDto> bbs = getBBSListWithMember(). | ||
| where( | ||
| finalPredicate, | ||
| keywordContains(keyword) | ||
| ) | ||
| .orderBy(bBS.createdAt.desc()) | ||
| .offset(pageable.getOffset()) | ||
| .limit(pageable.getPageSize() + 1) | ||
| .fetch(); | ||
|
|
||
| boolean hasNext = false; | ||
| int pageSize = pageable.getPageSize(); | ||
| if(bbs.size() > pageSize){ | ||
| bbs.remove(pageSize); | ||
| hasNext = true; | ||
| } | ||
|
|
||
| return new SliceImpl<>(bbs, pageable, hasNext); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slice 적용 시 참고하겠습니다~
| bBS.member.memberNo, | ||
| bBS.member.id | ||
| member.memberNo, | ||
| member.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분에서 성능 개선이 있었군요!
| } | ||
|
|
||
| public static BBSDto from(BBS entity){ | ||
| public static BBSDto from(BBS entity, List<File> byReferenceTypeAndReferenceNo){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
byReferenceTypeAndReferenceNo 대신에 좀 더 '파일 리스트'인 게 드러나는 변수명이 좋지 않을까요?
💡 Motivation and Context
여기에 왜 이 PR이 필요했는지, PR을 통해 무엇이 바뀌는지에 대해서 설명해 주세요쿼리 수정하여 500ms -> slice 적용하여 400ms로 단축하였습니다.
첨부파일 저장
첨부파일 조회
JOIN절이 2중으로 걸려 딜레이 발생하여 한번만 조인되도록 수정하였습니다.
🔨 Modified
🌟 More
테스트코드는 발표후에 시간날 때 천천히 하는것으로....
API버저닝은 url을 쓰지말고 API헤더를 추가하여 같은 호출Mapping을 쓰되 버전마다 enum을 통해 매핑하여
알맞는 method를 타게끔 적용하고 싶었는데 적용이 쉽지않아 일단은 보류하였습니다.
이는 전략(Strategy) 패턴과 유사성을 가지고 있습니다.
url 버저닝
📋 커밋 전 체크리스트
🤟🏻 PR로 완료된 이슈
closes #