mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
Refresh Token 구현 변경
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from "./client";
|
||||
export * from "./token";
|
||||
export * from "./user";
|
||||
|
||||
18
src/lib/server/db/schema/token.ts
Normal file
18
src/lib/server/db/schema/token.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { sqliteTable, text, integer, unique } from "drizzle-orm/sqlite-core";
|
||||
import { client } from "./client";
|
||||
import { user } from "./user";
|
||||
|
||||
export const refreshToken = sqliteTable(
|
||||
"refresh_token",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
userId: integer("user_id")
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
clientId: integer("client_id").references(() => client.id),
|
||||
expiresAt: integer("expires_at").notNull(), // Only used for cleanup
|
||||
},
|
||||
(t) => ({
|
||||
unq: unique().on(t.userId, t.clientId),
|
||||
}),
|
||||
);
|
||||
@@ -5,9 +5,3 @@ export const user = sqliteTable("user", {
|
||||
email: text("email").notNull().unique(),
|
||||
password: text("password").notNull(),
|
||||
});
|
||||
|
||||
export const revokedToken = sqliteTable("revoked_token", {
|
||||
id: integer("id").primaryKey(),
|
||||
token: text("token").notNull().unique(),
|
||||
revokedAt: integer("revoked_at").notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user