From e5db925f34b87387fb10f5006b2830558731ea0f Mon Sep 17 00:00:00 2001
From: Maximilian Moser <maximilian.moser@tuwien.ac.at>
Date: Wed, 19 Mar 2025 17:31:17 +0100
Subject: [PATCH] Set created & updated timestamps of names to datetime values

* it looks like these fields in the name entry records got turned into
  strings at some point in our TISS sync, causing issues during
  marshmallow serialization
---
 invenio_config_tuw/tiss/tasks.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/invenio_config_tuw/tiss/tasks.py b/invenio_config_tuw/tiss/tasks.py
index afe2161..31e26a0 100644
--- a/invenio_config_tuw/tiss/tasks.py
+++ b/invenio_config_tuw/tiss/tasks.py
@@ -151,6 +151,11 @@ def sync_names_from_tiss() -> dict:
 
                     # if we found a match via ORCID, we update it according to the TISS data
                     name = svc.read(identity=system_identity, id_=name_voc_id)
+
+                    # reset created & updated timestamps to their datetime/non-string
+                    # form, to avoid breakage in the serialization
+                    name._obj["updated"] = name._obj.updated
+                    name._obj["created"] = name._obj.created
                     new_name_data = update_name_data(
                         name.data, employee, tuw_ror_aliases
                     )
-- 
GitLab