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

View File

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

View File

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

View File

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