init
This commit is contained in:
42
src/main/kotlin/space/luminic/budgerapp/models/Budget.kt
Normal file
42
src/main/kotlin/space/luminic/budgerapp/models/Budget.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
package space.luminic.budgerapp.models
|
||||
|
||||
import org.springframework.data.annotation.Id
|
||||
import org.springframework.data.mongodb.core.mapping.DBRef
|
||||
import org.springframework.data.mongodb.core.mapping.Document
|
||||
import java.math.BigDecimal
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
data class BudgetDTO(
|
||||
var id: String? = null,
|
||||
var name: String,
|
||||
var dateFrom: LocalDate,
|
||||
var dateTo: LocalDate,
|
||||
val createdAt: LocalDateTime = LocalDateTime.now(),
|
||||
var plannedExpenses: MutableList<Transaction>? = null,
|
||||
var plannedIncomes: MutableList<Transaction>? = null,
|
||||
var categories: MutableList<BudgetCategory> = mutableListOf(),
|
||||
var transactions: MutableList<Transaction>? = null,
|
||||
|
||||
)
|
||||
|
||||
|
||||
@Document("budgets")
|
||||
data class Budget(
|
||||
@Id var id: String? = null,
|
||||
var name: String,
|
||||
var dateFrom: LocalDate,
|
||||
var dateTo: LocalDate,
|
||||
val createdAt: LocalDateTime = LocalDateTime.now(),
|
||||
var categories: MutableList<BudgetCategory> = mutableListOf(),
|
||||
)
|
||||
|
||||
data class BudgetCategory(
|
||||
@Transient var currentSpent: Double? = null,
|
||||
var currentLimit: Double,
|
||||
@Transient var currentPlanned: Double? = null,
|
||||
@DBRef var category: Category
|
||||
)
|
||||
|
||||
class BudgetNotFoundException(message: String) : NotFoundException(message)
|
||||
Reference in New Issue
Block a user