Replace deprecated datetime.utcnow() with timezone-aware UTC
All checks were successful
Build And Test / publish (push) Successful in 48s
All checks were successful
Build And Test / publish (push) Successful in 48s
Use datetime.now(timezone.utc) instead of deprecated utcnow(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
"""SQLModel database models for caching PIM data."""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
from sqlmodel import SQLModel, Field
|
||||
|
||||
|
||||
def utc_now() -> datetime:
|
||||
"""Return timezone-aware UTC datetime."""
|
||||
return datetime.now(timezone.utc)
|
||||
|
||||
|
||||
class CacheMeta(SQLModel, table=True):
|
||||
"""Generic key-value cache metadata."""
|
||||
|
||||
@@ -29,7 +34,7 @@ class EmailCache(SQLModel, table=True):
|
||||
is_flagged: bool = False
|
||||
snippet: Optional[str] = None
|
||||
full_data: Optional[str] = Field(default=None, description="JSON blob of full email data")
|
||||
cached_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
cached_at: datetime = Field(default_factory=utc_now)
|
||||
|
||||
|
||||
class EventCache(SQLModel, table=True):
|
||||
@@ -43,7 +48,7 @@ class EventCache(SQLModel, table=True):
|
||||
start_time: Optional[datetime] = Field(default=None, index=True)
|
||||
end_time: Optional[datetime] = None
|
||||
full_data: Optional[str] = Field(default=None, description="JSON blob of full event data")
|
||||
cached_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
cached_at: datetime = Field(default_factory=utc_now)
|
||||
|
||||
|
||||
class ContactCache(SQLModel, table=True):
|
||||
@@ -56,7 +61,7 @@ class ContactCache(SQLModel, table=True):
|
||||
display_name: Optional[str] = Field(default=None, index=True)
|
||||
primary_email: Optional[str] = None
|
||||
full_data: Optional[str] = Field(default=None, description="JSON blob of full contact data")
|
||||
cached_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
cached_at: datetime = Field(default_factory=utc_now)
|
||||
|
||||
|
||||
class SyncState(SQLModel, table=True):
|
||||
@@ -86,7 +91,7 @@ class SeenEmail(SQLModel, table=True):
|
||||
from_address: Optional[str] = Field(default=None, description="Sender email for logging")
|
||||
subject: Optional[str] = Field(default=None, description="Subject for logging")
|
||||
email_date: Optional[datetime] = Field(default=None, description="Email date")
|
||||
seen_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
seen_at: datetime = Field(default_factory=utc_now)
|
||||
notification_sent: bool = Field(default=False)
|
||||
notification_sent_at: Optional[datetime] = None
|
||||
notification_error: Optional[str] = Field(
|
||||
|
||||
Reference in New Issue
Block a user