마지막 접속 IP와 User Agent가 빈 값인 경우 DB에 해당 정보를 기록하지 않도록 수정

This commit is contained in:
static
2025-01-13 03:17:54 +09:00
parent 68a764bf28
commit 6a64bb45f2

View File

@@ -20,8 +20,8 @@ export const createSession = async (
clientId,
createdAt: now,
lastUsedAt: now,
lastUsedByIp: ip,
lastUsedByUserAgent: userAgent,
lastUsedByIp: ip || null,
lastUsedByUserAgent: userAgent || null,
});
} catch (e) {
if (e instanceof SqliteError && e.code === "SQLITE_CONSTRAINT_UNIQUE") {
@@ -41,8 +41,8 @@ export const refreshSession = async (
.update(session)
.set({
lastUsedAt: now,
lastUsedByIp: ip ?? undefined,
lastUsedByUserAgent: userAgent ?? undefined,
lastUsedByIp: ip || undefined,
lastUsedByUserAgent: userAgent || undefined,
})
.where(
and(