Skip to content

Commit

Permalink
fix: decimal (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
long2ice committed Apr 23, 2024
1 parent 60e7e7a commit e144418
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions meilisync/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
from decimal import Decimal
from typing import Optional

from pydantic import BaseModel
Expand All @@ -22,6 +23,8 @@ def mapping_data(self, fields_mapping: Optional[dict] = None):
v = int(v.timestamp())
elif isinstance(v, datetime.date):
v = str(v)
elif isinstance(v, Decimal):
v = float(v)
if fields_mapping is not None and k in fields_mapping:
real_k = fields_mapping[k] or k
data[real_k] = v
Expand Down

0 comments on commit e144418

Please sign in to comment.