-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 특정 책으로 모집중인 모임방 조회 #142
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
Changes from all commits
a24ebf9
61094ac
8d5bebf
ad53742
1eb4255
a6b40fd
10807ad
4d5b14b
f89f269
2fd6da2
7c283d1
e22d3f0
6152448
48c20b0
78c87cf
6f45eed
774075a
25d426f
2bbee07
244b6f9
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 |
|---|---|---|
|
|
@@ -4,28 +4,28 @@ | |
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record GetBookDetailSearchResponse( | ||
| public record BookDetailSearchResponse( | ||
| String title, | ||
| String imageUrl, | ||
| String authorName, | ||
| String publisher, | ||
| String isbn, | ||
| String description, | ||
| int recruitingRoomCount, | ||
| int recruitingReadCount, | ||
| int readCount, | ||
|
Member
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. 붐업~~!! |
||
| boolean isSaved | ||
| ) { | ||
| public static GetBookDetailSearchResponse of(BookDetailSearchResult result) { | ||
| public static BookDetailSearchResponse of(BookDetailSearchResult result) { | ||
|
|
||
| return new GetBookDetailSearchResponse( | ||
| return new BookDetailSearchResponse( | ||
| result.naverDetailBook().title(), | ||
| result.naverDetailBook().imageUrl(), | ||
| result.naverDetailBook().author(), | ||
| result.naverDetailBook().publisher(), | ||
| result.naverDetailBook().isbn(), | ||
| result.naverDetailBook().description(), | ||
| result.recruitingRoomCount(), | ||
| result.recruitingReadCount(), | ||
| result.readCount(), | ||
| result.isSaved()); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package konkuk.thip.book.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.book.application.port.in.dto.BookIsSavedResult; | ||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record BookIsSavedResponse( | ||
| String isbn, | ||
| boolean isSaved | ||
| ) { | ||
| public static BookIsSavedResponse of(BookIsSavedResult bookIsSavedResult) { | ||
| return new BookIsSavedResponse(bookIsSavedResult.isbn(),bookIsSavedResult.isSaved()); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package konkuk.thip.book.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.book.application.port.in.dto.BookMostSearchResult; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record BookMostSearchResponse( | ||
| List<BookMostSearchResult.BookRankInfo> bookList | ||
| ) { | ||
| public static BookMostSearchResponse of(BookMostSearchResult bookMostSearchResult) { | ||
| return new BookMostSearchResponse(bookMostSearchResult.bookList()); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package konkuk.thip.book.adapter.in.web.response; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record BookRecruitingRoomsResponse( | ||
| List<RecruitingRoomDto> recruitingRoomList, | ||
| Integer totalRoomCount, | ||
| String nextCursor, | ||
| boolean isLast | ||
| ) { | ||
| public static BookRecruitingRoomsResponse of(List<RecruitingRoomDto> recruitingRoomList, Integer totalRoomCount, String nextCursor, boolean isLast) { | ||
| return new BookRecruitingRoomsResponse(recruitingRoomList, totalRoomCount, nextCursor, isLast); | ||
| } | ||
|
|
||
| public record RecruitingRoomDto( | ||
| Long roomId, | ||
| String bookImageUrl, | ||
| String roomName, | ||
| int memberCount, | ||
| int recruitCount, | ||
| String deadlineEndDate | ||
| ) { | ||
| } | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import static konkuk.thip.common.exception.code.ErrorCode.BOOK_NOT_FOUND; | ||
| import static konkuk.thip.common.exception.code.ErrorCode.ROOM_NOT_FOUND; | ||
|
|
||
|
|
@@ -22,13 +24,11 @@ public class BookCommandPersistenceAdapter implements BookCommandPort { | |
| private final BookMapper bookMapper; | ||
|
|
||
| @Override | ||
| public Book findByIsbn(String isbn) { | ||
| BookJpaEntity bookJpaEntity = bookJpaRepository.findByIsbn(isbn).orElseThrow( | ||
| () -> new EntityNotFoundException(BOOK_NOT_FOUND)); | ||
| return bookMapper.toDomainEntity(bookJpaEntity); | ||
| public Optional<Book> findByIsbn(String isbn) { | ||
|
Member
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. LGTM |
||
| return bookJpaRepository.findByIsbn(isbn) | ||
| .map(bookMapper::toDomainEntity); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public Long save(Book book) { | ||
| BookJpaEntity bookJpaEntity = bookMapper.toJpaEntity(book); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package konkuk.thip.book.application.mapper; | ||
|
|
||
| import konkuk.thip.book.adapter.in.web.response.BookRecruitingRoomsResponse; | ||
| import konkuk.thip.common.util.DateUtil; | ||
| import konkuk.thip.room.application.port.out.dto.RoomQueryDto; | ||
| import org.mapstruct.Mapper; | ||
| import org.mapstruct.Mapping; | ||
| import org.mapstruct.ReportingPolicy; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Mapper( | ||
| componentModel = "spring", | ||
| imports = DateUtil.class, | ||
| unmappedTargetPolicy = ReportingPolicy.IGNORE // 명시적으로 매핑하지 않은 필드를 무시하도록 설정 | ||
| ) | ||
| public interface BookQueryMapper { | ||
|
|
||
| @Mapping( | ||
| target = "deadlineEndDate", | ||
| expression = "java(DateUtil.formatAfterTime(dto.endDate()))" | ||
| ) | ||
| BookRecruitingRoomsResponse.RecruitingRoomDto toRecruitingRoomDto(RoomQueryDto dto); | ||
|
|
||
| List<BookRecruitingRoomsResponse.RecruitingRoomDto> toRecruitingRoomDtoList(List<RoomQueryDto> roomDtos); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package konkuk.thip.book.application.port.in; | ||
|
|
||
| import konkuk.thip.book.adapter.in.web.response.BookRecruitingRoomsResponse; | ||
|
|
||
| public interface BookRecruitingRoomsUseCase { | ||
|
|
||
| BookRecruitingRoomsResponse getRecruitingRoomsWithBook(String isbn, String cursor); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,19 @@ | |
|
|
||
|
|
||
| import konkuk.thip.book.domain.Book; | ||
| import konkuk.thip.common.exception.EntityNotFoundException; | ||
| import konkuk.thip.common.exception.code.ErrorCode; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface BookCommandPort { | ||
|
|
||
| Book findByIsbn(String isbn); | ||
| Optional<Book> findByIsbn(String isbn); | ||
|
|
||
| default Book getByIsbnOrThrow(String isbn){ | ||
| return findByIsbn(isbn) | ||
| .orElseThrow(() -> new EntityNotFoundException(ErrorCode.BOOK_NOT_FOUND)); | ||
| } | ||
|
Comment on lines
+12
to
+17
Collaborator
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. 굳굳 서비스에서 try catch 를 하나 더 없앨 수 있겠네요 |
||
|
|
||
| Long save(Book book); | ||
|
|
||
|
|
||
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.
커컼.. 이게 아마 dto 컨벤션 바뀌기 전에 다 구현된것들이라.. 메서드명 다 붙어있던거 야무지게 빼주셧네요 감사합니다람쥐~~👍🏻