Esempio n. 1
0
 def _create_from_draft(self,
                        draft: types.TypeDraft,
                        id: typing.Optional[str] = None) -> types.Type:
     object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4())
     return types.Type(
         id=str(object_id),
         version=1,
         name=draft.name,
         description=draft.description,
         key=draft.key,
         created_at=datetime.datetime.now(datetime.timezone.utc),
         last_modified_at=datetime.datetime.now(datetime.timezone.utc),
         resource_type_ids=draft.resource_type_ids,
         field_definitions=draft.field_definitions,
     )
 def post_load(self, data, **kwargs):
     return types.Type(**data)
 def post_load(self, data):
     return types.Type(**data)