-
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.
- 레이어에서 command와 query로 분리 - 쿼리 객체에 맞는 구성 객체 추가 (MemberView, BookView)
- Loading branch information
Showing
63 changed files
with
665 additions
and
370 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
src/main/java/com/study/bookcafe/application/borrow/BorrowService.java
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
src/main/java/com/study/bookcafe/application/borrow/BorrowServiceImpl.java
This file was deleted.
Oops, something went wrong.
7 changes: 4 additions & 3 deletions
7
...ookcafe/application/book/BookService.java → ...application/command/book/BookService.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,14 +1,15 @@ | ||
package com.study.bookcafe.application.book; | ||
|
||
import com.study.bookcafe.domain.book.Book; | ||
package com.study.bookcafe.application.command.book; | ||
|
||
import com.study.bookcafe.domain.command.book.Book; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
public interface BookService { | ||
|
||
// 도서 조회 (id) | ||
Book findById(long bookId); | ||
|
||
// 도서 목록 조회 (id list) | ||
List<Book> findByIds(Collection<Long> bookIds); | ||
|
||
} |
7 changes: 3 additions & 4 deletions
7
...afe/application/book/BookServiceImpl.java → ...ication/command/book/BookServiceImpl.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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/study/bookcafe/application/command/borrow/BorrowService.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,15 @@ | ||
package com.study.bookcafe.application.command.borrow; | ||
|
||
import com.study.bookcafe.domain.command.borrow.Borrow; | ||
import com.study.bookcafe.domain.command.borrow.Reservation; | ||
import java.util.Collection; | ||
|
||
public interface BorrowService { | ||
|
||
// 도서 대출 저장 | ||
void save(Borrow borrow); | ||
void save(Collection<Borrow> borrows); | ||
|
||
// 도서 예약 저장 | ||
void save(Reservation reservation); | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/com/study/bookcafe/application/command/borrow/BorrowServiceImpl.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,50 @@ | ||
package com.study.bookcafe.application.command.borrow; | ||
|
||
import com.study.bookcafe.domain.command.borrow.BorrowRepository; | ||
import com.study.bookcafe.domain.command.borrow.Borrow; | ||
import com.study.bookcafe.domain.command.borrow.Reservation; | ||
import org.springframework.stereotype.Service; | ||
import java.util.Collection; | ||
|
||
@Service | ||
public class BorrowServiceImpl implements BorrowService { | ||
private final BorrowRepository borrowRepository; | ||
|
||
public BorrowServiceImpl(BorrowRepository borrowRepository) { | ||
this.borrowRepository = borrowRepository; | ||
} | ||
|
||
/** | ||
* 새로운 대출을 저장한다. | ||
* | ||
* @param borrow 대출 정보 | ||
* @return 생성한 대출 정보 | ||
*/ | ||
@Override | ||
public void save(Borrow borrow) { | ||
borrowRepository.save(borrow); | ||
} | ||
|
||
/** | ||
* 새로운 여러 대출들을 저장한다. | ||
* | ||
* @param borrows 대출 목록 | ||
* @return 생성한 대출 정보 목록 | ||
*/ | ||
@Override | ||
public void save(Collection<Borrow> borrows) { | ||
borrowRepository.save(borrows); | ||
} | ||
|
||
/** | ||
* 새로운 예약을 저장한다. | ||
* | ||
* @param reservation 예악 정보 | ||
* @return 생성한 예약 정보 | ||
*/ | ||
@Override | ||
public void save(Reservation reservation) { | ||
borrowRepository.save(reservation); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/study/bookcafe/application/command/member/MemberService.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,16 @@ | ||
package com.study.bookcafe.application.command.member; | ||
|
||
import com.study.bookcafe.domain.command.member.Member; | ||
import java.util.Collection; | ||
|
||
public interface MemberService { | ||
|
||
// 회원 조회 (id) | ||
Member findById(long memberId); | ||
|
||
// 도서 대출 | ||
void borrowBook(long memberId, Collection<Long> bookIds); | ||
|
||
// 도서 예약 | ||
void reserveBook(long memberId, long bookId); | ||
} |
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
23 changes: 0 additions & 23 deletions
23
src/main/java/com/study/bookcafe/application/member/MemberService.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/java/com/study/bookcafe/application/query/book/BookQueryService.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,15 @@ | ||
package com.study.bookcafe.application.query.book; | ||
|
||
import com.study.bookcafe.domain.query.book.BookView; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
public interface BookQueryService { | ||
|
||
// 도서 조회 (id) | ||
BookView findById(long bookId); | ||
|
||
// 도서 목록 조회 (id list) | ||
List<BookView> findByIds(Collection<Long> bookIds); | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/study/bookcafe/application/query/book/BookQueryServiceImpl.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,39 @@ | ||
package com.study.bookcafe.application.query.book; | ||
|
||
import com.study.bookcafe.domain.query.book.BookQueryRepository; | ||
import com.study.bookcafe.domain.query.book.BookView; | ||
import org.springframework.stereotype.Service; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
@Service | ||
public class BookQueryServiceImpl implements BookQueryService { | ||
|
||
private final BookQueryRepository bookQueryRepository; | ||
|
||
public BookQueryServiceImpl(BookQueryRepository bookQueryRepository) { | ||
this.bookQueryRepository = bookQueryRepository; | ||
} | ||
|
||
/** | ||
* 도서를 ID로 조회한다. | ||
* | ||
* @param bookId 도서 ID | ||
* @return 도서 | ||
*/ | ||
@Override | ||
public BookView findById(long bookId) { | ||
return bookQueryRepository.findById(bookId); | ||
} | ||
|
||
/** | ||
* 도서를 ID 목록으로 조회한다. | ||
* | ||
* @param bookIds 도서 ID 목록 | ||
* @return 도서 목록 | ||
*/ | ||
@Override | ||
public List<BookView> findByIds(Collection<Long> bookIds) { | ||
return bookQueryRepository.findByIds(bookIds); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/study/bookcafe/application/query/borrow/BorrowQueryService.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.study.bookcafe.application.query.borrow; | ||
|
||
import com.study.bookcafe.domain.query.borrow.BorrowDetails; | ||
import java.util.List; | ||
|
||
public interface BorrowQueryService { | ||
|
||
// 도서 대출 조회 | ||
List<BorrowDetails> findBorrows(long memberId); | ||
|
||
} |
Oops, something went wrong.