package space.luminic.finance.mappers import space.luminic.finance.dtos.TransactionDTO import space.luminic.finance.mappers.CategoryMapper.toDto import space.luminic.finance.mappers.UserMapper.toDto import space.luminic.finance.models.Transaction object TransactionMapper { fun Transaction.toDto() = TransactionDTO( id = this.id, parentId = this.parent?.id, type = this.type, kind = this.kind, category = this.category?.toDto(), comment = this.comment, amount = this.amount, fees = this.fees, date = this.date, isDone = this.isDone, createdBy = this.createdBy?.toDto() ?: throw IllegalStateException("created by null"), updatedBy = this.updatedBy?.toDto() ) }