DB 입출력시의 타입 가드 추가

This commit is contained in:
static
2024-12-29 16:54:48 +09:00
parent 516375142d
commit 46938ef700
6 changed files with 18 additions and 23 deletions

View File

@@ -6,7 +6,7 @@ import db from "./drizzle";
import { refreshToken } from "./schema";
const expiresIn = ms(env.jwt.refreshExp);
const expiresAt = () => Date.now() + expiresIn;
const expiresAt = () => new Date(Date.now() + expiresIn);
export const registerRefreshToken = async (
userId: number,
@@ -71,5 +71,5 @@ export const revokeRefreshToken = async (tokenId: string) => {
};
export const cleanupExpiredRefreshTokens = async () => {
await db.delete(refreshToken).where(lte(refreshToken.expiresAt, Date.now())).execute();
await db.delete(refreshToken).where(lte(refreshToken.expiresAt, new Date())).execute();
};