update naverMEAPI

- remove nickname, profileImage args.
This commit is contained in:
dalbodeule 2024-08-09 15:00:00 +09:00
parent 1b49780cae
commit 9110917e50
No known key found for this signature in database
GPG Key ID: EFA860D069C9FA65
2 changed files with 8 additions and 9 deletions

View File

@ -88,8 +88,7 @@ val server = embeddedServer(Netty, port = 8080, ) {
}.body() }.body()
call.sessions.set(userInfo.response?.let { profile -> call.sessions.set(userInfo.response?.let { profile ->
UserSession(state, UserSession(state, profile.id)
profile.id, profile.nickname, profile.profile_image)
}) })
redirects[state]?.let { redirect -> redirects[state]?.let { redirect ->
@ -148,16 +147,12 @@ fun stop() {
@Serializable @Serializable
data class UserSession( data class UserSession(
val state: String, val state: String,
val id: String, val id: String
val nickname: String,
val profileImage: String
) )
@Serializable @Serializable
data class NaverMeAPI( data class NaverMeAPI(
val id: String, val id: String
val nickname: String,
val profile_image: String
) )
@Serializable @Serializable

View File

@ -91,11 +91,15 @@ fun Routing.apiRoutes() {
println(session) println(session)
var user = UserService.getUserWithNaverId(session.id) var user = UserService.getUserWithNaverId(session.id)
if(user == null) { if(user == null) {
user = UserService.saveUser(session.nickname, session.id) user = UserService.saveUser("임시닉네임", session.id)
} }
val songConfig = SongConfigService.getConfig(user) val songConfig = SongConfigService.getConfig(user)
val status = user.token?.let { it1 -> getStreamInfo(it1) } val status = user.token?.let { it1 -> getStreamInfo(it1) }
if (user.username == "임시닉네임") {
status?.content?.channel?.let { it1 -> UserService.updateUser(user, it1.channelId, it1.channelName) }
}
if(status?.content == null) { if(status?.content == null) {
call.respondText(user.naverId, status = HttpStatusCode.NotFound) call.respondText(user.naverId, status = HttpStatusCode.NotFound)
return@get return@get