login method changed to chzzk login

This commit is contained in:
dalbodeule
2025-01-08 23:13:04 +09:00
parent eccf1a29bc
commit d3ed6c2d86
10 changed files with 175 additions and 118 deletions

View File

@@ -8,9 +8,8 @@ import org.jetbrains.exposed.dao.id.IntIdTable
object Users: IntIdTable("users") {
val username = varchar("username", 255)
val token = varchar("token", 64).nullable()
val token = varchar("token", 64)
val discord = long("discord").nullable()
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()
@@ -24,7 +23,6 @@ class User(id: EntityID<Int>) : IntEntity(id) {
var username by Users.username
var token by Users.token
var discord by Users.discord
var naverId by Users.naverId
var liveAlertGuild by Users.liveAlertGuild
var liveAlertChannel by Users.liveAlertChannel
var liveAlertMessage by Users.liveAlertMessage

View File

@@ -6,11 +6,11 @@ import space.mori.chzzk_bot.common.models.User
import space.mori.chzzk_bot.common.models.Users
object UserService {
fun saveUser(username: String, naverId: String): User {
fun saveUser(username: String, token: String): User {
return transaction {
User.new {
this.username = username
this.naverId = naverId
this.token = token
}
}
}
@@ -64,14 +64,6 @@ object UserService {
}
}
fun getUserWithNaverId(naverId: String): User? {
return transaction {
val user = User.find{ Users.naverId eq naverId }.firstOrNull()
user?.load(User::subordinates, User::managers)
user
}
}
fun getAllUsers(): List<User> {
return transaction {
User.all().toList()