Fix missing empty constructors for entity classes
This commit is contained in:
parent
bb160448be
commit
37b45e0c22
3 changed files with 15 additions and 7 deletions
|
@ -16,7 +16,9 @@ data class Budget(
|
|||
@OneToMany(mappedBy = "budget") val transactions: Set<Transaction> = TreeSet(),
|
||||
@OneToMany(mappedBy = "budget") val categories: Set<Category> = TreeSet(),
|
||||
@ManyToMany val users: Set<User> = mutableSetOf(),
|
||||
@ManyToOne val owner: User
|
||||
@Column(nullable = false)
|
||||
@ManyToOne
|
||||
val owner: User? = null
|
||||
)
|
||||
|
||||
data class NewBudgetRequest(val name: String, val description: String?, val userIds: Set<Long>)
|
||||
|
|
|
@ -11,7 +11,9 @@ data class Category(
|
|||
val title: String = "",
|
||||
val description: String? = null,
|
||||
val amount: Long = 0,
|
||||
@ManyToOne val budget: Budget,
|
||||
@Column(nullable = false)
|
||||
@ManyToOne
|
||||
val budget: Budget? = null,
|
||||
@OneToMany(mappedBy = "category") val transactions: Set<Transaction> = emptySet(),
|
||||
val expense: Boolean? = true
|
||||
) : Comparable<Category> {
|
||||
|
@ -31,7 +33,7 @@ data class CategoryResponse(
|
|||
category.title,
|
||||
category.description,
|
||||
category.amount,
|
||||
category.budget.id!!,
|
||||
category.budget!!.id!!,
|
||||
category.expense
|
||||
)
|
||||
}
|
||||
|
|
|
@ -15,8 +15,12 @@ data class Transaction(
|
|||
val amount: Long = 0,
|
||||
@ManyToOne val category: Category? = null,
|
||||
val expense: Boolean = true,
|
||||
@ManyToOne val createdBy: User,
|
||||
@ManyToOne val budget: Budget
|
||||
@ManyToOne
|
||||
@Column(nullable = false)
|
||||
val createdBy: User? = null,
|
||||
@ManyToOne
|
||||
@Column(nullable = false)
|
||||
val budget: Budget? = null
|
||||
) : Comparable<Transaction> {
|
||||
override fun compareTo(other: Transaction): Int = this.date.compareTo(other.date)
|
||||
}
|
||||
|
@ -39,9 +43,9 @@ data class TransactionResponse(
|
|||
transaction.date.toString(),
|
||||
transaction.amount,
|
||||
transaction.expense,
|
||||
transaction.budget.id!!,
|
||||
transaction.budget!!.id!!,
|
||||
if (transaction.category != null) transaction.category.id!! else null,
|
||||
transaction.createdBy.id!!
|
||||
transaction.createdBy!!.id!!
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue