feat🔫: change api
This commit is contained in:
parent
b5ca96d6b0
commit
0068f71977
36
src/main/kotlin/cn/fadinglight/vo/BillVO.kt
Normal file
36
src/main/kotlin/cn/fadinglight/vo/BillVO.kt
Normal file
|
@ -0,0 +1,36 @@
|
|||
package cn.fadinglight.vo
|
||||
|
||||
import cn.fadinglight.models.Bill
|
||||
import cn.fadinglight.models.BillType
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class BillVO(
|
||||
val id: Int? = null,
|
||||
val type: String,
|
||||
val date: String,
|
||||
val money: Float,
|
||||
val cls: String,
|
||||
val label: String,
|
||||
val options: String = "",
|
||||
)
|
||||
|
||||
fun BillVO.bill() = Bill(
|
||||
id = id,
|
||||
type = BillType.valueOf(type),
|
||||
date = date,
|
||||
money = money,
|
||||
cls = cls,
|
||||
label = label,
|
||||
options = options,
|
||||
)
|
||||
|
||||
fun Bill.vo() = BillVO(
|
||||
id = id,
|
||||
type = type.name,
|
||||
date = date,
|
||||
money = money,
|
||||
cls = cls,
|
||||
label = label,
|
||||
options = options,
|
||||
)
|
33
src/main/kotlin/cn/fadinglight/vo/LabelVO.kt
Normal file
33
src/main/kotlin/cn/fadinglight/vo/LabelVO.kt
Normal file
|
@ -0,0 +1,33 @@
|
|||
package cn.fadinglight.vo
|
||||
|
||||
import cn.fadinglight.models.Label
|
||||
import cn.fadinglight.models.LabelType
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class LabelVO(
|
||||
val name: String,
|
||||
val count: Int,
|
||||
var labels: List<LabelVO>?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class LabelGroup(
|
||||
val consume: List<LabelVO>,
|
||||
val income: List<LabelVO>,
|
||||
)
|
||||
|
||||
|
||||
fun LabelVO.label(type: LabelType) = Label(
|
||||
id = null,
|
||||
type = type,
|
||||
name = name,
|
||||
count = 0,
|
||||
relativedId = null
|
||||
)
|
||||
|
||||
fun Label.vo() = LabelVO(
|
||||
name = name,
|
||||
count = count,
|
||||
labels = emptyList(),
|
||||
)
|
Loading…
Reference in New Issue
Block a user