From 55fd3ec59a2df3422d9b75eead59d4945e2da4e6 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Mon, 6 Dec 2021 15:49:39 -0500 Subject: [PATCH] Schema for the new UVA StudyCreator endpoint --- pb/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pb/models.py b/pb/models.py index 58bec76..f624e15 100644 --- a/pb/models.py +++ b/pb/models.py @@ -283,6 +283,20 @@ class IRBStatusSchema(ma.Schema): fields = ("STATUS", "DETAIL") +class CreatorStudySchema(ma.Schema): + class Meta: + model = Study + include_relationships = True + load_instance = True + fields = ["STUDYID", "TITLE", "DATECREATED", "DATELASTMODIFIED"] + DATECREATED = DATELASTMODIFIED = fields.Method("get_dates") + + @staticmethod + def get_dates(obj): + if obj is not None and hasattr(obj, "DATE_MODIFIED"): + return obj.DATE_MODIFIED + + class StudySchema(ma.Schema): class Meta: include_relationships = True