-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement FindBooksUseCase with FindBooksPort interface
- Loading branch information
1 parent
ec8a571
commit 22b6bd6
Showing
3 changed files
with
38 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package catalogservice.application; | ||
|
||
import catalogservice.domain.Book; | ||
import io.reactivex.Flowable; | ||
|
||
public interface FindBooksPort { | ||
Flowable<Book> books(); | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/java/catalogservice/application/FindBooksUseCase.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,8 +1,17 @@ | ||
package catalogservice.application; | ||
|
||
import catalogservice.domain.Book; | ||
import io.reactivex.Flowable; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
@RequiredArgsConstructor | ||
public class FindBooksUseCase { | ||
private final FindBooksPort findBooksPort; | ||
|
||
} | ||
public Flowable<Book> invoke() { | ||
return findBooksPort.books(); | ||
} | ||
} |
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,20 @@ | ||
package catalogservice.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Data | ||
public class Book { | ||
private String title; | ||
private String author; | ||
private String additionalAuthors; | ||
private String isbn; | ||
private String isbn13; | ||
private Integer numberOfPages; | ||
private Integer yearPublished; | ||
private Integer originalPublicationYear; | ||
private Long goodreadsBookId; | ||
} |