Allow adding spots. Convert timestamps in the API to UNIX seconds. #2

This commit is contained in:
Ian Renton
2025-10-04 13:28:22 +01:00
parent 0419aab83f
commit 5f16abf709
16 changed files with 51 additions and 37 deletions

View File

@@ -150,9 +150,7 @@ def infer_mode_from_frequency(freq):
# Convert objects to serialisable things. Used by JSON serialiser as a default when it encounters unserializable things.
# Converts datetimes to ISO.
# Anything else it tries to convert to a dict.
# Just converts objects to dict. Try to avoid doing anything clever here when serialising spots, because we also need
# to receive spots without complex handling.
def serialize_everything(obj):
if isinstance(obj, datetime):
return obj.isoformat()
return obj.__dict__