-
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
좋아요 스킴 초안. Ref #1 #6
base: main
Are you sure you want to change the base?
Conversation
|
||
@Repository | ||
public interface LikeRepository extends CrudRepository<Like, String> { | ||
public default Like findByTrackId(String trackId) { |
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.
별도로 얘기했으나, 남기는 게 좋을 거 같아 코멘트 남겨둡니다.
현재 trackId가 현재 엔티티 컬럼에 존재하지 않고, 보통 인터페이스에서 컬럼명으로 whereColumn으로 메서드를 정의하면 컴파일 시점에 알아서 관련 코드를 만들어 줍니다.
public Like findByTrackId(String trackId);
그리고, 보통 단일 객체를 찾을 땐 JPA 인터페이스에서 기본적으로 Optional<Entity>
를 리턴하는데 이렇게 추가되는 메서드에도 옵셔널을 쓰는 게 좋을 거 같은데 어떨까요?
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.
코멘트 남겨주셨던 부분은 우선, 삭제했습니다 !
src/main/java/io/mtudy/soundcloud/like/domain/entities/AlbumLike.java
Outdated
Show resolved
Hide resolved
src/main/java/io/mtudy/soundcloud/like/domain/entities/AlbumLike.java
Outdated
Show resolved
Hide resolved
src/main/java/io/mtudy/soundcloud/like/domain/entities/Like.java
Outdated
Show resolved
Hide resolved
|
||
@Repository | ||
public interface LikeRepository extends CrudRepository<Like, String> { | ||
public default Like findByTrackId(String trackId) { |
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.
코멘트 남겨주셨던 부분은 우선, 삭제했습니다 !
src/main/resources/schema.graphqls
Outdated
type Mutation { | ||
createTrack(input: CreateTrackInput!): Track | ||
likePlaylist(input: likePlaylistInput!): Like |
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.
이부분은 지금 용어가 혼용 돼 있는데 정리가 필요합니당
플레이리스트를 좋아요 누른다 => like playlist로 접근했ㄴ었는데, like 라는 자원을 생성하는 Create playlist like 뭐 이런식으로 섞여있는데 용어를 어떤식으로 정리하면 좋을까요 ?
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.
음 이건 저도 잘 몰라서 레퍼런스를 좀 찾아봤습니다.
- https://www.moesif.com/blog/api-guide/graphql-best-practices-resources-and-design-patterns/
- https://www.apollographql.com/blog/designing-graphql-mutations-e09de826ed97/
해당 질문에 대해선 두 번째 글이 알찬데, 동사를 먼저 쓰라고 하네요.
지금 케이스에선 likePlaylist
면 괜찮지않나 싶습니다.
빌드가.. 깨집니다! |
close #1