fix: parse date strings to date objects for asyncpg compatibility
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import date as date_type, datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import re
|
import re
|
||||||
@@ -289,10 +289,10 @@ class DocumentServiceImpl(IDocumentService):
|
|||||||
params["user_id"] = UserId
|
params["user_id"] = UserId
|
||||||
if DateFrom:
|
if DateFrom:
|
||||||
filters.append("d.created_at >= :date_from")
|
filters.append("d.created_at >= :date_from")
|
||||||
params["date_from"] = DateFrom.strip()
|
params["date_from"] = date_type.fromisoformat(DateFrom.strip())
|
||||||
if DateTo:
|
if DateTo:
|
||||||
filters.append("d.created_at < (CAST(:date_to AS date) + INTERVAL '1 day')")
|
filters.append("d.created_at < (CAST(:date_to AS date) + INTERVAL '1 day')")
|
||||||
params["date_to"] = DateTo.strip()
|
params["date_to"] = date_type.fromisoformat(DateTo.strip())
|
||||||
|
|
||||||
where_clause = " AND ".join(filters)
|
where_clause = " AND ".join(filters)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user