Skip to content

Commit

Permalink
Merge pull request #105 from Team-KeepGoing/feature/book
Browse files Browse the repository at this point in the history
Feat :: book 대여자 반환값 추가
  • Loading branch information
priverg authored Nov 7, 2024
2 parents e8106e6 + 2e9f1d9 commit b567bef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@
public class BookMapper {
public BookResponseDto entityToDto(Book entity) {
return BookResponseDto.builder()
.id(entity.getId())
.bookName(entity.getBookName())
.registrationDate(entity.getRegistrationDate())
.writer(entity.getWriter())
.imageUrl(entity.getImageUrl())
.nfcCode(entity.getNfcCode())
.lastBorrowerMail(entity.getLastBorrowerMail())
.rentDate(entity.getRentDate())
.state(entity.getState())
.build();
.id(entity.getId())
.bookName(entity.getBookName())
.registrationDate(entity.getRegistrationDate())
.writer(entity.getWriter())
.imageUrl(entity.getImageUrl())
.borrower(entity.getBorrower() != null ? entity.getBorrower().getName() : "대여자 없음")
.nfcCode(entity.getNfcCode())
.lastBorrowerMail(entity.getLastBorrowerMail())
.rentDate(entity.getRentDate())
.state(entity.getState())
.build();
}

public Book dtoToEntity(BookDto dto, String nfcCode) {
return Book.builder()
.bookName(dto.bookName())
.imageUrl(dto.imageUrl())
.registrationDate(LocalDateTime.now())
.rentDate(dto.rentDate())
.writer(dto.writer())
.state(BookState.AVAILABLE)
.nfcCode(nfcCode)
.build();
.bookName(dto.bookName())
.imageUrl(dto.imageUrl())
.registrationDate(LocalDateTime.now())
.rentDate(dto.rentDate())
.writer(dto.writer())
.state(BookState.AVAILABLE)
.nfcCode(nfcCode)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public record BookResponseDto(
String bookName,
String writer,
String imageUrl,
String borrower,
String nfcCode,
String lastBorrowerMail,
LocalDateTime registrationDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public UserDto getProfileById(long id) {
book.bookName,
book.writer,
book.imageUrl,
book.borrower.name,
book.nfcCode,
book.lastBorrowerMail,
book.registrationDate,
Expand All @@ -82,7 +83,6 @@ public UserDto getProfileById(long id) {
.collect(Collectors.toSet()))
.borrowedBooks(dto.borrowedBooks().stream().filter(r -> r.id() != 0).collect(Collectors.toSet()))
.build();
// return null;
}

@Override
Expand Down

0 comments on commit b567bef

Please sign in to comment.