feat: balance and reward
This commit is contained in:
0
schemas/__init__.py
Normal file
0
schemas/__init__.py
Normal file
20
schemas/base.py
Normal file
20
schemas/base.py
Normal 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)
|
||||
Reference in New Issue
Block a user