-
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.
- Loading branch information
hmj
committed
Jan 26, 2024
1 parent
9a75135
commit f9950bd
Showing
6 changed files
with
74 additions
and
53 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
23 changes: 18 additions & 5 deletions
23
src/main/java/com/book/app/modules/books/dto/BookRequestDto.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,24 +1,37 @@ | ||
package com.book.app.modules.books.dto; | ||
|
||
import com.book.app.modules.books.entity.Book; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class BookRequestDto { | ||
@NotBlank(message = "도서 제목을 입력해주세요.") | ||
private String bookTitle; | ||
private String title; | ||
|
||
@NotBlank(message = "저자를 입력해주세요.") | ||
private String author; | ||
|
||
@NotBlank(message = "출판사를 입력해주세요.") | ||
private String publisher; | ||
|
||
@NotBlank(message = "도서 제목을 입력해주세요.") | ||
private String bookImg; | ||
@NotBlank(message = "도서 이미지를 등록해주세요.") | ||
private String img; | ||
|
||
@NotBlank(message = "진행 상태를 선택해주세요.") | ||
private String status; | ||
@NotNull(message = "진행 상태를 선택해주세요.") | ||
private Book.BookStatus status; | ||
|
||
private String createdBy; | ||
|
||
public static Book toEntity(BookRequestDto dto) { | ||
return Book.builder() | ||
.title(dto.getTitle()) | ||
.author(dto.getAuthor()) | ||
.publisher(dto.getPublisher()) | ||
.img(dto.getImg()) | ||
.createdBy(dto.getCreatedBy()) | ||
.status(dto.getStatus()) | ||
.build(); | ||
} | ||
} |
12 changes: 7 additions & 5 deletions
12
src/main/java/com/book/app/modules/books/dto/BookResponseDto.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,20 +1,22 @@ | ||
package com.book.app.modules.books.dto; | ||
|
||
import com.book.app.modules.books.entity.Book; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.sql.Timestamp; | ||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
@Data | ||
@Builder | ||
public class BookResponseDto { | ||
private Long bookId; | ||
private String bookTitle; | ||
private String title; | ||
private String author; | ||
private String publisher; | ||
private String bookImg; | ||
private String img; | ||
private String status; | ||
private String createdBy; | ||
private Timestamp createDt; | ||
private LocalDateTime createDt; | ||
|
||
} |
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