add spaces

This commit is contained in:
xds
2025-02-17 17:58:07 +03:00
parent a5b334f6c2
commit d680345a9f
23 changed files with 1097 additions and 285 deletions

View File

@@ -10,6 +10,7 @@ import kotlin.collections.mutableListOf
data class BudgetDTO(
var id: String? = null,
var space: Space? = null,
var name: String,
var dateFrom: LocalDate,
var dateTo: LocalDate,
@@ -26,6 +27,7 @@ data class BudgetDTO(
@Document("budgets")
data class Budget(
@Id var id: String? = null,
@DBRef var space: Space? = null,
var name: String,
var dateFrom: LocalDate,
var dateTo: LocalDate,

View File

@@ -1,6 +1,7 @@
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
@@ -8,6 +9,7 @@ import org.springframework.data.mongodb.core.mapping.Document
data class Category(
@Id
val id: String? = null,
@DBRef var space: Space? = null,
var type: CategoryType,
val name: String,
val description: String? = null,

View File

@@ -8,6 +8,7 @@ import java.util.Date
@Document(collection = "recurrents")
data class Recurrent(
@Id val id: String? = null,
@DBRef var space: Space? = null,
var atDay: Int,
@DBRef var category: Category,
var name: String,

View File

@@ -0,0 +1,25 @@
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.time.LocalDate
import java.time.LocalDateTime
@Document("spaces")
data class Space (
@Id var id: String? = null,
var name: String? = null,
var description: String? = null,
@DBRef var owner: User? = null,
@DBRef val users: MutableList<User> = mutableListOf(),
var invites: MutableList<SpaceInvite> = mutableListOf(),
val createdAt: LocalDate = LocalDate.now(),
)
data class SpaceInvite(
val code: String,
@DBRef val fromUser: User,
val activeTill: LocalDateTime,
)

View File

@@ -12,6 +12,7 @@ import java.util.Date
@Document(collection = "transactions")
data class Transaction(
@Id var id: String? = null,
@DBRef var space: Space? = null,
var type: TransactionType,
@DBRef var user: User?=null,
@DBRef var category: Category,

View File

@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import jakarta.validation.constraints.NotBlank
import org.springframework.data.annotation.Id
import org.springframework.data.mongodb.core.mapping.Document
import java.time.LocalDate
import java.time.LocalDateTime
import java.util.Date
@Document("users")
@@ -17,8 +19,8 @@ data class User (
@JsonIgnore // Скрывает пароль при сериализации
var password: String? = null,
var isActive: Boolean = true,
var regDate: Date? = null,
val createdAt: Date? = null,
var regDate: LocalDate = LocalDate.now(),
val createdAt: LocalDateTime = LocalDateTime.now(),
var roles: MutableList<String> = mutableListOf(),
)