This commit is contained in:
xds
2025-10-31 15:31:55 +03:00
parent 040da34ff7
commit 7972ea0fdf
117 changed files with 3691 additions and 2013 deletions

View File

@@ -1,9 +1,6 @@
package space.luminic.finance.mappers
import space.luminic.finance.dtos.TransactionDTO
import space.luminic.finance.dtos.TransactionDTO.CreateTransactionDTO
import space.luminic.finance.dtos.TransactionDTO.UpdateTransactionDTO
import space.luminic.finance.mappers.AccountMapper.toDto
import space.luminic.finance.mappers.CategoryMapper.toDto
import space.luminic.finance.mappers.UserMapper.toDto
import space.luminic.finance.models.Transaction
@@ -11,25 +8,16 @@ import space.luminic.finance.models.Transaction
object TransactionMapper {
fun Transaction.toDto() = TransactionDTO(
id = this.id,
parentId = this.parentId,
parentId = this.parent?.id,
type = this.type,
kind = this.kind,
categoryId = this.categoryId,
category = this.category?.toDto(),
category = this.category.toDto(),
comment = this.comment,
amount = this.amount,
fees = this.fees,
fromAccount = this.fromAccount?.toDto(),
toAccount = this.toAccount?.toDto(),
date = this.date,
createdBy = this.createdBy?.username,
updatedBy = this.updatedBy?.username,
isDone = this.isDone,
createdBy = this.createdBy?.toDto() ?: throw IllegalStateException("created by null"),
updatedBy = this.updatedBy?.toDto()
)
}