Rename Transaction.isExpense to Transaction.expense
This commit is contained in:
parent
0bb80d1162
commit
23af0efb0f
2 changed files with 7 additions and 7 deletions
|
@ -14,7 +14,7 @@ data class Transaction(
|
|||
val date: Instant = Instant.now(),
|
||||
val amount: Long = 0,
|
||||
@ManyToOne val category: Category? = null,
|
||||
val isExpense: Boolean = true,
|
||||
val expense: Boolean = true,
|
||||
@ManyToOne val createdBy: User,
|
||||
@ManyToOne val account: Account
|
||||
) : Comparable<Transaction> {
|
||||
|
@ -27,7 +27,7 @@ data class TransactionResponse(
|
|||
val description: String?,
|
||||
val date: String,
|
||||
val amount: Long,
|
||||
val isExpense: Boolean,
|
||||
val expense: Boolean,
|
||||
val accountId: Long,
|
||||
val categoryId: Long?,
|
||||
val createdBy: Long
|
||||
|
@ -38,7 +38,7 @@ data class TransactionResponse(
|
|||
transaction.description,
|
||||
transaction.date.toString(),
|
||||
transaction.amount,
|
||||
transaction.isExpense,
|
||||
transaction.expense,
|
||||
transaction.account.id!!,
|
||||
if (transaction.category != null) transaction.category.id!! else null,
|
||||
transaction.createdBy.id!!
|
||||
|
@ -51,7 +51,7 @@ data class NewTransactionRequest(
|
|||
val date: String,
|
||||
val amount: Long,
|
||||
val categoryId: Long?,
|
||||
val isExpense: Boolean,
|
||||
val expense: Boolean,
|
||||
val accountId: Long
|
||||
)
|
||||
|
||||
|
@ -61,7 +61,7 @@ data class UpdateTransactionRequest(
|
|||
val date: String?,
|
||||
val amount: Long?,
|
||||
val categoryId: Long?,
|
||||
val isExpense: Boolean?,
|
||||
val expense: Boolean?,
|
||||
val accountId: Long?,
|
||||
val createdBy: Long?
|
||||
)
|
|
@ -62,7 +62,7 @@ class TransactionController @Autowired constructor(
|
|||
date = Instant.parse(request.date),
|
||||
amount = request.amount,
|
||||
category = category,
|
||||
isExpense = request.isExpense,
|
||||
expense = request.expense,
|
||||
account = account,
|
||||
createdBy = getCurrentUser()!!
|
||||
))))
|
||||
|
@ -78,7 +78,7 @@ class TransactionController @Autowired constructor(
|
|||
request.description?.let { transaction = transaction.copy(description = it) }
|
||||
request.date?.let { transaction = transaction.copy(date = Instant.parse(it)) }
|
||||
request.amount?.let { transaction = transaction.copy(amount = it) }
|
||||
request.isExpense?.let { transaction = transaction.copy(isExpense = it) }
|
||||
request.expense?.let { transaction = transaction.copy(expense = it) }
|
||||
request.accountId?.let { accountId ->
|
||||
accountRepository.findByUsersContainsAndId(getCurrentUser()!!, accountId).orElse(null)?.let {
|
||||
account = it
|
||||
|
|
Loading…
Reference in a new issue