-
Notifications
You must be signed in to change notification settings - Fork 3
Review #151
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: code-review
Are you sure you want to change the base?
Review #151
Changes from all commits
2da99e5
27d8f40
f783e26
5f1f3ce
8289c84
e2152f3
2dcb5ad
aec48e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ public class RestaurantRepositoryCustomImpl implements RestaurantRepositoryCusto | |
|
|
||
| private final JPAQueryFactory queryFactory; | ||
|
|
||
| // querydsl gradle 후 Q 클래스들이 제가 사용하려는 클래스들만이 아니라 모든 클래스들에 대한 Q 클래스가 생성되는데 다른 방법은 없는 것인지 궁금합니다! | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 질문의 요지는 |
||
| @Override | ||
| public Page<RestaurantEntity> findRestaurantsByCriteria(Pageable pageable, String criteria, String type, String keyword) { | ||
| QRestaurantEntity restaurant = QRestaurantEntity.restaurantEntity; // Q 클래스 사용 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,10 @@ public Page<RestaurantPreviewResponse> restaurantPreviewPaging(Pageable pageable | |
|
|
||
| } | ||
|
|
||
| // 식당 프리뷰(홈 화면)를 조회할 때마다 DB에서 리뷰, 스크랩 데이터를 조회하고, 업데이트를 하면 서버의 부하가 클 것이라 예상하였습니다. | ||
| // 그렇기 때문에 조회할 때마다 업데이트가 아닌 스케줄러를 이용해서 1시간 마다 업데이트하는 방식으로 진행하고 있습니다. | ||
| // 이 방식보다 더 효율적이고 좋은 방안이 있을까요? | ||
| // 또한 홈 화면의 식당 프리뷰 조회 시마다 DB의 데이터를 계속 조회하는 것이 아닌 다른 좋은 방안이 있을까요? 떠오르는 것은 캐시를 활용하면 될 것 같습니다. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| @Scheduled(cron = "0 0 0/1 * * *") | ||
| // @Scheduled(cron = "0 0 0 * * ?") | ||
| public void scheduleUpdateRestaurantPreview() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
|
|
||
| public class CatchLineException extends RuntimeException { | ||
|
|
||
| // Custom Exception의 최상위 Exception으로 이 Exception을 이용하고 있습니다. | ||
| // 다른 Custom Exception은 모두 이 Exception을 상속받고 있습니다. | ||
| // Exception에 추가로 넣어야 할 정보와 실무에서는 Custom Exception을 어떻게 사용하고 계신지 궁금합니다. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 자주 발생하는 Exception의 종류를 구분 해주는 ErrorType 같은걸 Enum으로 선언해서, 각 Enum들이 기본 Message를 가지게 하는 방법도 있구요, 생성자 오버로딩을 다양하게 해서 ErrorType만 받는다던지, ErrorType과 message를 같이 받는다던지, 혹은 다른 API or 라이브러리를 사용하다가 발생하는 Exception에 대응하기 위해 Throwable 도 파라미터로 받는 방법도 있습니다~ |
||
| public CatchLineException(String message) { | ||
| super(message); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,10 @@ | |
| import java.io.IOException; | ||
| import java.net.URLEncoder; | ||
|
|
||
|
|
||
| // TODO: 코드리뷰 | ||
|
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class OwnerPreviewFilter extends OncePerRequestFilter { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| @AllArgsConstructor | ||
| public class ScrapId { | ||
|
|
||
| // 현재 복합키를 이용해서 scrapId를 구현했습니다. | ||
| // 실무에서 복합키를 사용하는지, 사용한다면 사용하는 경우가 궁금합니다. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 실무에서도 복합키를 사용 해요. 한가지 예시로 Envers를 이용한 데이터 변경 이력을 관리할때 인데요, Envers를 사용하게 되면 이력테이블의 키는 원본테이블의 키와 이력 테이블의 rev 로 복합키를 구성해서 사용 합니다~ |
||
| private Long memberId; | ||
|
|
||
| private Long restaurantId; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <configuration> | ||
|
|
||
| <!-- ec2 서버에서 실행할 때 로그 파일을 따로 만들기 위해 logback-spring.xml 파일을 작성했는데 디렉터님께서 말씀하신 로그 파일이 이런 형식으로 작성하는 것이 맞는지 궁금합니다.--> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <!-- 로그 console 출력 설정 --> | ||
| <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
| <encoder> | ||
|
|
||
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.
@Transactional어노테이션을 붙여놓고 메서드 레벨에서는 생략 하는 경우도 있고, 반대로 메서드 레벨에서 모두 붙여서 사용 하는 경우도 있죠