This commit is contained in:
2025-12-02 17:02:20 -05:00
parent f82ba25160
commit 6423d1c1a2
49 changed files with 2320 additions and 349 deletions

View File

@@ -1,3 +1,4 @@
# python
from dataclasses import dataclass
from models.base import BaseModel
@@ -10,13 +11,16 @@ class Reward(BaseModel):
@classmethod
def from_dict(cls, d: dict):
obj = cls(
# Base fields are keyword-only; can be overridden if provided
return cls(
name=d.get('name'),
description=d.get('description'),
cost=d.get('cost', 0),
image_id=d.get('image_id')
image_id=d.get('image_id'),
id=d.get('id'),
created_at=d.get('created_at'),
updated_at=d.get('updated_at')
)
return cls._apply_base_fields(obj, d)
def to_dict(self):
base = super().to_dict()