feat: balance and reward

This commit is contained in:
2024-02-24 15:38:48 +03:00
parent c8a234e27b
commit 7e853c48e7
27 changed files with 234 additions and 66 deletions

0
schemas/__init__.py Normal file
View File

20
schemas/base.py Normal file
View File

@@ -0,0 +1,20 @@
from pydantic import BaseModel
from pydantic.alias_generators import to_camel
class CommonConfig:
alias_generator = to_camel
populate_by_name = True
from_attributes = True
class CommonModel(BaseModel):
class Config(CommonConfig):
pass
@classmethod
def json_serialize(cls, obj):
return cls.model_validate(obj).model_dump(by_alias=True)
def to_dict(self, by_alias=True):
return self.model_dump(by_alias=by_alias)