From bdc55044194f5247b6f09e289103139da76237de Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 23 Jul 2026 21:51:27 -0400 Subject: [PATCH] M9 S5 (backend): _serialize_device adopts common.iso() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two `x.isoformat() if x else None` copies in auth's device serializer now use the shared iso() helper — completes the isoformat-idiom sweep outside notes.py (auth + sync done; notes.py's remain, tied to its split). _serialize_user is unchanged (no datetime, no cross-module duplicate) and stays in auth.py rather than relocating for no DRY gain. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm --- src/thoughtsync/auth.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/thoughtsync/auth.py b/src/thoughtsync/auth.py index 520b083..80755ae 100644 --- a/src/thoughtsync/auth.py +++ b/src/thoughtsync/auth.py @@ -7,6 +7,7 @@ from datetime import datetime, timezone from quart import Blueprint, g, jsonify, request, session from sqlalchemy import func, select +from .common import iso from .db import session_scope from .models.device_token import DeviceToken from .models.user import User @@ -182,8 +183,8 @@ def _serialize_device(d: DeviceToken) -> dict: return { "id": str(d.id), "name": d.name, - "created_at": d.created_at.isoformat() if d.created_at else None, - "last_used_at": d.last_used_at.isoformat() if d.last_used_at else None, + "created_at": iso(d.created_at), + "last_used_at": iso(d.last_used_at), }