-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(User): User의 Id에 private getter 제거 * feat(Url): Url의 pattern 변경과 상수로 미리 compile해 두도록 변경 * feat(UserQueryRepository): User 에그리거트에 하나의 repository만 만들어 사용하도록 변경 * docs(Readme): 리드미 일부 수정 * refactor(Notice): 생성자의 파라미터에 개행 추가
- Loading branch information
1 parent
fd554a0
commit 96e30c2
Showing
11 changed files
with
101 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
src/main/java/com/kustacks/kuring/admin/common/dto/FeedbackDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
package com.kustacks.kuring.admin.common.dto; | ||
|
||
import com.kustacks.kuring.user.domain.Feedback; | ||
import com.querydsl.core.annotations.QueryProjection; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class FeedbackDto { | ||
|
||
private String contents; | ||
private Long userId; | ||
private LocalDateTime createdAt; | ||
|
||
public static FeedbackDto from(Feedback feedback) { | ||
return new FeedbackDto(feedback.getContent(), feedback.getUserId(), feedback.getCreatedAt()); | ||
@QueryProjection | ||
public FeedbackDto(String contents, Long userId, LocalDateTime createdAt) { | ||
this.contents = contents; | ||
this.userId = userId; | ||
this.createdAt = createdAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/main/java/com/kustacks/kuring/user/domain/FeedbackRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/kustacks/kuring/user/domain/UserQueryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.kustacks.kuring.user.domain; | ||
|
||
import com.kustacks.kuring.admin.common.dto.FeedbackDto; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import java.util.List; | ||
|
||
public interface UserQueryRepository { | ||
|
||
List<FeedbackDto> findAllFeedbackByPageRequest(Pageable pageable); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/kustacks/kuring/user/domain/UserQueryRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.kustacks.kuring.user.domain; | ||
|
||
import com.kustacks.kuring.admin.common.dto.FeedbackDto; | ||
import com.kustacks.kuring.admin.common.dto.QFeedbackDto; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import java.util.List; | ||
|
||
import static com.kustacks.kuring.user.domain.QFeedback.feedback; | ||
|
||
@RequiredArgsConstructor | ||
public class UserQueryRepositoryImpl implements UserQueryRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<FeedbackDto> findAllFeedbackByPageRequest(Pageable pageable) { | ||
return queryFactory.select(new QFeedbackDto(feedback.content.value, feedback.user.id, feedback.createdAt)) | ||
.from(feedback) | ||
.orderBy(feedback.createdAt.desc()) | ||
.offset(pageable.getOffset()) | ||
.limit(pageable.getPageSize()) | ||
.fetch(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters