feat🔫: change api

This commit is contained in:
车厘子 2022-11-17 17:36:11 +08:00
parent b5ca96d6b0
commit 0068f71977
2 changed files with 69 additions and 0 deletions

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

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