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:
2026-05-23 01:19:40 +08:00
parent 547caaa23b
commit 072d61abb3
3 changed files with 19 additions and 4 deletions
@@ -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
)