Skip to content

Commit

Permalink
Update PetDataDTO.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Dituon committed Jan 21, 2023
1 parent f91a112 commit 2f734d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/moe/dituon/petpet/server/PetDataDTO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ data class PetDataDTO(
fun encodeToString(dataMap: Map<String, KeyData>): String{
val dataList: ArrayList<PetDataObject> = ArrayList()
dataMap.forEach { (key, data) ->
dataList.add(PetDataObject(key, data.avatar.stream().map { a -> a.type }.toList()))
dataList.add(PetDataObject(
key,
data.avatar.stream().map { a -> a.type }.toList(),
data.alias ?: emptyList()
))
}
return Json.encodeToString(
PetDataDTO(VERSION, dataList)
Expand All @@ -30,7 +34,8 @@ data class PetDataDTO(
@Serializable
data class PetDataObject(
val key: String,
val types: List<AvatarType>
val types: List<AvatarType>,
val alias: List<String>
)


0 comments on commit 2f734d7

Please sign in to comment.