def serialize_note(row) -> dict: author=getattr(row,"author",None) return { "id": str(row.id), "note": row.note, "user_id": str(row.user_id) if row.user_id else None, "created_by": str(row.created_by) if row.created_by else None, "created_by_name": author.name if author else None, "created_at": row.created_at.isoformat() if row.created_at else None, "updated_at": row.updated_at.isoformat() if row.updated_at else None, }