add spaces
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
25
src/main/kotlin/space/luminic/budgerapp/models/Space.kt
Normal file
25
src/main/kotlin/space/luminic/budgerapp/models/Space.kt
Normal 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,
|
||||
)
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user