fix: handle invalid order_by attribute in Chat

This commit is contained in:
kaiwdev 2025-10-20 14:19:02 +09:00
parent 43eac35b5b
commit 2b0b87c0f9

View file

@ -441,7 +441,7 @@ class ChatTable:
direction = filter.get("direction") direction = filter.get("direction")
if order_by and direction: if order_by and direction:
if not getattr(Chat, order_by): if not getattr(Chat, order_by, None):
raise ValueError("Invalid order_by field") raise ValueError("Invalid order_by field")
if direction.lower() == "asc": if direction.lower() == "asc":