完善ktor后端项目
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
package ink.snowflake.server.model.database
|
||||||
|
|
||||||
|
import org.jetbrains.exposed.v1.core.dao.id.UUIDTable
|
||||||
|
import org.jetbrains.exposed.v1.datetime.timestampWithTimeZone
|
||||||
|
|
||||||
|
// 定义 AI 表
|
||||||
|
object AISessionsTable : UUIDTable("ai_chat_sessions") {
|
||||||
|
val userId = uuid("user_id")
|
||||||
|
val title = varchar("title", 255).nullable()
|
||||||
|
val createdAt = timestampWithTimeZone("created_at")
|
||||||
|
val updatedAt = timestampWithTimeZone("updated_at")
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package ink.snowflake.server.model.response
|
||||||
|
|
||||||
|
import kotlinx.serialization.Contextual
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SessionListResponse(
|
||||||
|
@Contextual val id: UUID, val title: String?, val updatedAt: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package ink.snowflake.server.utils.Log
|
||||||
|
|
||||||
|
// 这里暂时没用,因为调用的地方,也就是从token获取id,一定是被authenticate包裹的,也就是传入的token一定是有用的,没用的会直接被返回401
|
||||||
|
class UnauthorizedException(message: String) : RuntimeException(message)
|
||||||
Reference in New Issue
Block a user