This commit is contained in:
Vladimir Voronin
2025-01-07 12:35:17 +03:00
commit afd8e9f6d7
72 changed files with 4606 additions and 0 deletions

View 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)