Skip to content

Fix rate limit query: use ISO strings for dates in sql template#42

Merged
TheOneWhoBurns merged 1 commit intorental-systemfrom
claude/fix-login-session-issue-gs3nR
Feb 6, 2026
Merged

Fix rate limit query: use ISO strings for dates in sql template#42
TheOneWhoBurns merged 1 commit intorental-systemfrom
claude/fix-login-session-issue-gs3nR

Conversation

@TheOneWhoBurns
Copy link
Owner

@TheOneWhoBurns TheOneWhoBurns commented Feb 6, 2026

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved timestamp handling in authentication logic to ensure more reliable timezone-aware comparisons and updates.

Drizzle's sql template literal serializes Date objects via .toString()
which produces a format PostgreSQL can't parse. Use .toISOString() with
explicit ::timestamptz casts instead.

https://claude.ai/code/session_01Rf47gNAgM7jDstC4bvffzw
@TheOneWhoBurns TheOneWhoBurns merged commit 485330d into rental-system Feb 6, 2026
1 check failed
@TheOneWhoBurns TheOneWhoBurns deleted the claude/fix-login-session-issue-gs3nR branch February 6, 2026 21:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The change introduces ISO string timestamp variables in the authentication module and updates the SQL upsert logic to perform timezone-aware timestamp comparisons using these new variables instead of previous comparison methods.

Changes

Cohort / File(s) Summary
Timestamp Handling in Auth Upsert
src/lib/server/auth.ts
Introduces nowIso and resetAtIso ISO string variables and refactors SQL upsert logic to use timezone-aware comparisons (cast to timestamptz) for count and resetAt updates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hopped through timestamp lands,
Where ISO strings now shake hands,
With timezone-aware SQL so true,
The upsert logic, fresh and new!
Tick-tock, comparison's done right,
UTC now shines bright! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-login-session-issue-gs3nR

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants