From 172885ae3835bf4dd2bf51a58bfce68e806cba9c Mon Sep 17 00:00:00 2001 From: dalbodeule <11470513+dalbodeule@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:37:01 +0900 Subject: [PATCH] add Session flows (1x) - fix APIRoutes (debug Naver UserID) --- .../src/main/kotlin/space/mori/chzzk_bot/common/models/User.kt | 2 +- .../kotlin/space/mori/chzzk_bot/common/services/UserService.kt | 2 +- .../kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/kotlin/space/mori/chzzk_bot/common/models/User.kt b/common/src/main/kotlin/space/mori/chzzk_bot/common/models/User.kt index 334a10f..8cd8431 100644 --- a/common/src/main/kotlin/space/mori/chzzk_bot/common/models/User.kt +++ b/common/src/main/kotlin/space/mori/chzzk_bot/common/models/User.kt @@ -10,7 +10,7 @@ object Users: IntIdTable("users") { val username = varchar("username", 255) val token = varchar("token", 64) val discord = long("discord") - val naverId = long("naver_id") + val naverId = varchar('naver_id', 128) val liveAlertGuild = long("live_alert_guild").nullable() val liveAlertChannel = long("live_alert_channel").nullable() val liveAlertMessage = text("live_alert_message").nullable() diff --git a/common/src/main/kotlin/space/mori/chzzk_bot/common/services/UserService.kt b/common/src/main/kotlin/space/mori/chzzk_bot/common/services/UserService.kt index 3863851..4b430a8 100644 --- a/common/src/main/kotlin/space/mori/chzzk_bot/common/services/UserService.kt +++ b/common/src/main/kotlin/space/mori/chzzk_bot/common/services/UserService.kt @@ -47,7 +47,7 @@ object UserService { } } - fun getUserWithNaverId(naverId: Long): User? { + fun getUserWithNaverId(naverId: String): User? { return transaction { val users = User.find(Users.naverId eq naverId) diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt index 9208bd6..617d03c 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt @@ -73,7 +73,7 @@ fun Routing.apiRoutes() { return@get } println(session) - val user = UserService.getUserWithNaverId(session.id.toLong()) + val user = UserService.getUserWithNaverId(session.id) if(user == null) { call.respondText("No session found", status = HttpStatusCode.NotFound) return@get