refactor(dto): use nested DTOs for borrow info
- Extract book borrow info into BookBorrowDto - Extract user borrow info into UserBorrowDto - Update BorrowInfoDto to reference the new DTOs
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package com.msksbr.bookmgr.dto
|
||||
|
||||
import com.msksbr.bookmgr.entity.Book
|
||||
import com.msksbr.bookmgr.dto.borrow.BookBorrowDto
|
||||
import com.msksbr.bookmgr.dto.borrow.UserBorrowDto
|
||||
import java.util.Date
|
||||
|
||||
class BorrowInfoDto(
|
||||
val id: Long,
|
||||
val book: Book,
|
||||
val userId: Long,
|
||||
val username: String,
|
||||
val bookBorrowDto: BookBorrowDto,
|
||||
val userBorrowDto: UserBorrowDto,
|
||||
val borrowTime: Date,
|
||||
val returnTime: Date?,
|
||||
val string: String
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.msksbr.bookmgr.dto.borrow
|
||||
|
||||
data class BookBorrowDto(
|
||||
val id: Long,
|
||||
val name: String,
|
||||
val author: String,
|
||||
val number: Int = 1
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.dto.borrow
|
||||
|
||||
data class UserBorrowDto(
|
||||
val id: Long,
|
||||
val username: String,
|
||||
val role: String
|
||||
)
|
||||
Reference in New Issue
Block a user