diff --git a/PROJECT_PLAN.json b/PROJECT_PLAN.json index 1396d8f..fa0e5da 100644 --- a/PROJECT_PLAN.json +++ b/PROJECT_PLAN.json @@ -8,7 +8,7 @@ "branch": "postgres-migration", "totalEstimatedHours": 26, "totalTasks": 28, - "completedTasks": 18 + "completedTasks": 20 }, "context": { "sourceDatabase": { @@ -485,7 +485,7 @@ "id": "TS-003", "name": "Fix notifications.py GET created_after filter", "category": "critical", - "completed": false, + "completed": true, "file": "app/routers_v2/notifications.py", "lines": [34, 44], "notes": "Used for notification polling" @@ -523,7 +523,7 @@ "id": "TS-007", "name": "Fix paperdex.py GET created_after/before filters", "category": "high", - "completed": false, + "completed": true, "file": "app/routers_v2/paperdex.py", "lines": [31, 32, 48, 50], "notes": "Used for filtering paperdex by date range" diff --git a/app/routers_v2/notifications.py b/app/routers_v2/notifications.py index a4f8a31..c9136a8 100644 --- a/app/routers_v2/notifications.py +++ b/app/routers_v2/notifications.py @@ -42,7 +42,9 @@ async def get_notifs( raise HTTPException(status_code=404, detail=f'There are no notifications to filter') if created_after is not None: - all_notif = all_notif.where(Notification.created < created_after) + # Convert milliseconds timestamp to datetime for PostgreSQL comparison + created_after_dt = datetime.fromtimestamp(created_after / 1000) + all_notif = all_notif.where(Notification.created < created_after_dt) if title is not None: all_notif = all_notif.where(Notification.title == title) if desc is not None: diff --git a/app/routers_v2/paperdex.py b/app/routers_v2/paperdex.py index aa2a3b3..15bdaee 100644 --- a/app/routers_v2/paperdex.py +++ b/app/routers_v2/paperdex.py @@ -45,9 +45,13 @@ async def get_paperdex( all_sets = Cardset.select().where(Cardset.id == cardset_id) all_dex = all_dex.where(Paperdex.player.cardset.id == cardset_id) if created_after is not None: - all_dex = all_dex.where(Paperdex.created >= created_after) + # Convert milliseconds timestamp to datetime for PostgreSQL comparison + created_after_dt = datetime.fromtimestamp(created_after / 1000) + all_dex = all_dex.where(Paperdex.created >= created_after_dt) if created_before is not None: - all_dex = all_dex.where(Paperdex.created <= created_before) + # Convert milliseconds timestamp to datetime for PostgreSQL comparison + created_before_dt = datetime.fromtimestamp(created_before / 1000) + all_dex = all_dex.where(Paperdex.created <= created_before_dt) # if all_dex.count() == 0: # db.close()