Merge pull request #115 from dalbodeule/develop

some fix on wsSongListRoutes
This commit is contained in:
JinU Choi 2024-08-24 15:13:02 +09:00 committed by GitHub
commit 3cea492563
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 7 deletions

View File

@ -294,7 +294,6 @@ class UserHandler(
null,
null,
null,
null,
)
)

View File

@ -270,7 +270,7 @@ class MessageHandler(
user.token!!,
SongType.ADD,
msg.userId,
msg.profile?.nickname ?: "",
null,
video,
)
)

View File

@ -14,7 +14,6 @@ class SongEvent(
val uid: String,
val type: SongType,
val reqUid: String?,
val reqName: String?,
val current: YoutubeVideo? = null,
val next: YoutubeVideo? = null,
val delUrl: String? = null,

View File

@ -140,8 +140,7 @@ fun Routing.wsSongListRoutes() {
user.token!!,
SongType.ADD,
user.token,
user.username,
null,
CurrentSong.getSong(user),
youtubeVideo
)
)
@ -151,6 +150,13 @@ fun Routing.wsSongListRoutes() {
logger.debug("SongType.ADD Error: $uid $e")
}
} else if (data.type == SongType.REMOVE.value && data.url != null) {
val songs = SongListService.getSong(user)
val exactSong = songs.firstOrNull { it.url == data.url }
if (exactSong != null) {
SongListService.deleteSong(user, exactSong.uid, exactSong.name)
}
dispatcher.post(
SongEvent(
user.token!!,
@ -158,7 +164,6 @@ fun Routing.wsSongListRoutes() {
null,
null,
null,
null,
data.url
)
)
@ -185,7 +190,6 @@ fun Routing.wsSongListRoutes() {
user.token!!,
SongType.NEXT,
song?.uid,
song?.reqName,
youtubeVideo
)
)