fix: parse since param to datetime for asyncpg compatibility

asyncpg requires datetime objects, not strings, for timestamptz params.
Also use Z suffix in tests to avoid URL-encoding issues with +00:00.
This commit is contained in:
Viktor Barzin 2026-03-14 13:13:48 +00:00
parent 0a4aed9e1b
commit e08486f2bd
No known key found for this signature in database
GPG key ID: 0EB088298288D958
2 changed files with 5 additions and 4 deletions

View file

@ -69,16 +69,17 @@ async def sync_memories(
async with pool.acquire() as conn:
if since:
since_dt = datetime.fromisoformat(since)
rows = await conn.fetch(
"""
SELECT id, content, category, tags, expanded_keywords, importance,
is_sensitive, created_at, updated_at, deleted_at
FROM memories
WHERE user_id = $1 AND updated_at > $2::timestamptz
WHERE user_id = $1 AND updated_at > $2
ORDER BY updated_at ASC
""",
user.user_id,
since,
since_dt,
)
else:
rows = await conn.fetch(