feat(opus): add coef subcards
This commit is contained in:
@@ -132,10 +132,19 @@ class ValidationIn(Schema):
|
||||
|
||||
|
||||
# Collection Schemas
|
||||
class PuzzlePointsFactorOut(Schema):
|
||||
"""Schema for puzzle points factor output"""
|
||||
|
||||
cost: int
|
||||
cycles: int
|
||||
area: int
|
||||
|
||||
|
||||
class SteamCollectionItemOut(ModelSchema):
|
||||
"""Schema for Steam collection item output"""
|
||||
|
||||
steam_url: str
|
||||
points_factor: Optional[PuzzlePointsFactorOut] = None
|
||||
|
||||
class Meta:
|
||||
model = SteamCollectionItem
|
||||
@@ -151,6 +160,16 @@ class SteamCollectionItemOut(ModelSchema):
|
||||
"updated_at",
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def resolve_points_factor(obj) -> Optional[PuzzlePointsFactorOut]:
|
||||
if obj.points_factor:
|
||||
return PuzzlePointsFactorOut(
|
||||
cost=obj.points_factor.cost,
|
||||
cycles=obj.points_factor.cycles,
|
||||
area=obj.points_factor.area,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
# Error Schemas
|
||||
class ErrorOut(Schema):
|
||||
|
||||
Reference in New Issue
Block a user