Encode decimals as number in JSON
This commit is contained in:
parent
148275dd98
commit
b1a94c5359
6 changed files with 36 additions and 1 deletions
|
@ -4,6 +4,8 @@ from uuid import UUID
|
|||
from pydantic import BaseModel
|
||||
import enum
|
||||
|
||||
from app.util.encoders import decimal_encoder
|
||||
|
||||
class AttributeType(enum.Enum):
|
||||
ACTUAL = "Actual"
|
||||
TARGET = "Target"
|
||||
|
@ -52,6 +54,7 @@ class ChargepointVariable(BaseModel):
|
|||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
json_encoders = {Decimal: decimal_encoder}
|
||||
|
||||
class ChargepointVariableUpdate(BaseModel):
|
||||
value: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue