1
1
mirror of https://github.com/ZeroCatDev/ClassworksKV.git synced 2025-10-21 17:53:11 +00:00

移除账户模型中的refreshToken字段,并将accessToken字段修改为可选

This commit is contained in:
SunWuyuan 2025-10-07 20:17:11 +08:00
parent da77018509
commit 3c64226562
No known key found for this signature in database
GPG Key ID: A6A54CF66F56BB64
4 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1 @@
-- This is an empty migration.

View File

@ -0,0 +1,9 @@
/*
Warnings:
- You are about to drop the column `refreshToken` on the `Account` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE `Account` DROP COLUMN `refreshToken`,
MODIFY `accessToken` TEXT NULL;

View File

@ -29,8 +29,7 @@ model Account {
name String? // 用户名称
avatarUrl String? // 用户头像URL
providerData Json? // OAuth提供者返回的完整信息
accessToken String @db.Text // 账户访问令牌
refreshToken String? @db.Text // OAuth refresh token (如果提供者支持) - 可能很长,使用 TEXT
accessToken String? @db.Text // 账户访问令牌
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

View File

@ -310,7 +310,7 @@ router.get("/oauth/:provider/callback", async (req, res) => {
name: normalizedUser.name || account.name,
avatarUrl: normalizedUser.avatarUrl || account.avatarUrl,
providerData: userData,
refreshToken: tokenData.refresh_token || account.refreshToken,
//refreshToken: tokenData.refresh_token || account.refreshToken,
updatedAt: new Date(),
},
});
@ -326,7 +326,7 @@ router.get("/oauth/:provider/callback", async (req, res) => {
avatarUrl: normalizedUser.avatarUrl,
providerData: userData,
accessToken,
refreshToken: tokenData.refresh_token,
//refreshToken: tokenData.refresh_token,
},
});
}