From 36b695b5311803ba7cf33cf45c1db7688f99312d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=95=E8=B0=B7=E9=85=B1?= <74496778+GooGuJiang@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:32:37 +0800 Subject: [PATCH] fix error --- app/database/score.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/database/score.py b/app/database/score.py index 9710138..10a7e8f 100644 --- a/app/database/score.py +++ b/app/database/score.py @@ -141,7 +141,6 @@ class ScoreBase(AsyncAttrs, SQLModel, UTCBaseModel): if hasattr(v, 'value'): return v.value return str(v) - return v # optional # TODO: current_user_attributes @@ -276,7 +275,7 @@ class ScoreResp(ScoreBase): return converted return v - @field_serializer("statistics", "maximum_statistics", when_used="json") + @field_serializer("statistics", when_used="json") def serialize_statistics_fields(self, v): """序列化统计字段,确保枚举值正确转换为字符串""" if isinstance(v, dict): @@ -291,13 +290,6 @@ class ScoreResp(ScoreBase): return serialized return v - @field_serializer("gamemode", when_used="json") - def serialize_gamemode(self, v): - """序列化游戏模式,确保枚举值正确转换为字符串""" - if hasattr(v, 'value'): - return v.value - return str(v) - @classmethod async def from_db(cls, session: AsyncSession, score: Score) -> "ScoreResp": s = cls.model_validate(score.model_dump())