[+] Support setting favourite music

This commit is contained in:
Clansty
2024-07-28 00:56:18 +08:00
parent 8c7fd78bd4
commit 03ed3f13f4
3 changed files with 29 additions and 0 deletions

View File

@@ -127,6 +127,18 @@ class UpsertUserAllHandler(
}.sortedBy { it.sortNumber })
}
if(req.isNewFavoritemusicList.equals("0"))
// According to code, 0 here represents favourite differ and will send complete new list via userFavoritemusicList.
// Or userFavoritemusicList will be empty
req.userFavoritemusicList?.let { news ->
val key = "favorite_music"
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)()
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
repos.userGeneralData.save(data.apply {
propertyValue = news.map { it.id }.joinToString(",")
})
}
return SUCCESS
}