-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FEAT] Kotlin JDSL을 적용한 무한 스크롤 카페 목록 조회 기능 구현 #9
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.
수고하셨습니다~!
@@ -1,7 +1,10 @@ | |||
package com.coffee.api.cafe.application.repository | |||
|
|||
import com.coffee.api.cafe.domain.Cafe | |||
import org.springframework.data.domain.Slice |
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를 감싼 common domain 객체를 따로 생성하시는 거 어떠신가요?
application layer는 data layer에 대해서 직접적으로 모르는 게 목표입니다!
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가 제공하는 이점을 활용하고 싶어서 래핑하는 새로운 도메인인 CafePage를 생성하여 도메인에 생성해두었습니다!
(다른 레포들을 몇 개 보니 List를 반환하는 경우가 많고 Page 객체를 그냥 반환하는 경우도 있네요)
class CafeEntity ( | ||
@Id | ||
var id: UUID, | ||
|
||
var value: String, | ||
@Column(name = "name", nullable = false) |
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.
하이버네이트 네이밍 전략(CustomPhysicalNamingStrategy) 사용하자는 말씀이시면 사용해본적은 없지만 좋은것 같습니다!
|
||
@Entity | ||
@Table(name = "cafes") |
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.
테이블명에 s 붙은 이유가 궁금합니다~
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.
레코드의 집합이라는 직관적인 의미를 담기 위함이 주된 이유고 단수형 테이블을 컨벤션으로 쓰는 경우는 테이블을 엔티티의 '타입'으로 간주하기 때문인데 아직 정해진 컨벤션이 없어서 복수형을 기본으로 사용했습니다!
var id: UUID, | ||
|
||
@Column(name = "cafe_id", nullable = false) | ||
var cafeId: UUID, |
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.
혹시 객체에 직접 의존하고 있지 않고 UUID만 알고 있는 이유가 있는 이유가 궁금합니다~
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.
fk 제약조건을 지워버리려는 의도인데 어떤지 수민님 의견은 어떤지 궁금합니다
import org.springframework.boot.context.config.ConfigData.PropertySourceOptions.always | ||
import org.springframework.data.domain.Pageable | ||
import org.springframework.data.domain.Slice | ||
import org.springframework.data.domain.SliceImpl |
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.
xxxRepositoryImpl에서 return 되는 객체는 순수 도메인이였으면 합니다! (앞선 리뷰와 동일)
오직 xxxRepositoryImpl만 data 관련해서 알고 application은 data layer에 대해서 모르게!!
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.
순수 도메인을 리턴해야하는게 맞습니다!! 슬라이스를 리턴하면 안됐네요 ㅎㅎㅎ...
@@ -3,24 +3,29 @@ package com.coffee.api.cafe.presentation | |||
import com.coffee.api.cafe.application.usecase.FindCafe | |||
import com.coffee.api.common.presentation.response.ApiResponse | |||
import com.coffee.api.common.presentation.response.ApiResponseGenerator | |||
import io.swagger.v3.oas.annotations.Operation |
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.
저는 swagger가 controller에 있으면 지저분해보이더라구요..!
그래서 혹시 swagger 코드 분리 이렇게 분리하는 건 어떠신가요?
지금은 swagger를 사용하지만 이것 또한 나중에는 restDocs 등 변경될 수도 있는 외부 라이브러리인데
이게 controller 코드가 영향 받는 게 맞나..? 라는 생각이 들어서요~!
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.
스웨거 코드를 따로 분리하는건 처음 봤는데 엄청 좋은 방법인것 같습니다!_!
관련 이슈
#7
주요 변경 사항
기타